TControl.AddHandler procedure
Adds a notification handler for the specified control handler type.
Declaration
procedure AddHandler(HandlerType: TControlHandlerType;
const AMethod: TMethod; AsFirst: Boolean=False)Arguments
HandlerType | Control handler type of the handler routine. |
AMethod | The handler routine added in the method. |
AsFirst | True if the handler routine is signalled first in the notification order. |
Description
AddHandler is a method used to include the handler routine
specified in
AMethod in the list of notification handlers for the
type in
HandlerType.
HandlerType is a
TControlHandlerType enumeration value,
and indicates both the subject for the notification and the method list where
the handler routine is stored.
AMethod is the
TMethod instance with the handler
routine signalled when a notification is needed. It is an object procedure
which implements the
TNotifyEvent signature and cast to the
TMethod type.
AddHandler ensures that a TMethodList instance has been allocated
for handler routines using the specified type; if it does not exist, it is
created and stored in the internal array of handler types.
AddHandler calls the Add method in the method list to store the routine in AMethod.
AsFirst indicates whether the routine is inserted as the first
item in the list. When set to False, the routine is appended as the last
entry in the method list.
Use RemoveHandler to remove a handler routine from the method list for a specific handler type.
Convenience methods which act upon a specific control handler type using TNotifyEvent arguments are also available. For example:
- AddHandlerOnResize
- AddHandlerOnChangeBounds
- AddHandlerOnVisibleChanged
- and others
See also
An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.
