PFF Utilities Service
Contributed by Bruce Armstrong
The PB native GetFileOpenName function has several limitations, primarily:
The of_getopenfilename function of PFFUtils supports all of these, as well as many of the other features of the underlying GetOpenFileName function in the Windows API.How
To use the of_getopenfilename function, the developer must:
// Declare an instance of the service. It is autoinstatiating:
// Register the parent window from which it is being called.
// (Certain features of the GetOpenFileName function require
// a reference to the parent window of the dialog).
lnv_pffutils.of_register ( this )
// Declare an instance of the n_cst_openfilename_attrib object,
// and populate those attributes that the developer want to change
// from their default settings:
ln_ofn.is_filter = 'All Files (*.*),*.*,Zip Files (*.zip),*.zip'
ln_ofn.is_initialdir = 'c:\'
ln_ofn.is_title = 'Attach the following file(s)'
ln_ofn.ib_allowmultiselect = TRUE
ln_ofn.ib_filemustexist = TRUE
ln_ofn.ib_pathmustexist = TRUE
ln_ofn.is_OpenText = 'Attach'
// Call the function, passing it a string array to hold the results
li_rc = lnv_pffutils.of_getopenfilename ( ln_ofn, ls_filename )
If there is an error, or if the user cancels or closes the dialog, the return code is -1. Otherwise, the return code indicates the number of filenames the user selected. If ib_allowmultiselect is set to FALSE, the developer must still pass a string array, however, the function would only populate the first item (and return 1 upon success).
The supported attributes and their default values are as follows. With the exception of is_OpenText, the developer should consult documentation for the OpenFileName structure and the GetOpenFileName function in the Windows API for more information.
Attribute Default Description is_filter 'All Files (*.*),*.*' The filter (same as for PB GetFileOpenName function) ii_filterindex 1 The element of the filter that should be shown by default is_initialfile '' The name of the file to show by default is_initialdir '' The directory to start the dialog in by default is_title 'Open' The title of the dialog (same as for PB GetFileOpenName) is_defext '' The file extension to use (same as for PB GetFileOpenName) is_OpenText 'Open' The text to use in place of 'Open' for the dialog Open button ib_allowmultiselect FALSE Whether multi-selection is allowed ib_createprompt FALSE Whether the user is prompted to create the file if it doesn't exist ib_explorer TRUE Whether the Explorer or old-style dialog box is used ib_filemustexist TRUE Whether the dialog verifies that the filename actually exists ib_hidereadonly TRUE Whether 'Read-Only' checkbox on the dialog is hidden ib_longnames TRUE Whether long names are supported (only for old-style dialogs) ib_nochangedir FALSE Whether the directory is reset if the user changes it while searching ib_nodereferencelinks TRUE Whether the filename is resolved if the user selects a shortcut ib_nolongnames FALSE Whether short filenames are used in the dialog (old-style only) ib_nonetworkbutton FALSE Whether the Network button is enabled ib_noreadonlyreturn FALSE Whether the user is required to select non-read-only files ib_notestfilecreate FALSE Whether the file is created before the dialog closes ib_pathmustexist TRUE Whether the dialog validates that directory path to the file ib_readonly FALSE Whether the 'Read-Only' checkbox is initially checked ib_shareaware TRUE Whether network sharing errors should be ignored ib_showhelp FALSE Whether the Help button should appear on the dialog
|Download the||About the extension contributor|
|10/03/1998||Initial Revision||Ver. 1.00|
Interested in contributing material to this web site? Send an email to firstname.lastname@example.org, but don't forget to check the contribution guidelines first.
For information or suggestions about this web site please contact email@example.com
sponsored by Dynamic Technology Group.
The information on this site is provided for advice only and not to be considered a contract or a liability against Dynamic Technology Group.