API:FMX.Forms.TForm.OnCloseQuery

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

property OnCloseQuery: TCloseQueryEvent read FOnCloseQuery write FOnCloseQuery;

C++

__property OnCloseQuery;

Properties

Type Visibility Source Unit Parent
event published
FMX.Forms.pas
FMX.Forms.hpp
FMX.Forms TForm

Description

Occurs when there is an attempt to close the form.

FMX.Forms.TForm.OnCloseQuery inherits from FMX.Forms.TCommonCustomForm.OnCloseQuery. All content below this line refers to FMX.Forms.TCommonCustomForm.OnCloseQuery.

Occurs when there is an attempt to close the form.

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 whether they are sure they 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 whether the form can be closed or not.

See Also