Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Alternative to public variables
Message
De
12/06/2002 12:44:58
Irv Adams
MSC Managed Care, Inc.
Floride, États-Unis
 
 
À
12/06/2002 11:46:53
Sammy Derban
Ghana Telecom
Accra, Ghana
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00667071
Message ID:
00667489
Vues:
31
Sammy:

Here are some specifics:

1) create a Custom class in the Designer. In the INIT event of this class, do the standard things you often do at startup like:
SET ESCAPE OFF
SET CENTURY ON
SET CENTURY TO 19 ROLLOVER 80
SET CONSOLE ON
SET DELETED ON
SET EXACT OFF
SET EXCLUSIVE OFF
SET MULTILOCKS ON
etc...

2) Create other methods desired, like oGlobal.MyError(), for instance, where you store code to execute ON ERROR...I have several Methods, like one to detect if the EXE is already running and not allow another ( oGlobal.RunOnlyOne() )...

3) In your Main.prg, point to the Class where the Custom oGlobal object lives and then Instantiate:
Set Classlib to <FullPathName> Additive
oGlobal = CreateObject("GlobalApp")
If oGlobal.RunOnlyOne("MultiUsertest.EXE")
	DO FORM MultiUsertest
	READ EVENTS
Endif
Release oGloBal
Now oGlobal completely 'Wraps' the application and is universal to all your Forms, etc. and can be used to store Global Properties throughout, like variables and LINKED Form references, etc...and best of all it can be used for any app you create from now on...

HTH,

-Irv.


>Thanks Irv for the code but i may need some clarification (steps) on the custom global variable creation. I get the error message 'class definition not found.'
>Is the customer global variable class a form,control or what?????
>I tried to create the class but then the Add property also generates an error.
>
>Are these commands mandatory for the variable/property to become global.
>DO FORM TASplashScrn NAME oGlobal.SplashScrn LINKED
>DO FORM TARatesCalc NAME oGlobal.MainForm LINKED
>
>TIA
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform