Hi folks,
VFP 9 SP1 on Windows 7 Ultimate.
I have a process to let the user choose a file. The user opens a .scx
form, presses a button to run some code that calls GETFILE(), and
when the user has done so, the path and file name are displayed on the form.
When I run this form in stand-alone mode, this works fine. GETFILE()
returns the path and file name to a string variable and I then
display the variable contents on the form.
When I run this form from within the full application, GETFILE()
displays the proper location and behaves perfectly fine, but when the
user chooses a file, it always returns an empty string.
I've tracked this in the debugger. In both cases, I emphasize, from
the point the user presses the button, the exact same code runs, at
each point generating the exact same results, until we get past
myvariable = GETFILE(parms)
line, at which point myvariable is empty in application mode, but
contains the full path and file name in stand-alone mode.
I am following the correct procedure to obtain an appropriate full
path, and in both cases the GETFILE() dialog displays the correct
location and is configured properly according to my parameters.
It simply won't return a value when run from inside the application.
I've read everything with "GETFILE" in the subject line in the
leafe.com archives. I can't find anything that addresses this situation.
My application does not use the _SCREEN (SCREEN = OFF in the
config.fpw file). Instead I have my own main window which is modeless
and "2 - as top level". Normally the import window, which is modeless
and (1 - in top level), is called from a modal form that is opened
from a menu item.
To eliminate the possibility that this modal/modeless business is
interfering, I put the button that opens the import form directly on
my main window, so that the only open windows are the modeless
top-level form and the modeless in-top-level import form before the
GETFILE() dialog is called. That's as close as I can get to running
the import form in stand-alone mode. This did not help.
The stand-alone mode of my framework's forms actually creates the
same environment that exists in the full application before opening
the form, so I can't see how not actually running the full
application can make a difference. I emphasize, again, in the
debugger, from the point the user presses that button every single
step runs exactly the same way, and returns the same results, up to
the GETFILE() dialog, in both stand-alone and full-application modes.
My code stores the location that I want GETFILE() to display to a
variable, mypath, so I do:
oldpath = FULLPATH(CURDIR())
CD (JUSTPATH(mypath))
myvariable = GETFILE(parms)
CD (JUSTPATH(oldpath))
Some people suggest using SET DEFAULT TO ..., so I also tried it like this:
oldpath = FULLPATH(CURDIR())
CD (JUSTPATH(mypath))
SET DEFAULT TO (mypath)
myvariable = GETFILE(parms)
CD (JUSTPATH(oldpath))
SET DEFAULT TO (oldpath)
That doesn't help either.
The default is for the file name and path to contain spaces, and this
works just fine in stand-alone mode. But I renamed the test file to
remove spaces, and put the file in C:\foo, so there are no spaces
anywhere in the path or file name, and it still doesn't work full
application mode. GETFILE() just returns an empty string.
I've also tried using PUTFILE() instead of GETFILE(), even though
it's less elegant for my purpose. PUTFILE() also works as I expect in
stand-alone mode but returns an empty string in full-application mode.
LOCFILE() is not an option because I can't mandate a file name for this.
This is driving me absolutely bonkers.
Possibly I could roll my own file dialog, but short of that, can
anyone provide any suggestions to explain why this is happening?
Any suggestions
_______________________________________________
Post Messages to: ProFox@leafe.com
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: http://leafe.com/archives/byMID/profox/44.CD.20123.7486F795@cdptpa-omsmta02
** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.
Author: Richard Kaye
Posted: 2017-07-31 12:42:57 Link
What kind of value does "parms" contain?
--
rk
-----Original Message-----
From: ProfoxTech [mailto:profoxtech-bounces@leafe.com] On Behalf Of Ken Dibble
Sent: Monday, July 31, 2017 1:27 PM
To: profoxtech@leafe.com
Subject: GETFILE() Returns Empty String in Some Cases
Hi folks,
VFP 9 SP1 on Windows 7 Ultimate.
I have a process to let the user choose a file. The user opens a .scx
form, presses a button to run some code that calls GETFILE(), and
when the user has done so, the path and file name are displayed on the form.
When I run this form in stand-alone mode, this works fine. GETFILE()
returns the path and file name to a string variable and I then
display the variable contents on the form.
When I run this form from within the full application, GETFILE()
displays the proper location and behaves perfectly fine, but when the
user chooses a file, it always returns an empty string.
I've tracked this in the debugger. In both cases, I emphasize, from
the point the user presses the button, the exact same code runs, at
each point generating the exact same results, until we get past
myvariable = GETFILE(parms)
line, at which point myvariable is empty in application mode, but
contains the full path and file name in stand-alone mode.
I am following the correct procedure to obtain an appropriate full
path, and in both cases the GETFILE() dialog displays the correct
location and is configured properly according to my parameters.
It simply won't return a value when run from inside the application.
I've read everything with "GETFILE" in the subject line in the
leafe.com archives. I can't find anything that addresses this situation.
My application does not use the _SCREEN (SCREEN = OFF in the
config.fpw file). Instead I have my own main window which is modeless
and "2 - as top level". Normally the import window, which is modeless
and (1 - in top level), is called from a modal form that is opened
from a menu item.
To eliminate the possibility that this modal/modeless business is
interfering, I put the button that opens the import form directly on
my main window, so that the only open windows are the modeless
top-level form and the modeless in-top-level import form before the
GETFILE() dialog is called. That's as close as I can get to running
the import form in stand-alone mode. This did not help.
The stand-alone mode of my framework's forms actually creates the
same environment that exists in the full application before opening
the form, so I can't see how not actually running the full
application can make a difference. I emphasize, again, in the
debugger, from the point the user presses that button every single
step runs exactly the same way, and returns the same results, up to
the GETFILE() dialog, in both stand-alone and full-application modes.
My code stores the location that I want GETFILE() to display to a
variable, mypath, so I do:
oldpath = FULLPATH(CURDIR())
CD (JUSTPATH(mypath))
myvariable = GETFILE(parms)
CD (JUSTPATH(oldpath))
Some people suggest using SET DEFAULT TO ..., so I also tried it like this:
oldpath = FULLPATH(CURDIR())
CD (JUSTPATH(mypath))
SET DEFAULT TO (mypath)
myvariable = GETFILE(parms)
CD (JUSTPATH(oldpath))
SET DEFAULT TO (oldpath)
That doesn't help either.
The default is for the file name and path to contain spaces, and this
works just fine in stand-alone mode. But I renamed the test file to
remove spaces, and put the file in C:\foo, so there are no spaces
anywhere in the path or file name, and it still doesn't work full
application mode. GETFILE() just returns an empty string.
I've also tried using PUTFILE() instead of GETFILE(), even though
it's less elegant for my purpose. PUTFILE() also works as I expect in
stand-alone mode but returns an empty string in full-application mode.
LOCFILE() is not an option because I can't mandate a file name for this.
This is driving me absolutely bonkers.
Possibly I could roll my own file dialog, but short of that, can
anyone provide any suggestions to explain why this is happening?
Any suggestions
[excessive quoting removed by server]
_______________________________________________
Post Messages to: ProFox@leafe.com
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: http://leafe.com/archives/byMID/profox/MWHPR10MB177459DCC17D3F5461CF49D1D2B20@MWHPR10MB1774.namprd10.prod.outlook.com
** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.
Author: Ken Dibble
Posted: 2017-07-31 13:03:24 Link
>What kind of value does "parms" contain?
The actual code is:
mypath = GETFILE("csv","Spreadsheet","Open",0,"Open Spreadsheet")
In both stand-alone and application mode, this displays the file
dialog correctly and pointing to the location that I expect.
However, I have also tried it as:
mypath = GETFILE("csv","File","Open",0,"Open Spreadsheet")
because someone suggested that the dialog can't display more than 10
characters to the left of the file name textbox. That didn't help.
I have also tried it simply as:
mypath = GETFILE()
Then I manually navigate to the file location. But that doesn't make
it work either.
I'm sorry, I got sidetracked and failed to properly end the original message.
I meant to conclude with:
Thanks in advance.
Ken Dibble
www.stic-cil.org
_______________________________________________
Post Messages to: ProFox@leafe.com
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: http://leafe.com/archives/byMID/profox/6F.7D.20123.CE07F795@cdptpa-omsmta02
** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.
Author: Fred Taylor
Posted: 2017-07-31 13:05:19 Link
Permissions issue on the folder or on the selected file?
Fred
On Mon, Jul 31, 2017 at 11:03 AM, Ken Dibble <krdibble@stny.rr.com> wrote:
>
> What kind of value does "parms" contain?
>>
>
> The actual code is:
>
> mypath = GETFILE("csv","Spreadsheet","Open",0,"Open Spreadsheet")
>
> In both stand-alone and application mode, this displays the file dialog
> correctly and pointing to the location that I expect.
>
> However, I have also tried it as:
>
> mypath = GETFILE("csv","File","Open",0,"Open Spreadsheet")
>
> because someone suggested that the dialog can't display more than 10
> characters to the left of the file name textbox. That didn't help.
>
> I have also tried it simply as:
>
> mypath = GETFILE()
>
> Then I manually navigate to the file location. But that doesn't make it
> work either.
>
> I'm sorry, I got sidetracked and failed to properly end the original
> message.
>
> I meant to conclude with:
>
> Thanks in advance.
>
> Ken Dibble
> www.stic-cil.org
>
>
[excessive quoting removed by server]
_______________________________________________
Post Messages to: ProFox@leafe.com
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: http://leafe.com/archives/byMID/profox/CAJCBksqDvhKjchU4Lvzzgr==sfGT-wFvpfzxYRdbbduPY+ZStA@mail.gmail.com
** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.
Author: Ken Dibble
Posted: 2017-07-31 13:19:58 Link
>Permissions issue on the folder or on the selected file?
I don't see how. In both cases it's me doing the test, on the same
computer, with the same folder and file, with the same domain
administrator account.
Ken Dibble
www.stic-cil.org
_______________________________________________
Post Messages to: ProFox@leafe.com
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: http://leafe.com/archives/byMID/profox/F8.C3.10880.EC47F795@cdptpa-omsmta01
** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.
Author: Philip Borkholder
Posted: 2017-07-31 14:23:06 Link
Are you declaring your variable as PRIVATE right before you run the
GETFILE() command?
PRIVATE mypath
mypath = GETFILE("csv","Spreadsheet","Open",0,"Open Spreadsheet")
Just curious if that is affecting it.
-Philip
On 7/31/2017 2:19 PM, Ken Dibble wrote:
>
>> Permissions issue on the folder or on the selected file?
>
> I don't see how. In both cases it's me doing the test, on the same
> computer, with the same folder and file, with the same domain
> administrator account.
>
> Ken Dibble
> www.stic-cil.org
>
[excessive quoting removed by server]
_______________________________________________
Post Messages to: ProFox@leafe.com
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: http://leafe.com/archives/byMID/profox/588017c0-9341-521a-b853-270a04a58e6e@netzero.net
** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.
Author: Ken Dibble
Posted: 2017-07-31 15:04:28 Link
>Are you declaring your variable as PRIVATE right before you run the
>GETFILE() command?
>
>PRIVATE mypath
>
>mypath = GETFILE("csv","Spreadsheet","Open",0,"Open Spreadsheet")
>
>Just curious if that is affecting it.
GAAAAAHHH!!! That's it!!
Not a PRIVATE declaration, the variable is declared LOCAL.
But in application mode there is a field in an open table with the
same name as the variable. I applied the "essential m-dot" to the
variable, and that fixed it.
Thanks very much Philip!!
Ken Dibble
www.stic-cil.org
_______________________________________________
Post Messages to: ProFox@leafe.com
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: http://leafe.com/archives/byMID/profox/B0.1B.21563.D4D8F795@cdptpa-omsmta03
** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.
Author: Philip Borkholder
Posted: 2017-07-31 15:09:47 Link
You are welcome Ken,
I had the same thing happen to me awhile back that had me stumped!
... sometimes it's the last thing we would consider being the problem. :-)
On 7/31/2017 4:04 PM, Ken Dibble wrote:
>
>> Are you declaring your variable as PRIVATE right before you run the
>> GETFILE() command?
>>
>> PRIVATE mypath
>>
>> mypath = GETFILE("csv","Spreadsheet","Open",0,"Open Spreadsheet")
>>
>> Just curious if that is affecting it.
>
> GAAAAAHHH!!! That's it!!
>
> Not a PRIVATE declaration, the variable is declared LOCAL.
>
> But in application mode there is a field in an open table with the
> same name as the variable. I applied the "essential m-dot" to the
> variable, and that fixed it.
>
> Thanks very much Philip!!
>
> Ken Dibble
> www.stic-cil.org
>
[excessive quoting removed by server]
_______________________________________________
Post Messages to: ProFox@leafe.com
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: http://leafe.com/archives/byMID/profox/5d7ce745-1a70-880b-f621-fb14da5301d9@netzero.net
** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.
Author: Brant E. Layton
Posted: 2017-07-31 15:44:44 Link
Hi All,
I think that mypath (or whatever variable you are expecting to contain the
returned path) needs to be initialized prior to the GETFILE call...
In the code below, make it look like:
private mypath
mypath = ''
mypath = GETFILE(...)
Perhaps your standalone application initializes mypath, and the application
doesn't?||
||
|Brant Layton|
|480.964.1316|
On 7/31/2017 12:24 PM, profoxtech-request@leafe.com wrote:
> ------------------------------
> Message: 10
> Date: Mon, 31 Jul 2017 15:23:06 -0400
> From: Philip Borkholder <plborker@netzero.net>
> To: profoxtech@leafe.com
> Subject: Re: GETFILE() Returns Empty String in Some Cases
> Message-ID: <588017c0-9341-521a-b853-270a04a58e6e@netzero.net>
> Content-Type: text/plain; charset="us-ascii"; Format="flowed"
>
> Are you declaring your variable as PRIVATE right before you run the
> GETFILE() command?
>
> PRIVATE mypath
>
> mypath = GETFILE("csv","Spreadsheet","Open",0,"Open Spreadsheet")
>
> Just curious if that is affecting it.
>
> -Philip
>
>
> On 7/31/2017 2:19 PM, Ken Dibble wrote:
>>> Permissions issue on the folder or on the selected file?
>> I don't see how. In both cases it's me doing the test, on the same
>> computer, with the same folder and file, with the same domain
>> administrator account.
>>
>> Ken Dibble
>> www.stic-cil.org
>>
[excessive quoting removed by server]
_______________________________________________
Post Messages to: ProFox@leafe.com
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: http://leafe.com/archives/byMID/profox/bf947607-10a5-a8c8-3e91-5c5687aaa9b7@futureone.com
** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.
Author: mbsoftwaresolutions@mbsoftwaresolutions.com
Posted: 2017-07-31 19:16:30 Link
On 2017-07-31 16:04, Ken Dibble wrote:
> GAAAAAHHH!!! That's it!!
>
> Not a PRIVATE declaration, the variable is declared LOCAL.
>
> But in application mode there is a field in an open table with the
> same name as the variable. I applied the "essential m-dot" to the
> variable, and that fixed it.
That "variable with same name as a field name" has screwed me in the
past more than once. That's why I like my "outdated" variable
declarations as pcFilename because I definitely don't conflict with
MyTable.cFilename. That works for me. Sorry for the purists who see
that as horrible. lol
_______________________________________________
Post Messages to: ProFox@leafe.com
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: http://leafe.com/archives/byMID/profox/f47313761596249aa48cc8929c7e7927@mbsoftwaresolutions.com
** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.