Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Getfile and putfile API-based replacement (non-ocx)?
Message
From
22/02/2006 09:37:19
 
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Environment versions
Visual FoxPro:
VFP 9
Miscellaneous
Thread ID:
01097713
Message ID:
01098096
Views:
22
>It's a bug in a sample form. It sets filter incorrectly.
>Check also Re: Descriptive File Types with PUTFILE() Thread #574248

Thank a million! The code below looks like a neat replacement for the usual getfile (or MS-OCX):

SET PATH TO "c:\program files\microsoft visual foxpro 9\ffc\" ADDITIVE

oCD = Newobject("_comdlg", "_system")

oCD.clearfilters(.T.)
oCD.AddFilter("Excel files (*.xls)", "*.xls")
oCD.AddFilter("Survey files (*.hrq)", "*.hrq")

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

* Initial defaults.
oCD.cFileName = "test.hrq"
oCD.cInitialDirectory = "c:\hroffice"
oCD.cDefaultExtension = "HRQ"
oCD.lSaveDialog = .t.

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

It looks like a very basic error in the _system.AddFilter method (when the "list of Filters" was forced to cleared to nil...) prevented my code to work fine.

Here is the correction (for what it's worth):

IF EMPTY(THIS.aFilterList)
nNewRow = 1
ELSE
nNewRow = ALEN(THIS.aFilterList,1) + 1
ENDIF
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform