Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Looking for replacement for .AddProperty()
Message
De
24/10/2001 18:49:31
Charles Richard
Nvo Management Systems
Boisbriand, Québec, Canada
 
 
À
24/10/2001 17:56:26
Keith Payne
Technical Marketing Solutions
Floride, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Programmation Orientée Object
Divers
Thread ID:
00572931
Message ID:
00572952
Vues:
28
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
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform