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 10:48:29
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 9 SP1
Miscellaneous
Thread ID:
01415630
Message ID:
01418153
Views:
66
What about simpler version below.
DEFINE CLASS ParameterX AS Custom
	FUNCTION This_Access(tcMember)
		IF NOT PEMSTATUS(This, tcMember, 5)
			This.ADDPROPERTY(tcMember, NULL)
		ENDIF	
		RETURN This
	ENDFUNC
ENDDEFINE
>I use this class for similar approaches. The class wil automatically create the properties for you.
>
>_screen.AddProperty('memo',CreateObject('parameterX'))
>_screen.memo.xx=10
>_screen.memo.yy='Some text'
>?_screen.memo.yy
>?_screen.memo.xx
>
>define class ParameterX as custom
>  function This_Access(tcMember)
>    if type('This.' + tcMember) = 'U'
>      This.AddProperty(tcMember)
>    endif
>    return This
>  EndFunc 
>  function AddVar(tcMember,tcData)
>      AddProperty(this,tcMember,tcData)
>    return This
>  endfunc
>EndDefine
>
>
>
>
>
>>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.
>>
>>2. Create an array property for the application object with number of elements corresponding to the number of meta table names I need to store. Then I can have just one method of getting the values (e.g. GetMetaTableName(nEle))
>>
>>I am leaning toward the approach 2 but want to be sure that I am not going to miss something
>>
>>What is a better practices?
--sb--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform