Solved

Locfile() on top - Foxpro?

Posted on 2014-09-12
6
292 Views
Last Modified: 2014-10-03
I have a PRG which runs a top-level form. In the PRG I want to use locfile() to create a reference to a file which will be used in the form. How can I force the locfile() dialog to come up on top?

The application is a COM server (EXE), which is run from a C++ application. When I run it the locfile comes up hidden behind the Calling EXE.
0
Comment
Question by:krhag28
  • 3
  • 3
6 Comments
 
LVL 29

Expert Comment

by:Olaf Doschke
ID: 40320828
LOCFILE() is not what you should use, if you want a file dialog. LOCFILE() only falls back to using a dialog as last resort, if it doesn't find a file. Use GETFILE().

Bye, Olaf.
0
 

Author Comment

by:krhag28
ID: 40320850
GETFILE() has no default folder, but LOCFILE() has, so that's why I prefer LOCFILE(). However the problem with not being on top is the same.
0
 
LVL 29

Expert Comment

by:Olaf Doschke
ID: 40320856
Interesting,
a) CD into the desired default folder and GETFILE starts there.
b) GETFILE uses the system open file dialog, which should appear on top always.

You might set the alwaysontop=.f. when your form is started and right before you start LOCFILE or GETFILE.

Bye, Olaf.
0
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 

Author Comment

by:krhag28
ID: 40321248
a) I prefer not to change the default folder, but of course it is possible...
b) Unfortunately it does not appear on top

No form is started - I run the file open dialog from the main PRG.

My conclusion is that I need to involve a form to force it on top.
0
 
LVL 29

Accepted Solution

by:
Olaf Doschke earned 500 total points
ID: 40321645
>My conclusion is that I need to involve a form to force it on top

You initially said "I have a PRG which runs a top-level form". You also said "In the PRG I want to use locfile() to create a reference to a file which will be used in the form"

You didn't made very clear what you do when, but GETFILE and LOCFILE should display their dialog on top no matter if a VFP form already is shown or not.

You also said "The application is a COM server (EXE)", then you'll have an olepublic class to start it from C++. How about showing your code?

Here's what I tested:
Define Class myclass as custom olepublic
   somefile = ""

   Procedure init()   
      somefile = LocFile("C:\temp\test.txt")
      somefile = GetFile("txt")
   EndProc 
EndDefine

Open in new window

Compiled into myapp.exe and registered by compilation.

Started from Word via:
Dim o As Object
   Set o = CreateObject("myapp.myclass")

Open in new window


This displays both dialogs in front if the word document. I'd say you have to figure out where Windows stores defaults/last usage and positioning of the system file open dialog, this is at least not a general misbehaviour of VFP.

Bye, Olaf.
0
 

Author Closing Comment

by:krhag28
ID: 40360942
The solution is correct, but does not solve my problem. I had to move the opendialog from the prg to a form, then it works.
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
parse convert xml feed to text (python) 2 83
Windows Service to Receive TCP Packets 4 147
"Black Box" Testing of Control System Software 2 52
Cygwin - GNU GPL License 1 24
This article will show, step by step, how to integrate R code into a R Sweave document
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question