Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How can you tell what forms are open?
Message
 
 
To
12/12/2000 10:05:31
Eric Sedlacek
TTSS Interactive Products
Rockville, Maryland, United States
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00452191
Message ID:
00452202
Views:
20
>I need a way to detect whether a given form is currently in use or even better to generate a list of open forms.
>

Cycle through the _Screen.Forms collection. You can check each object to make sure 1) that it is a form as toolbars also show up here and 2) if the object is the form you want.

>The reasons are two-fold. First, I want to restrict the user to one instance of a form and if he tries to open it again, I want the application to detect that fact and activate the existing instance rather than opening a second copy.

Using ther above, you could just call the Show method of the form to make it the active form instead of instantiating it again.

>
>Second, I want to be able to do a cleanup procedure when the application is closed. This procedure would close all open forms and notify the user is there is any trouble closing any of the forms.
>

There is a FAQ about how to loop through the collection and close all open forms. Check it out.

HTH.
Larry Miller
MCSD
LWMiller3@verizon.net

Accumulate learning by study, understand what you learn by questioning. -- Mingjiao
Previous
Reply
Map
View

Click here to load this message in the networking platform