SDL Dialogs

Declared types, variables and functions

TSDLODCallback = procedure(Sender: TSDLOpenDialog; const FileName: string)of object;
Procedure that will be called when user presses open or save button.
var AppPath: string;
This variable will contain application path. Do not change this.
function GetRelativePath(const Source, Dest: string): string;
This function returns relative path to Dest from Source. For example if Source='C:\Get\Relative\Path\Example.pas' and Dest='C:\Get\Relative\function\Help.pas', Result will be '..\function\Help.pas'.

TSDLOpenDialog

TSDLOpenDialog displays a file-selection dialog. It is a descendant of TSDLForm. Properties are:

property Filter: string read FFilter write SetFilter;
To create file masks, assign a value to the Filter property that consists of a description and a mask separated by a vertical bar (pipe) character. Do not include spaces around the vertical bar. For example, OpenDialog1.Filter := 'Text files (*.txt)|*.TXT'; Multiple filters should be separated by vertical bars. For example, OpenDialog1.Filter := 'Text files (*.txt)|*.TXT|Pascal files (*.pas)|*.PAS'; To include multiple masks in a single filter, separate the masks with semicolons. For example, OpenDialog1.Filter := 'Pascal files(*.PAS;*.DPK;*.DPR)'; If no value is assigned to Filter, the dialog displays all file types.
property MultiSelect: Boolean read GetMSel write SetMSel;
If True allows users to select more than one file in the dialog.
property FileName: string read GetFileName;
Indicates the name and directory path of the last file selected.
property Files: TStringList read FFiles;
Returns a list of the selected file names.
DirectoryLB: TSDLDirectoryListBox;
Pointer Directory listbox.
FileLB: TSDLFileListBox;
Pointer file listbox.
btOpen: TSDLButton;
Pointer to open button.
btCancel: TSDLButton;
pointer to cancel button.
Labels: array[0..2]of TSDLLabel;
Pointers to labels on open dialog.
FileEdit: TSDLEdit;
Pointer File edit box.
FilterCombo: TSDLComboBox;
Pointer to Filter combobox.
DriveCombo: TSDLDriveCombo;
Pointer to Drive combobox, only avaible on Windows.

There is one new method:

procedure Execute(Callback: TSDLODCallback);
Call this to execute-show open dialog. Specify Callback function that will be called if user presses open button.

TSDLSaveDialog

TSDLSaveDialog displays a "Save As" dialog for saving files. It is a descendant of TSDLOpenDialog, but btOpen is now Save Button. There is one new property:

property DefaultExt: string read FDefaultExt write FDefaultExt;
Specifies a default file extension.