Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to prevent run the Form twice?
Message
De
14/08/2013 08:58:27
 
 
À
14/08/2013 04:37:35
Yim Ming Sun Derek
Spacious Design Consultant
Hong Kong, Hong Kong
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows Server 2008
Network:
Windows 2008 Server
Database:
Visual FoxPro
Application:
Desktop
Divers
Thread ID:
01580450
Message ID:
01580454
Vues:
83
>I want to prevent user to run or open the FORM twice,
>how to check the specific form are opened or active ?

One way is to define a custom property on the _VFP level:
ADDPROPERTY(_VFP, "MyForm", .NULL.)
In the Init event of the form add the following:
IF PEMSTATUS(_VFP, "MyForm", 5)
    IF ISNULL(_VFP.MyForm)
       _VFP.MyForm = thisform
    ELSE
       _VFP.MyForm.Show()
       RETURN .F.
    ENDIF
ELSE
    ADDPROPERTY(_VFP, "MyForm", thisform)
ENDIF
Now in the Destroy event of the form add the following:
_VFP.MyForm = .NULL.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform