Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Looking for replacement for .AddProperty()
Message
From
24/10/2001 18:49:31
Charles Richard
Nvo Management Systems
Boisbriand, Quebec, Canada
 
 
To
24/10/2001 17:56:26
Keith Payne
Technical Marketing Solutions
Florida, United States
General information
Forum:
Visual FoxPro
Category:
Object Oriented Programming
Miscellaneous
Thread ID:
00572931
Message ID:
00572952
Views:
29
Alternatively, you could create your objects differently I.E.:
*Use a master object for the additional properties (and methods too)
LOCAL loMaster, loData
CREATE CURSOR temp ('field1' c (10), 'field2' C(20))
APPEND BLANK
REPLACE field1 WITH 'ONE', FIELD2 WITH 'TWO'
loMaster = CREATEOBJECT('custom')
loMaster.AddProperty('oData', null)
SCATTER MEMO NAME loMaster.oData
loMaster.AddProperty('NewProperty', 'New Value')
? loMaster.oData.field1
? loMaster.oData.field2
? loMaster.NewProperty
APPEND BLANK
REPLACE field1 WITH 'THREE', FIELD2 WITH 'FOUR'
SCATTER MEMO NAME loMaster.oData
? loMaster.oData.field1
? loMaster.oData.field2
? loMaster.NewProperty
or
*Create the data object field by field (slower than a real SCATTER NAME)
LOCAL loData
CREATE CURSOR temp ('field1' c (10), 'field2' C(20))
APPEND BLANK
REPLACE field1 WITH 'ONE', FIELD2 WITH 'TWO'
loData = ScattertoObj()
loData.AddProperty('NewProperty', 'New Value')
? loData.field1
? loData.field2
? loData.NewProperty

FUNCTION ScattertoObj
LOCAL loData, loTemp, lcField, laFields
loData = CREATEOBJECT('custom')
SCATTER MEMO NAME loTemp
DIMENSION laFields(FCOUNT())
=AMEMBERS(laFields, loTemp)
FOR EACH lcField IN laFields
  loData.AddProperty(lcField, EVAL(ALIAS() + '.' + lcField))
ENDFOR
RETURN loData
HTH

>Hi,
>
>I have been looking for a non-OO function to add a property to an object. I want to add properties to objects created with SCATTER NAME . The object created by SCATTER NAME does not have an .AddProperty() method.
>
>Does anyone know of such a function?
>
>- Keith
Charles Richard
NVO Management Systems
crichard@nvo.ca
Previous
Reply
Map
View

Click here to load this message in the networking platform