Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Complex objects modeling
Message
From
26/10/2018 10:05:36
 
 
To
25/10/2018 23:33:01
General information
Forum:
Visual FoxPro
Category:
Visual FoxPro and .NET
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows 10
Miscellaneous
Thread ID:
01662805
Message ID:
01662820
Views:
67
One thought, Marco, I have looked at _(), and see that if you were to mistype a property it would auto-add that mistyped property.

I see you could add a pass-in callback function to your initial existing object setup to allow it to catch unknown properties and specify if it should be returned as an error or added as a new property.

I modify the code below to show the general addition format, an extra parameter on _(), and two new properties added to the empy oMyPc class (added in _(), not shown here):
public oMyPc && check later on your debugger

oMyPc = Createobject('empty')

* _( oMyPc ) will auto-add a .lAdding property, along with a reference to the character string "verify_add" for a callback to issue when something not previously known is found
With _( oMyPc, "verify_add" )  && simply pass object you want to modify, any referenced property will be added to passed object if does not exist:

	.madeBy = 'Marco Plaza, 2018 - nfTools'
	.manufacturer = 'custom'
	.basePrice = 699
	.caseType  = 'ATX'
	.modelName = 'Ryzen Performance Plus'

	...

	* Indicate we're updating now, not adding
	.lAdding = false
	.modelNmae = .modelName + ' Plus'   && Misspelled here,so it should be a legitimate error

Endwith


* Called to see if it should be added or not
FUNCTION verify_add
LPARAMETERS toObj, tcPropName

	* Are we in adding mode?
	RETURN toObj.lAdding
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform