Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How can I check for existence of a form already load/run
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00357153
Message ID:
00357162
Views:
14
>I have a bunch of forms in my app. The main form normally loads and never gets released until I exit the app. But when I enter the app from the Administrator's form, the main form is not always loaded unless you have been to the form from a command button. So what's happening is I skip that command button go to another form instead and try to go to the main form from there, it was never loaded so it takes me to a blank window.
>
>Is there a way I can check to see if the main form was ever loaded prior to trying to go to it with my DO FORM command? If it was not loaded, I will load it with DO FORM main.scx otherwise, if it is aleady loaded I don't want to load it again. I will skip loading it.
>
>Thanks for the help. Never had to do this before. Should be interesting.

Steve, you can go through _screen.forms collection and get the name from there. For example:

FOR EACH loForm IN _screen.forms
IF loForm.Name = "myForm"
WAIT WINDOW "my form is already running"
EXIT
ENDIF
ENDFOR

But most of frameworks have a special Form manager class (or it may be a part of application object) which has an array of forms already running.
Nick Neklioudov
Universal Thread Consultant
3 times Microsoft MVP - Visual FoxPro

"I have not failed. I've just found 10,000 ways that don't work." - Thomas Edison
Previous
Reply
Map
View

Click here to load this message in the networking platform