Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Set and Get appl obj property good practice
Message
De
31/07/2009 17:08:35
Dragan Nedeljkovich (En ligne)
Now officially retired
Zrenjanin, Serbia
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Versions des environnements
Visual FoxPro:
VFP 9 SP1
Divers
Thread ID:
01415630
Message ID:
01415725
Vues:
69
>Hi,
>
>I need to add about 10 (max) propertied to the application object. These properties will hold names of various meta tables of the application. Then, in many places of the application, this values will be retrieved and used. I know of two approaches
>
>1. Create a separate property for each one of the meta names (e.g. "MyMetaTbl1", "MyMetaTbl2", etc.). Then I would have to have as many Get methods in the application object to retrieve these values (e.g. method GetMyMetaTbl1, method GetMyMetaTbl2, etc.

Although this does seem as a straightforward case for the use of a collection (i.e. for once I'm voting with the majority :), you can still use simple properties. Just make sure they all exist:
for i=1 to n
   goapp.addproperty("mymetatbl"+alltrim(str(i)), "")
endfor
then later you can simply retrieve the value of the property even if you have the name of it in a variable:
lcMeta=getpem(goapp, lcWhichMeta)
...which is poor man's collection :).

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform