Just for interest, I've been playing with the classes created by..
SCATTER NAME
The object so created doesn't have a baseclass, class etc. Just the user defined properties. NICE.
However the only way I can figure to create one of these beasties is via the SCATTER NAME approach. Is there any other way? Anyone?
So I pass this classless class as a parameter to my "observer" class in the init event. The "observer" updates it's properties *quickly* and easily then from the class that it's observing (usually a form).
>>What is the best way of transferring property values from one object to another?
>>Let's say I have an object A with properties x, y, and z
>>and I have object B with properties q, r, x and y
>>I want a method to transfer x and y values from B to A without explicitly "knowing" that the object share those properties in common
>>
>>I'm currently using AMEMBERS() and vartype() etc , but is there an easier way?
>
>I don't think there's an easy way. FWIW, here;s the code that I use to do the same thing:
>
>>FUNCTION CopyProp
>LPARA o1, o2
>
>* Copy all property values from one object to another
>IF TYPE('o1.Name') <> "C" OR TYPE('o2.Name') <> "C"
> RETURN .F.
>ENDIF
>
>lnPropertyCount = AMEMBERS(aProps, o1)
>
>FOR i = 1 TO lnPropertyCount
> IF !ALLTRIM(UPPER(aProps(i)))$"CLASS:PARENTCLASS:BASECLASS:NAME"
> uVal = GETPEM(o1,aProps(i))
> IF PEMSTATUS(o2,aProps(i),5)
> IF !PEMSTATUS(o2,aProps(i),1)
> IF !PEMSTATUS(o2,aProps(i),2)
> o2.WriteExpression(aProps(i), uVal)
> ENDIF
> ENDIF
> ENDIF
> ENDIF
>ENDFOR
>