Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Releasing a class variable
Message
De
04/03/2005 15:15:49
 
 
À
04/03/2005 14:44:42
Steven Dyke
Safran Seats USA
Texas, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Versions des environnements
Visual FoxPro:
VFP 6 SP5
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
Visual FoxPro
Divers
Thread ID:
00992861
Message ID:
00992873
Vues:
23
>I was instructed one time here on UT to avoid declaring variables as Public. I have started useing a custom class and it's properties to handle my global variables. However, I am havig a little difficulity now. I create a form class. I call it with CreateObject(). If I don't assign it a Public variable I can't control it globally. If I try and assingning it to one of my custome class variables so that it is global then try to Release myclass.myForm I get a message the "Must be a variable or array" meaasge.

3 choices (at least):

1. While a proliferation of globals can be bad practice, a single global is fairly reasonable. Some people handle an application-level object that way. Ex:
PUBLIC goApp
goApp = CREATEOBJECT("MyAppClass")
2. You can "attach" an object to _SCREEN. Ex:
ADDPROPERTY(_SCREEN, "oApp")
_SCREEN.oApp = CREATEOBJECT('MyAppClass')
? _Screen.oApp.whatever...
3. If your app has a top-level PRG, you can create the object as PRIVATE instead, and it will be seen thoughout, as all other code will be lower in the stack.

-- Randy
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform