Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Main Prg file
Message
From
18/02/2016 09:00:04
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
 
 
To
17/02/2016 18:49:31
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Title:
Environment versions
Visual FoxPro:
VFP 7
OS:
Windows 7
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01631633
Message ID:
01631666
Views:
59
>>I'm confused - why not just use the SET PROCEDURE command? Like SET PROCEDURE TO MAIN.PRG ???
>
>a SET PROCEDURE sets up the references to any UDFs and procedures defined in MAIN, but doesn't create and assign the PUBLICs, nor does it handle anything like SET DEFAULTs or SET PATHs or other environmental settings. Yes, you could do a DO MAIN -- but that could also trigger stuff like changes to the system menu as well -- which is likely to be a pain if you're trying to use the development environment.. That's why I'm suggesting a "stub" program that sets up the environment -- which could include any publics that may be assumed to be declared in the form code. Yes, it's bad form to have that in the form code, but if you're starting out with form code that was already made, you can't do much about it without having to recode (which is likely to make the update more involved).

Or just move that stuff into a procedure inside main, and have the startup code run that (do setup in main.prg) instead of going linearly through all that.

And in the .load() of a form, on the first line,
if vartype(someGlobalVar)="U"
   do setup in main.prg
endif
Note that I said .load(), because .init() may be too late - some tables may not be found (as it seems to be happening) etc etc.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Previous
Reply
Map
View

Click here to load this message in the networking platform