TOpenSaveDialog( unit KOL.pas ) TObj _TObj
TOpenSaveDialog = object( TObj )
Object to show standard Open/Save dialog. Initially provided for XCL by Carlo Kok.
type TOpenSaveDialog = object( TObj )
Object to show standard Open/Save dialog. Initially provided for XCL by Carlo Kok.
type TOpenSaveOption = ( OSCreatePrompt, OSExtensionDiffent, OSFileMustExist, OSHideReadonly, OSNoChangedir, OSNoReferenceLinks, OSAllowMultiSelect, OSNoNetworkButton, OSNoReadonlyReturn, OSOverwritePrompt, OSPathMustExist, OSReadonly, OSNoValidate, OSTemplate, OSHook);
type TOpenSaveOptions = set of TOpenSaveOption;
Options available for TOpenSaveDialog.
Constructor
function NewOpenSaveDialog( const Title, StrtDir: KOLString; Options: TOpenSaveOptions ): POpenSaveDialog;
Creates object, which can be used (several times) to open file(s) selecting dialog.
TOpenSaveDialog properties
property Filename: KOLString;
Filename is separated by #13 when multiselect is true and the first file, is the path of the files selected.
C:\Projects
Test1.Dpr
Test2.Dpr
If only one file is selected, it is provided as (e.g.) C:\Projects\Test1.dpr
For case when OSAllowMultiselect option used, after each call initial value for a Filename containing several files prevents system from opening the dialog. To fix this, assign another initial value to Filename property in your code, when you use multiselect.
property InitialDir: KOLString;
Initial directory path. If not set, current directory (usually directory when program is started) is used.
property Filter: KOLString;
A list of pairs of filter names and filter masks, separated with '¦'. If a mask contains more than one mask, it should be separated with ';'. E.g.:
'All files|*.*|Text files|*.txt;*.1st;*.diz'
property FilterIndex: Integer;
Index of default filter mask (0 by default, which means "first").
property OpenDialog: Boolean;
True, if "Open" dialog. False, if "Save" dialog. True is default.
property Title: KOLString;
Title for dialog.
property Options: TOpenSaveOptions;
Options.
property DefExtension: KOLString;
Default extention. Set it to desired extension without leading period, e.g. 'txt', but not '.txt'.
property WndOwner: THandle;
Owner window handle. If not assigned, Applet.Handle is used (whenever possible). Assign it, if your application has stay-on-top forms, and a separate Applet object is used.
property OpenReadOnly: Boolean;
TRUE after Execute, if Read Only check box was checked by the user. Options are not affected anyway.
Properties, inherited from TObj
Property TemplateName: KOLString;
Do not forget to add OpenSaveDialog_Extended to project options conditionals!
Property HookProc: Pointer;
Property NoPlaceBar: Boolean;
TRUE, if place bar is disabled in the new style dialogs (if the symbol OpenSaveDialog_Extended is not added in project options, place bar is always enabled in Windows 2000 and higher).
TOpenSaveDialog methods
destructor
Function Execute: Boolean;
Call it after creating to perform selecting of file by user.