>Why can't i check if an object reference equalizes an object refrence:
>
>oObject = This WORKS
>? oObject = This Operator/oparend type mismatch
>
>How should i check if to object refrence refer to the same object (its names are not unique).
>
>Marco Beuk.
Marco,
I think you already have the answer. I just want to summarize and make it clear.
oObject=this works because it's an *assignment*
? oObject = This fails because it's a *comparison test* and you cannot use "=" as comparison operator for objects (in VFP 6 you can as heard - not tested or see).
Compobj() is the key function to compare objects but not enough alone because it simply checks if two objects PEM are identical or not.
A container can have more than one object with *same name*. This is open to discussion as what we call a container (a _screen or application is a container ? - for me yes they should be).
So if we agree a container can hold more than one object with same name, Ken Levy's simple approach is good for identifying instances of same object :
function mycompobj
lparameters o1, o2
local lcName, llSameObject
llSameObject = compobj(o1,o2)
if llSameObject
lcName = o1.name
o1.name = "x"+o1.name
llSameObject = compobj(o1,o2)
o1.name = lcName
endif
return llSameObject
Cetin