Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Multiple Instance of Form
Message
De
14/09/2005 10:06:59
 
 
À
14/09/2005 08:47:21
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Versions des environnements
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Divers
Thread ID:
01049362
Message ID:
01049417
Vues:
13
>Is it possible to check to see if a form is already running so that it does not end up running twice? Thanks.

Here is what I do. Form references are one of the few things that I want to be global (by declaring them private in the main program). I create a variable for EACH possible form. The variable is initialized to NULL. When the form is instantiated, the variable will hold the reference to the form, so its type will be 'object'.

This implies that you can test the variable whenever you want to know whether or not the form already exists. For example, they can then be used in the SKIP FOR clauses of the menus. It goes like this:

Main program:
private goMainForm, goSecondForm
store NULL to goMainForm, goSecondForm
Declare the main form:
do form mainform name goMainForm
At times the second form is declared:
do form secondform name goSecondForm
Perhaps there is a check in an item of the main form's menu:
SKIP FOR not isnull( goSecondForm )
Get the picture?
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