I.T. Discussion Community!
-Collapse +Expand
Paradox
Search Paradox Group:

Advanced
-Collapse +Expand Paradox To/From
To/FromCODEGuides
-Collapse +Expand Paradox Store
PRESTWOODSTORE

Prestwood eMagazine

November Edition
Subscribe now! It's Free!
Enter your email:

   ► MB LobbyCorel Paradox / ObjectPAL Coding BoardParadox Forms Topic   Print This     

Form opening a form and changing working directory

Form opening a form and changing working directory in Paradox Forms topic (part of our Corel Paradox / ObjectPAL Coding group).

Quick Search: opening   changing   working   directory   Form opening   Form opening form   changing working  
PeteD
London, ON CA
Rank: Cadet 3rd Year

Is this tough to do? Presently we are launching forms from one form but then the orginal form closes. Also we are manually having to set the working directory for each form.

Obviously we would like control to return to the menu after the launched form closes and the working directory set back to what it was before.

I'm using Paradox 8.00.174.

 Posted 7 months ago (Thread Starter)
Comment Quote
About PeteD -Collapse +Expand
Visit Profile
Approved member.
Member subscribes to this thread with a verified email.

Post ID #16636, 14 replies
Thread Started 4/25/2017 7:18:11 AM
View Counter=294
Last Reply Posted 5/16/2017 1:16:45 PM)
Location=London, ON CA 
Joined=16 months ago   MB Posts=11  
Moderator
Steven.G
Myrtle Beach, SC USA
Rank: Commander

the orginal form shouldn't close.. from a button on form1.. form2.open, form2.wait, form2.close.. now you're back on the button

and set your alias in the bde, or in the startup of your app.. you should never lose it, unless you change it

Steven Green
Senior Software Engineer
Paradox Support Specialist DOS/WIN

Prestwood IT Solutions
8421 Auburn Blvd, Suite 256, Citrus Heights, CA 95610
Office: 916-726-5675 | Fax: 916-726-5676 | http://www.prestwood.com
 Posted 7 months ago
Comment Quote
About Steven.G -Collapse +Expand
Visit Profile
Approved member.
Member subscribes to this thread with a verified email.

Post ID #16637 (Level 2) and Parent is 16636
Reply Posted 4/25/2017 8:56:15 AM
Location=Myrtle Beach, SC USA 
Joined=14 months ago   MB Posts=115  
PeteD
London, ON CA
Rank: Cadet 3rd Year

Or are you saying that forms can have their own working directories? As in form One can have it's own working directory, it launches form Two which can have its own independent working directory. I could live with that.

Pete

 Posted 7 months ago (Thread Starter)
Comment Quote
About PeteD -Collapse +Expand
Visit Profile
Approved member.
Member subscribes to this thread with a verified email.

Post ID #16639 (Level 1.1)  Reply to 16637 and Parent is 16636
Thread Started 4/25/2017 11:41:37 AM
Location=London, ON CA 
Joined=16 months ago   MB Posts=11  
PeteD
London, ON CA
Rank: Cadet 3rd Year

I think the issue my boss is mostly trying to fix is the closing of the form when the Working Directory is changed manually. The child form ( daughter form?) needs to function in a different directory. They are using the first form as a menu to launch several forms.

I found reference to this topic on page 177 of http://mclaveau.com/ress/Paradox/p9/Corel/Shared/REFCNTR/OPALR9FR.pdf but this is for version 9, possibly explaining why I'm having difficulty getting it to work when I'm using version 8. I can't seem to find a version 8 pdf.

I put code like it says in the MenuAction event like so:

method menuAction(var eventInfo MenuEvent)
const
kKeepFormOpen = UserMenu ; UserMenu is an ObjectPAL constant.
endConst ; Any nonzero value keeps the form open.
if eventInfo.isPreFilter() then
; This code executes for each object on the form:
if eventInfo.id() = MenuChangingWork then
eventInfo.setErrorCode(kKeepFormOpen)
endIf
else
; This code executes only for the form:
endIf
endMethod


On a pushbutton I tried this:
method pushButton(var eventInfo Event)
var
  siteForm Form
sWorkDir String
endVar
sWorkDir = workingDir() ;  starts with E:
msgInfo( "Response from trying to set the working directory", setWorkingDir("C:") )
msgInfo("State of WD", workingDir()) ; still E:
message(workingDir()) ; still E:
siteForm.open("ZZZUTIL.fsl") ; open another form
siteform.wait() ; wait for the user to close
setWorkingDir( sWorkDir) ;  set back to the original working directory ( didn't change anyway)
endMethod

It doesn't change the Working Directory even though the method returns True.

Pete

 Posted 7 months ago (Thread Starter)
Comment Quote
About PeteD -Collapse +Expand
Visit Profile
Approved member.
Member subscribes to this thread with a verified email.

Post ID #16638 (Level 3) and Parent is 16636
Reply Posted 4/25/2017 10:42:05 AM
Location=London, ON CA 
Joined=16 months ago   MB Posts=11  
Moderator
Steven.G
Myrtle Beach, SC USA
Rank: Commander

you don't want to change the working directory on the fly, like that.. yes, everything closes.. the most "normal" way to deal with this is to have an alias that represents each other location.. you use the alias instead of the actual path, so that the actual location can be changed, if necessary.. you stay where you are, you point to the other places and use them accordingly

Steven Green
Senior Software Engineer
Paradox Support Specialist DOS/WIN

Prestwood IT Solutions
8421 Auburn Blvd, Suite 256, Citrus Heights, CA 95610
Office: 916-726-5675 | Fax: 916-726-5676 | http://www.prestwood.com
 Posted 7 months ago
Comment Quote
About Steven.G -Collapse +Expand
Visit Profile
Approved member.
Member subscribes to this thread with a verified email.

Post ID #16640 (Level 4) and Parent is 16636
Reply Posted 4/25/2017 12:05:17 PM
Location=Myrtle Beach, SC USA 
Joined=14 months ago   MB Posts=115  
PeteD
London, ON CA
Rank: Cadet 3rd Year

Understood. But can you give me an example of how :Work: can be changed using ObjectPal? The only only documentation I have is from http://mclaveau.com/ress/Paradox/p9/Corel/Shared/REFCNTR/OPALR9FR.pdf and it doesn't show how to do that. I suppose that information might be in the original Paradox manuals but those have been long lost.

All I need is go from e: to something like c:\temp and back to e:. Again this is one form calling a second form where the second form need the c:\temp.

Appeciate the help. This has been a pain point for quite a while.

Pete

 Posted 7 months ago (Thread Starter)
Comment Quote
About PeteD -Collapse +Expand
Visit Profile
Approved member.
Member subscribes to this thread with a verified email.

Post ID #16641 (Level 5) and Parent is 16636
Reply Posted 4/26/2017 10:20:37 AM
Location=London, ON CA 
Joined=16 months ago   MB Posts=11  
Moderator
Steven.G
Myrtle Beach, SC USA
Rank: Commander

setAliasPath.. but again.. that's something you do at the beginning if it's to change the "root" of your app, not mid-stream..

Steven Green
Senior Software Engineer
Paradox Support Specialist DOS/WIN

Prestwood IT Solutions
8421 Auburn Blvd, Suite 256, Citrus Heights, CA 95610
Office: 916-726-5675 | Fax: 916-726-5676 | http://www.prestwood.com
 Posted 7 months ago
Comment Quote
About Steven.G -Collapse +Expand
Visit Profile
Approved member.
Member subscribes to this thread with a verified email.

Post ID #16642 (Level 6) and Parent is 16636
Reply Posted 4/26/2017 10:31:28 AM
Location=Myrtle Beach, SC USA 
Joined=14 months ago   MB Posts=115  
PeteD
London, ON CA
Rank: Cadet 3rd Year

The way Paradox has been used around here is essentially as independent forms. There's no app per se. Want to do a specific thing? Load a form designed to do that. This menu where a form loads another as jumping off point is about the only time forms interact and probably why this issue hasn't been dealt with before.

I did find the Alias manager under Tools and I was able to create an alias called Work2 that's set to "c:\temp". The Work alias is defined as "e:\".

The second ( menu launched) form needs to operate in c:\temp.

Sorry to be obtuse but can you be more explicit? I'm going nowhere fast.

Specifically, where would the alias(es) be set? If this is treading into the arena of paid services let me know.

Pete

226-792-3092

 Posted 7 months ago (Thread Starter)
Comment Quote
About PeteD -Collapse +Expand
Visit Profile
Approved member.
Member subscribes to this thread with a verified email.

Post ID #16643 (Level 7) and Parent is 16636
Reply Posted 4/26/2017 10:33:46 AM
Location=London, ON CA 
Joined=16 months ago   MB Posts=11  
Moderator
Steven.G
Myrtle Beach, SC USA
Rank: Commander

Help / ObjectPAL Reference / SetAliasPath, to learn.. and, in this case, you've already made it one of the permanent options, so learn how to refer to your objects with the alias name

":work2:myform.fsl"

Steven Green
Senior Software Engineer
Paradox Support Specialist DOS/WIN

Prestwood IT Solutions
8421 Auburn Blvd, Suite 256, Citrus Heights, CA 95610
Office: 916-726-5675 | Fax: 916-726-5676 | http://www.prestwood.com
 Posted 7 months ago
Comment Quote
About Steven.G -Collapse +Expand
Visit Profile
Approved member.
Member subscribes to this thread with a verified email.

Post ID #16644 (Level 8) and Parent is 16636
Reply Posted 4/26/2017 12:47:49 PM
Location=Myrtle Beach, SC USA 
Joined=14 months ago   MB Posts=115  
PeteD
London, ON CA
Rank: Cadet 3rd Year

Hi Steven,

I'm circling back to this issue after letting it stew for a bit. Trying again for an hour today I see 3 issues that I'm running into.

1) The directory I'm trying to operate the new form in is c:\dealer and the form is dealer.fsl. The menu form that launches the form that does the work I can call with f.open(":WORKC:RODEALER2.fsl"), with WORKC being defined by the Tools/Alias Manager as C:. However, this interface does not allow me to choose the actual directory I need, C:\DEALER, not C:. Trying to put in the subdirectory gives me an invalid path.

