Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Set and Get appl obj property good practice
Message
 
 
To
31/07/2009 17:08:35
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 9 SP1
Miscellaneous
Thread ID:
01415630
Message ID:
01415755
Views:
64
>>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 :).

As they say, there are many ways to skin a cat <g>. Thank you for your input.
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Previous
Reply
Map
View

Click here to load this message in the networking platform