Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VFP 7 Getfile() not working as expected

Status
Not open for further replies.

psperry2

Programmer
Nov 7, 2007
141
US
I am testing new code in VFP 7.0 and when I try to set the OpenButtoncaption and the TitleBarCaption both display as "Do".

How can I get this to work correctly?
 
Here is the line of code

L_ImportFileName = GETFILE('TABLES:DBF','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
 
is the semi colon in 'TABLES:DBF' correct or a typo for this question. it should be a period not :

David W. Grewe Dave
 
According to the VFP 7.0 Language Reference:

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 "Tables:DBF; 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.

Bye, Olaf.
 
Psperry,

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)

My Visual FoxPro site: www.ml-consult.co.uk
 
Psperry,

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)

My Visual FoxPro site: www.ml-consult.co.uk
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top