2) When that form is opened and I check the working directory I find it is still set to the original E:. It's like launching the form with:WORKC: had no effect other than specifying where to find the form.

3: When I read the documentation about SetAliasPath it sends me directly to GetAlias path, where is says: This method only applies to remote databases, and not to standard (Paradox or dBASE) databases.

Are you sure this is the way to get around Paradox closing everything when the working directory needs to be changed?

The reason for wanting to do all this is that form operates fairly independently from everything else in the system and the files need to be kept separate.

Pete

 Posted 6 months ago (Thread Starter)
Comment Quote
About PeteD -Collapse +Expand
Visit Profile
Approved member.
Member subscribes to this thread with a verified email.

Post ID #16661 (Level 9) and Parent is 16636
Reply Posted 5/16/2017 9:32:07 AM
Location=London, ON CA 
Joined=16 months ago   MB Posts=11  
Moderator
Steven.G
Myrtle Beach, SC USA
Rank: Commander

yes, you're telling paradox where to find the form.. no, you're not telling paradox to change to that location..

any alias that already exists, simply use it, like you did, to find something that isn't in the current working directory

any alias that you need to create, use AddAlias to create it within the session.. create any, as needed, first..

SetWorkingDir next.. if you change the working directory mid-stream, after this, you will lose all locks, and everything that is open will be closed.. you can't change that behavior

Steven Green
Senior Software Engineer
Paradox Support Specialist DOS/WIN

Prestwood IT Solutions
8421 Auburn Blvd, Suite 256, Citrus Heights, CA 95610
Office: 916-726-5675 | Fax: 916-726-5676 | http://www.prestwood.com
 Posted 6 months ago
Comment Quote
About Steven.G -Collapse +Expand
Visit Profile
Approved member.
Member subscribes to this thread with a verified email.

Post ID #16662 (Level 10) and Parent is 16636
Reply Posted 5/16/2017 10:08:57 AM
Location=Myrtle Beach, SC USA 
Joined=14 months ago   MB Posts=115  
PeteD
London, ON CA
Rank: Cadet 3rd Year

