www.icetips.com  Icetips Utilities Documentation 11/21/2010    

File Select Class: SelectFile

Previous  Top  Next  


Prototype: (*CString pFileName, Byte pMulti=False, Byte pSave=False, Byte pSuggestFileName=False),BYTE,PROC

 

       Overloaded:

 

       (*String pFileName, Byte pMulti=False, Byte pSave=False, Byte pSuggestFileName=False),BYTE,PROC

 

       Overloaded:

 

       (Long pFEQ, Byte pMulti=False, Byte pSave=False, Byte pSuggestFileName=False),BYTE,PROC

 

pFileNameString or CString variable that may contain existing information about file name
pFEQWindows control label (FEQ) that may contain existing information about file name
pMultiDetermines if the FileDialog opened in OPEN mode can allow selecting multiple files.  Not applicable in SAVE mode (pSave=True)
pSaveDetermines if the FileDialog is opened in OPEN or SAVE mode.  Default is OPEN.
pSuggestFileNameDetermines if FileDialog suggests the name of the file name passed in as pFileName.  If False, then only the path name will be used.

 

ReturnsReturns 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 SelectFile 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 ForceDefaultPath is True and DefaultPath contains a path, then the DefaultPath will be unconditionally used as a startup folder for the file selection.

If DefaultPath contains a path it will be used only if the pFileName or pFEQ is empty - i.e. does not contain file name.

If DefaultPath is empty and pFilename/pFEQ is also empty then Path() will be used as a startup folder.

SelectFile 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 file name is short or long.  By default the method will return the long file name.

 

Example:

 

FS  ITFileSelectClass

Code

FS.AddFileMask('INI File','*.ini',True)

FS.AddFileMask('All Files','*.*.')

FS.SetDefaultPath(INIMgr.Fetch('UpdateGetFromINI','FS:INIFilename'))

FS.SetForceDefaultPath()

FS.SetCaption('Select INI File') !! Set FileDialog caption

FS.SelectFile(?Loc:IniFileName)  !! Use control on window

!!Or

FS.SelectFile(Loc:IniFileName)   !! Use variable

INIMgr.Update('UpdateGetFromINI','FS:INIFilename',FS.GetFilePart(Loc:IniFileName,FNS_FullPath))

 

 

See also:

SelectFolder

SetCaption

AddFileMask

SetFileMask

SetForceDefaultpath

SetUseLongFileNames

SetUseShortFileNames

 



Direct link to this page: http://www.icetips.com/manuals/utilities/selectfile_fileselect.htm