L_ImportFileName = GETFILE('TABLESBF','Select the Gradestepsalaries table to import','Import',0,'Select File to Import From Downloaded Maryland Salary table')
I wanted to display some dbf files to the user so that the proper file to import can be selected. The name of the file to be imported will vary, so a Human has to do a selection. Also all file are displayed. not just the DBF's
In Visual FoxPro for Windows, cFileExtensions can contain a file description followed by a file extension or a list of file extensions separated with commas. The file description appears in the Files of Type list box. Separate the file description from the file extension or list of file extensions with a colon ). Separate multiple file descriptions and their file extensions with a semicolon (.
For example, if cFileExtensions is "Text:TXT" the file description "Text" appears in the Files of Type list box and all files with a .txt extension are displayed.
If cFileExtensions is "TablesBF; Files:TXT,BAK" the file descriptions "Tables" and "Files" appear in the Files of Type list box. When "Tables" is chosen from the Files of Type list box, all files with a .dbf extension are displayed. When "Files" is chosen from the Files of Type list box, all files with .txt and .bak extensions are displayed.
You can't prevent the "All Files:*.*" type to appear in the dialog. You can't prevent the user from typing a file name instead of choosing one. So you better check the return value anyway.
Additional to that: The dialog does not give much space for the Caption (second parameter), it's just for the label left of the selected file (or typed in file name). Also the title bar is not that long.
You might use a listbox with Rowsourcetype 7 or get only dbf files via ADIR and populate a listbox with rowsourcetype array instead. It might look less modern, but it will be under your control.
The second and fifth parameters to your GETFILE() are way too long. In VFP 7.0, there was a low-ish limit to the length of these strings. I don't remember what the limit was, but I would think you are exceeding it.
If you need to give your user a helping prompt to tell them which file to select, it would be better to do it the form that calls GETFILE().
Mike
__________________________________
Mike Lewis (Edinburgh, Scotland)
On a closer look, it's the second parameter that't too long. The limit is 10 characters.
Having said that, that won't cause the problem you are seeing. When I run your code, I see "Import" on the top-most button, which I think is what you were expecting.
Mike
__________________________________
Mike Lewis (Edinburgh, Scotland)
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.