Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Descriptive File Types with PUTFILE()
Message
 
 
À
28/10/2001 12:07:20
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00574248
Message ID:
00574258
Vues:
42
This message has been marked as the solution to the initial question of the thread.
You can use new _comdlg class from VFP 7 FFC
oCD = Newobject("_comdlg", "_system")

oCD.AddFilter("Excel files (*.xls)", "*.xls")

*  Dialog properties.
oCD.cTitlebarText = "Specify file name for excle table"

*  Initial defaults.
oCD.cFileName = "test.xls"
oCD.cInitialDirectory = "h:\temp"
oCD.cDefaultExtension = "XLS"
oCD.lSaveDialog  = .t.

*  Display the dialog and get results.
? oCD.showdialog()


? "Files were chosen from:", oCD.cFilePath
? "FileName property:", oCD.cFileName
? "FileTitle property:", oCD.cFileTitle
? "FileCount property:", oCD.nFileCount
? "Custom filter that the user created:" , oCD.cCustomFilter
? "Filter index (which of our filters the user selected):", oCD.nFilterIndex

oCD.clearfilters()
Be advises that there's a bug in the class. Here's a fix
	IF THIS.lAllowMultiSelect AND nFileNameOffset > 1 AND SUBSTR(lcFileName, nFileNameOffset, 1) = CHR(0)
...
		<b>THIS.cFileName = LEFT(lcFileName, AT(CHR(0), lcFileName) - 1)</b>
	ELSE
...
		<b>THIS.cFileName = lcFileName</b>
	ENDIF
			
	<b>*THIS.cFileName = LEFT(lcFileName, AT(CHR(0), lcFileName) - 1)</b>
>When using PUTFILE(), I know it's possible to submit a list of extensions as a parameter, which show up as the file types.
>
>However, there does not appear to be a way to provide a description of what the extension means. VFP has built-in recognition for PRG, DBF, and other extensions, and displays "Program (*.PRG)" instead of just "PRG", for example.
>
>Unless there is a way to provide the descriptions with the extensions, is there a way to otherwise inform VFP what the descriptions are or use some other function instead of PUTFILE() ?
>
>In this way, a file type of "XLS" could be shown instead as "Excel".
>
>It is possible to specify it for GETFILE(), e.q.
>
> GETFILE('Excel:XLS')
>
>but this does not work for PUTFILE()
--sb--
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform