|
Previous Top Next |
Prototype: | (*? pDirName),Long,Proc |
Overloaded:
(Long pFEQ),Long,Proc
pDirName | Variable reference containing the variable that contains and should receive the newly selected folder name |
pFEQ | Control reference (FEQ) pointing to a control on a window that contains and should receive the newly selected folder name |
Returns | Returns the value returned by the call to FileDialog: "FILEDIALOG returns zero (0) if the user pressed the Cancel button, or one (1) if the user pressed the Ok button on the file choice dialog." |
This method puts it all together and calls FileDialog with the settings that have been set up. This method comes in two flavors. One where you pass it a variable that receives the new selected folder name. The variable can be any appropriate datatype, such as a string or cstring. The other uses a control label (FEQ) that it will set to the new selected folder name.
If the control or variable contains information (existing filename information) the SelectDir will check if the information passed in is a folder name or file name and use the folder name part of it to construct the default folder where it will open to.
If no path information passed in and the DefaultPath property is set then it will be used unconditionally as the startup folder.
If no path information is passed in and the DefaultPath property is not set then the current path (Path()) will be used.
SelectDir does not use any calls to SetPath() so it never changes the currently used path!
The UseShortFileNames property is used to determine if the returned folder name is short or long. By default the method will return the long folder name.
In the example below the default path is retrieved and stored using the INI Manager. This way you can make the SelectDir default to whatever directory was used last time.
Example:
FS ITFileSelectClass
Code
FS.SetDefaultPath(INIMgr.Fetch('UpdateGetFromINI','FS:INIFilename'))
FS.SetUseShortNames
FS.SelectDir(?Loc:IniFileName) !! Use the FEQ from an entry field
!! Or:
FS.SelectDir(Loc:IniFileName) !! Use a variable
INIMgr.Update('UpdateGetFromINI','FS:INIFilename',FS.GetFilePart(Loc:IniFileName,FNS_FullPath))
See also: