Contains classes, types, and routines needed for Lazarus dialogs in custom-drawn and non-desktop environments.

lazdialogs.pas contains classes, types, and routines needed for Lazarus dialogs in custom-drawn and non-desktop environments.

Enumerated type which represents the dialog kind in a Lazarus dialog form. Dialog is an open dialog for desktop environments. Dialog is a save dialog for desktop environments. Dialog is an open dialog for PDA environments. Dialog is a save dialog for PDA environments. Dialog is a directory selection dialog. Member used to store the TLazFileDialogKind enumeration value for the dialog form. Sets the value for the file mask used in the Filter for the dialog form.

SetFilter is a procedure used to set the value in the Filter for the dialog form. SetFilter ensures that the new property value in AFilter is also applied to the filter for the combo box in the dialog form.

When AFilter is an empty string (''), the filter in FilterComboBox is set to the file mask that matches all files (rsAllFiles). Otherwise, the new property value in AFilter is used in the filter for FilterComboBox.

New value for the Filter member. Button panel for the Lazarus dialog form.

ButtonPanel is a TButtonPanel member that contains the buttons appropriate for the kind of Lazarus dialog. ButtonPanel is configured by default to display and respond to Ok and Cancel buttons in the Initialize method. Specialized dialog types can alter the default buttons and their actions.

Shell tree view control for the Lazarus dialog form. Shell list view control for the Lazarus dialog form. Combo box control used for the file mask filter in the Lazarus dialog form. File name for the selected file in the Lazarus dialog form.

FileName is a String member which contains the full path and file name for the item affected by the Lazarus dialog.

For Open dialogs, it contains the path for the Selected item in the ShellListView control. For Save dialogs, it contains the path for the Selected directory in the ShellTreeView combined with the value from the SaveEdit control. For other dialog types, it contains the path information for the Selected item in the ShellTreeView control.

File mask filter for the Lazarus dialog form. Initial directory used in the Lazarus file dialog form. Title displayed for the Lazarus dialog form. Alternate constructor for the class instance.

CreateNew is an overridden constructor for the class instance. CreateNew calls the inherited method using values in AOwner and Num as arguments. CreateNew ensures that the Lazarus dialog form sets its position to the value poScreenCenter.

CreateNew allows the form instance to be created without using the associated .lfm file. The CreateNew constructor is used (instead of Create) when the TCustomForm descendant is not a TForm class instance or not a descendant of TForm.

See the Initialize method for information about creation and positioning of child controls on the Lazarus dialog form.

TCustomForm.CreateNew
Owner of the Lazarus dialog form. Not used in the current implementation. Creates and positions child controls on the Lazarus dialog form.

Initialize is a procedure used to create and position child controls on the Lazarus dialog form appropriate for the dialog type specified in AKind.

The value in AKind is stored in an internal member in the class instance, and is used to determine the child controls configured and displayed on the Lazarus dialog form. It affects the following child controls:

  • ShellTreeView
  • ShellListView
  • SaveEdit
  • FilterComboBox
  • ButtonPanel

Initialize creates the ButtonPanel for the Lazarus dialog form, and positions it aligned to the bottom of the form instance. ButtonPanel is configured to display Ok and Cancel buttons, and uses the HandleOkClick and HandleCancelClick methods to respond to the OnClick events for the respective buttons.

Initialize uses the HandleCloseQuery method as the event handler for the OnCloseQuery event.

Dialog kind for the Lazarus dialog form instance. Event handler signalled when the OK button is clicked. . Event handler signalled when the Cancel button is clicked. Component generating the event notification. Event handler for an OnCloseQuery event notification.

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 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.

Component performing the event notification. Indicates if the Lazarus dialog form can be closed. Event handler for changes to the value in the SaveEdit control.

HandleEditChange is a procedure used as the event handler for changes to the value in the SaveEdit control. It is assigned to the control in the Initialize method.

HandleEditChange ensures that the OK button in ButtonPanel is enabled or disabled based on the value in SaveEdit; it is enabled when the value for SaveEdit is not an empty string ('').

Component generating the event notification. Event handler for changes to the selected item in ShellListView.

HandleSelectItem is a procedure used as the event handler for a change to the selected item in ShellListView. It is assigned to the OnSelectItem property in ShellListView in the Initialize method.

HandleSelectItem ensures that the value in SaveEdit is updated with the Caption for the selected item in Save dialogs (Kind is ldkSaveDesktop or ldkSavePDA). For other dialog types, the OK button in ButtonPanel is enabled or disabled depending on the selection of an item in ShellListView; the OK button is Enabled when the Selected parameter contains True.

Component generating the event notification. List item selected in the ShellListView control. Indicates that Item is selected when True. Event handler signalled when the selected item in ShellTreeView is changed.

HandleTreeViewSelectionChanged is a procedure used as the event handler for a change to the selected item in the ShellTreeView control. It is assigned to the OnSelectItem property for the ShellListView control in the Initialize method.

HandleTreeViewSelectionChanged is used in directory selection dialogs (Kind contains ldkSelectDirectory). HandleTreeViewSelectionChanged ensures that the OK button in ButtonPanel is enabled.

Component generating the event notification. Implements a Lazarus file open dialog. Member used to store the form instance for the Lazarus dialog. An empty implementation; dialogs do not require a WS implementation. Executes the file open dialog.

DoExecute is an overridden Boolean function used to execute the Lazarus File Open dialog. The return value is True when the ShowModal method in the dialog form is a value other than mrCancel. DoExecute also updates the FileName member to reflect the value returned on the dialog form.

TCustomForm.ShowModal
True when the file open dialog was not cancelled during execution. Performs actions needed to initialize the Lazarus dialog. Constructor for the class instance. Owner of the Lazarus dialog. Implements a Lazarus File Save dialog. Performs actions needed to initialize the Lazarus dialog. Implements a Lazarus directory selection dialog. Performs actions needed to initialize the Lazarus dialog.