So you are saying the solution is to go through the code and queries in the form and make sure they all reference the alias with the different directory?

 Posted 6 months ago (Thread Starter)
Comment Quote
About PeteD -Collapse +Expand
Visit Profile
Approved member.
Member subscribes to this thread with a verified email.

Post ID #16663 (Level 11) and Parent is 16636
Reply Posted 5/16/2017 10:30:23 AM
Location=London, ON CA 
Joined=16 months ago   MB Posts=11  
Moderator
Steven.G
Myrtle Beach, SC USA
Rank: Commander

yes, that is one "ordinary" way to do it.. there are several ways to handle this.. your current way isn't one of them :-)

another possible option.. if the two folders have nothing to do with each other, you could have two batch files, with different paradox command lines, and two icons on the desktop

if it needs restricted access, there are plenty of ways to accomplish that, too

Steven Green
Senior Software Engineer
Paradox Support Specialist DOS/WIN

Prestwood IT Solutions
8421 Auburn Blvd, Suite 256, Citrus Heights, CA 95610
Office: 916-726-5675 | Fax: 916-726-5676 | http://www.prestwood.com
 Posted 6 months ago
Comment Quote
About Steven.G -Collapse +Expand
Visit Profile
Approved member.
Member subscribes to this thread with a verified email.

Post ID #16664 (Level 12) and Parent is 16636
Reply Posted 5/16/2017 10:57:35 AM
Location=Myrtle Beach, SC USA 
Joined=14 months ago   MB Posts=115  
PeteD
London, ON CA
Rank: Cadet 3rd Year

Do you think running another instance of Paradox via the Execute method might do the trick? I'm really trying hard to make this seamless for the user. The working directory would be set as a parameter for the second instance.

Start up options are described here: https://www.prestwoodboards.com/ASPSuite/KB/Document_View.asp?QID=100307

I did try this but got a " Could not initial BDE: Directory is busy" error.

So close.

Pete

 Posted 6 months ago (Thread Starter)
Comment Quote
About PeteD -Collapse +Expand
Visit Profile
Approved member.
Member subscribes to this thread with a verified email.

Post ID #16665 (Level 13) and Parent is 16636
Reply Posted 5/16/2017 11:38:00 AM
Location=London, ON CA 
Joined=16 months ago   MB Posts=11  
Most Recent Post
Moderator
Steven.G
Myrtle Beach, SC USA
Rank: Commander

no.. don't run paradox from within paradox

Steven Green
Senior Software Engineer
Paradox Support Specialist DOS/WIN

Prestwood IT Solutions
8421 Auburn Blvd, Suite 256, Citrus Heights, CA 95610
Office: 916-726-5675 | Fax: 916-726-5676 | http://www.prestwood.com
 Posted 6 months ago
Comment Quote
About Steven.G -Collapse +Expand
Visit Profile
Approved member.
Member subscribes to this thread with a verified email.

Post ID #16666 (Level 14) and Parent is 16636
Reply Posted 5/16/2017 1:14:37 PM
Location=Myrtle Beach, SC USA 
Joined=14 months ago   MB Posts=115  

Revive Thread!

Add a comment to revive this old thread and make this archived thread more useful.

Write a Comment...
Full Editor
...
Sign in...

If you are a member, Sign In. Or, you can Create a Free account now.


Anonymous Post (text-only, no HTML):

Enter your name and security key.

Your Name:
Security key = P1213A1
Enter key:
Icon: A Post    Thread    Idea    Important!    Cool    Sad    No    Yes    Includes a Link...   
Thread #16636 Counter
294
Since 4/25/2017
-
   Contact Us!
 
PrestwoodBoards.com was developed and is maintainted by me. Do you have a question or suggestion? Do you see a problem? Contact me now. My goal is to build an ad-free and spam-free source of I.T. information with many contributers (ok to promote your website/company in your bio). Yes, my company Prestwood IT Solutions is mentioned in my bio which shows with every post, but you can contribute and promote your pet project too!

1,617 People Online Now!!  
Sign In to see who's online now!  Not a member? Join now. It's free!
Show more stats...


©1995-2017 PrestwoodBoards  [Security & Privacy]
Professional IT Services: Coding | Websites | Computer Tech