Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How Do I Prevent Multiple Instances Of The Same Form
Message
From
20/08/1999 05:04:46
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00255528
Message ID:
00255735
Views:
14
>I have a VLS (Very Large Scale)database application, which allows moving rapidly from one form to another and back.
>I have noticed that in several cases, that a user is able to get multiple instances of the same form running, which may be hidden behind the main screen.
>
>How can I test for whether or not a form is already running, and just activate it, instead of DOing another instance?
Doug,
There are many ways to do it. Since you're only dealing with its existence or not I think this one is simple (and assuming you're using Do form instead of createobject) :
LPARAMETERS tcSCXName
IF type(tcSCXName) = "O" ;
    and !isnull(eval(tcSCXName)) ;
    and eval(tcSCXName+".baseclass") = "Form"
  &tcSCXName..show()
ELSE
  DO form (tcSCXName)
ENDIF
This works because the first instance of a form always referencable by its SCXName.
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Reply
Map
View

Click here to load this message in the networking platform