RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
TOpenDialog.OnCanClose Event

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

Pascal
property OnCanClose: TCloseQueryEvent;
C++
__property TCloseQueryEvent OnCanClose;

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.
 

 

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!