Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to check if another form is open
Message
De
11/01/2006 09:56:59
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
01085589
Message ID:
01085616
Vues:
19
>I want to be able to ascertain if another form is open, then transfer control to that form. It sounds easy but can't find the syntax for this.

Here is ONE solution.

Create a private, nevertheless global, variable for each form in your main prg:
* Notice that I use the g here for private variables. The g indicates that 
* these variables are visible/global to the entire application.
* The only place where private variables are allowed to start with a g is the 
* main program. This usage of g is different from what's proposed in the 
* vfp-documentation (where it's advised for public variables.)
private goMainWindow
goMainWindow = NULL
Whenever you create the form, use the NAME keyword.
do form MainWindow name goMainWindow
In the rest of your application, so also in the SKIPs of your menus, you can test for the datatype of the variable.
if vartype( m.goMainWindow, .f. ) = 'O'
   * form still exists
   m.goMainWindow.show()
else
   * form does not (or no longer) exist
endif
Groet,
Peter de Valença

Constructive frustration is the breeding ground of genius.
If there’s no willingness to moderate for the sake of good debate, then I have no willingness to debate at all.
Let's develop superb standards that will end the holy wars.
"There are three types of people: Alphas and Betas", said the beta decisively.
If you find this message rude or offensive or stupid, please take a step away from the keyboard and try to think calmly about an eventual a possible alternative explanation of my message.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform