Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Classes - Best Practices?
Message
De
14/03/2003 07:13:19
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Divers
Thread ID:
00763778
Message ID:
00765771
Vues:
16
Hi John,

>Is there a way in a visual class to use #DEFINE to create a constant that is available to any method in the class? For that matter, can you create a non-public variable that is available to any method in the class? It doesn't appear that it's possible from what I've tried so far. A constant declared in the Init event does not appear to be available to a user-defined method. And variables only seem to be available if created as PUBLICs.
>
>With the .PRG approach, I can create constants at the beginning of a class definition and #UNDEFINE them afterwards and have, in effect, a class level constant. I don't think I can do the same with variables as any variables declared at the class level become properties.
>
>Any thoughts?

What you can do is create a .H file which is merely a text file which contains a whole bunch of #DEFINE statements. Then, while on the Class Designer, go to the Class menu and choose Include... you may now include the .H file you did and voila! those constants are available to all the methods in that class!

HTH,

Dennis
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform