Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to detect if a form is already open?
Message
From
04/12/2005 15:01:14
 
 
To
04/12/2005 13:39:49
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows 2000 SP4
Network:
Novell 5.x
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01074732
Message ID:
01074763
Views:
17
>>Hello folks,
>>
>>I have a form called hugform (the name is "hugform" and the scx is "hugform.scx"), which can behave in various ways depending on the setting of a global variable. How can I tell whether an instance of this form is already open when a menu item is selected, so that I can ensure the existing instance is released?
>>
>>This doesn't work:
>>
>>
>>IF VARTYPE(HUGForm) <> "O"	&& ie object HUGform  exists
>>        RELEASE hugform         && close current instance
>>	DO FORM hugform.scx     && reopen new instance
>>ELSE
>>	DO FORM hugform.scx
>>endif
>>
>>
>>vartype(hugform) never seems to be able to "see" hugform.
>
>well. make a class from your form (Save as class in menu when you have the scx opened in editor). and then instantiate your form like"
>
>if type(goHugForm)=[O] and !isnull(goHugform)
>   goHugform.release()
>   gohugform=.null.
>endif
>gohugform=createobject([hugformclassname])
>gohugform.show()
>
>
>and of course, you have to declare public variable gohugform otherwise your form will be closed as soon as variable will
>go out of scope.

With this, AINSTANCE() is varname independent, and support array instances,
but the support of the dataenvironment is lost.
FOR k=1 to AINSTANCE(ai,[hugformclassname])
   RELEASE (ai[k])
ENDFOR
somevarORarray=createobject([hugformclassname])
somevarORarray.show()
Previous
Reply
Map
View

Click here to load this message in the networking platform