>>x=createobject('form')
>>y=createobject(x.class)
>
>It only creates an object of the same class, not a copy of the initial object.
Try this.
John Burton
FUNCTION CopyObjectProperties
LPARAMETERS oSource, oTarget
LOCAL aProperties[1], i, p1
DO ListCustomProperties WITH oSource, aProperties
FOR i = 1 TO ALEN(aProperties)
p1 = aProperties[i]
IF TYPE('oTarget.&p1[1]')='U'
* not an array
oTarget.&p1 = oSource.&p1
ELSE
= ACOPY(oSource.&p1, oTarget.&p1)
ENDIF
ENDFOR
ENDFUNC
PROCEDURE ListCustomProperties
LPARAMETER oObject, aArr
LOCAL a1[1], a2[1], ch, n
=AMEMBERS(a1, oObject, 1)
=AMEMBERS(a2, oObject.BaseClass)
DIMENSION aArr(ALEN(a1))
n = 0
FOR i = 1 TO ALEN(a1, 1)
ch = a1[i, 1]
IF a1[i,2]='Property' AND 0=ASCAN(a2, ch)
n = n + 1
aArr[n] = ch
ENDIF
ENDFOR
DIMENSION aArr[n]
ENDPROC
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only