Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Determining the active form.....
Message
From
16/07/1998 09:53:52
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
15/07/1998 13:25:45
Larry Santos
Local Data System
Philippines
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00117679
Message ID:
00118087
Views:
19
>Hi,
>
> This is my last question for this topic.
>
> Could you please tell me the exact code for:
>
>
> 1. I check for a form if they already active.
> 2. if the form is not active I use do form "myform"
> 3. if its already active I want to activate it instead of do form "myform"
>
>Thanks
Larry,
No one could give the "exact code" for that because there is no one way of doing it. I saw you came to a point with David, what he suggested is one of the ways (a good way). Now I rewind the situation and try to explain. First something to beware with .name approach :
A .name is not unique for _screen.forms (You can have multiple forms where name is "Form1"). To overcome it you could give them unique names and with this way David's code does what you want. Another way with or w/o a menu or toolbar, is to launch forms with names : do form myForm name myEntryForm linked. With this approach you could check if exists w/o looping forms collection. And another one (I think this one is complex for now) is to use application object and keep an array there.
OK now a simple approach and code to launch your form, check existence and activate if alive :
* Suppose your form uses "frmPosition" as name
if type("frmPosition") = "O" ;
  and !isnull(frmPosition) ;
  and frmPosition.baseclass = "Form"  && Form exists - show
  frmPosition.show()
else
  do form myForm name "frmPosition" linked && Launch form
endif
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