Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to access a top level form from another ?
Message
From
17/04/2012 12:09:50
 
 
To
17/04/2012 09:26:21
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP2
Miscellaneous
Thread ID:
01541821
Message ID:
01541850
Views:
35
You need to have a form manager. But in absence of a full manager you can use simple properties:
ADDPROPERTY(_VFP,"FormOne",.NULL.)
ADDPROPERTY(_VFP,"FormTwo",.NULL.)
...

DO FORM TopLevelOne TO loForm
IF VARTYPE(loForm) = "O"
   _VFP.FormOne = loForm
ENDIF
...

DO FORM TopLevelTwo TO loForm
IF VARTYPE(loForm) = "O"
   _VFP.FormTwo = loForm
ENDIF
In the destroy event of the respective form set the reference property to null; i.e. for TopLevelTwo form add the following:
_VFP.FormTwo = .NULL.
Now you can reference either form via the appropriate _VFP variable. First always test for form instance:
IF !ISNULL(_VFP.FormOne) .AND. VARTYPE(_VFP.FormOne) = "O"
  *-*  Do something with the form
ENDIF
Previous
Reply
Map
View

Click here to load this message in the networking platform