Vcl.Forms.TCustomForm.OnCloseQuery

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

property OnCloseQuery: TCloseQueryEvent read FOnCloseQuery write FOnCloseQuery

C++

__property TCloseQueryEvent OnCloseQuery = {read=FOnCloseQuery, write=FOnCloseQuery, stored=IsForm};

Properties

Type Visibility Source Unit Parent
event protected
Vcl.Forms.pas
Vcl.Forms.hpp
Vcl.Forms TCustomForm

Description

Occurs when close is attempted.

Use OnCloseQuery to specify the conditions under which the form can close. An OnCloseQuery event handler returns a Boolean CanClose value that determines whether a form is allowed to close. Its default value is true.

You can use an OnCloseQuery event handler to ask users if they are sure they really want the form closed immediately. For example, you can use the handler to display a message box that prompts the user to save a file before closing the form.

The TCloseQueryEvent type points to the method that determines whether a form can be closed. The value of the CanClose parameter determines if the form can close or not.

See Also

Code Examples