Sign in Join
FPDoc Onlineexperiment

TCustomForm.AddHandlerClose procedure

Member of TCustomFormpublicIn unit Forms

Adds a handler for a form close event.

Declaration

pascal
procedure AddHandlerClose(OnCloseHandler: TCloseEvent; 
 AsFirst: Boolean=False)

Description

AddHandlerClose is a method used to add the TCloseEvent handler specified in OnCloseHandler to the list of form handlers for the type. It allows a form instance to have additional event handlers which behave just like the OnClose event handler.

AddHandlerClose calls the AddHandler method to create the TMethod entry used to represent the handler routine. When AsFirst is True, the routine in OnCloseHandler is inserted as the first item in the list of form close handlers.

Applications must implement and assign an object procedure using the signature in TCloseEvent to perform actions needed when the Close or CloseModal method is called for the form instance.

A handler added using AddHandlerClose is signalled after the OnClose event handler for the form instance.

Use RemoveHandlerClose to remove a form close handler added in the method.

See also

An experiment, built from Lazarus main 2dfa93c66e of 10-22-2026. Not the official Lazarus documentation.