RAD Studio Learn C++ Event Handling In 5 Minutes

FireWind

Свой
Регистрация
2 Дек 2005
Сообщения
1,957
Реакции
1,199
Credits
4,009
Learn C++ Event Handling In 5 Minutes
November 18, 2020 By Muminjon

In this short tutorial, C++ Product Manager, David Millington, explains what event handlers are and how to use them in your C++ application development.

Overview

  • The event is that something happens.
  • Event handler – a method that’s called when something happens or is attached to an event.
    • Technical details: an object-method pointer, referring to both the method and object instance on which to call the method. And it can have any signature.

Defining Event Handlers

In an event receiver class, you define event handlers, which are methods with signatures for instance: return types, calling conventions, and arguments that match the event that they will handle.

Firing Events

To fire an event, simply call the method declared as an event in the event source class. If handlers have been hooked to the event, the handlers will be called.

Be sure to check out other tutorials on C++ Builder here: