From RAD Studio API Documentation
Jump to: navigation, search


property OnCanClose: TCloseQueryEvent read FOnCanClose write FOnCanClose;


__property Vcl::Forms::TCloseQueryEvent OnCanClose = {read=FOnCanClose, write=FOnCanClose};


Type Visibility Source Unit Parent
event published
Vcl.Dialogs TOpenDialog


Occurs when the user tries to close the dialog without canceling.

Write an OnCanClose event handler to provide custom validation of the value of FileName. File selection dialogs provide a number of built-in validations, such as checking for invalid characters, prompting for confirmation before overwriting, checking whether a file or path exists, and so on. These validations can be specified using the Options property. However, applications can provide additional validation of file names in an OnCanClose event handler.

Set the CanClose parameter to false to prevent the dialog from closing. The OnCanClose event handler is responsible for telling the user why the dialog doesn't close.

Note: OnCanClose does not occur under Windows NT 3.51 unless the new shell is installed.

See Also