Sign in Join
FPDoc Onlineexperiment

TLazarusFileDialogForm.HandleCloseQuery procedure

Member of TLazarusFileDialogFormpublicIn unit LazDialogs

Event handler for an OnCloseQuery event notification.

Declaration

pascal
procedure HandleCloseQuery(Sender: TObject; var CanClose: Boolean)

Arguments

Sender

Component performing the event notification.

CanClose

Indicates if the Lazarus dialog form can be closed.

Description

HandleCloseQuery is a procedure used as the event handler for the OnCloseQuery event notification. It is assigned in the Initialize method.

HandleCloseQuery ensures that the Lazarus dialog form can in fact be closed, and updates the value in internal FileName when needed. It sets the value in the CanClose parameter to False when the modal result for the dialog form is mrCancel. No additional actions are performed in the method if the dialog form cannot be closed.

Additional actions are performed in the method to update FileName and CanClose based on the TLazFileDialogKind value used in the dialog form. For Save dialogs (where Kind is ldkSaveDesktop or ldkSavePDA), the value in the SaveEdit control cannot contain be an empty string (''). No additional actions are performed in the method when SaveEdit is empty. Otherwise, the values from the selected item in ShellTreeView, PathDelimite, and SaveEdit are combined and assigned to FileName. CanClose is also set to True.

For Open dialogs (where Kind is ldkOpenDesktop or ldkOpenPDA), the selected item in ShellListView cannot be unassigned (Nil). No additional actions are performed in the method when the selected item in ShellListView is unassigned. Otherwise, the value in FileName is set to the path and file name for the selected item in ShellListView. CanClose is also set to True.

For other dialog kinds, the selected item in ShellTreeView cannot be unassigned (Nil). No additional actions are perform when the selected item in ShellTreeView is unassigned. Otherwise, the path information for the selected item is stored in FileName. CanClose is also set to True.

See also

An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.