Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Compare Object
Message
From
24/02/1999 13:47:23
Bob Lucas
The WordWare Agency
Alberta, Canada
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
00190373
Message ID:
00191054
Views:
16
I wasn't sure if the question was comparing the objects or the object references. Anyway, the = relational operator can check if the references are the same, while COMPOBJ will compare the properties and values etc. of two distinct objects to see if they are the same.

Your combobjs function will return the same result as the = operator (in VFP 6.0 only!)


>Perhaps I misanderstood the question. The function below tells me if I am looking at the same object with a different name. Like:
>
>o1 = createobject("someobject")
>o2 = o1
>
>In this case the function would return true.
>
>Silvio
>
>
>>Why not just use COMPOBJ?
>>
>>IF you need to determine if obj1 references the same object as obj2 just use the equal operator:
>>
>>IF obj1 = obj2 && true if they both reference the same object
>>
>>You can also use the equal to (=) operator in Visual FoxPro 6.0 to determine if two object references refer to the same object
>>
>>
>>
>>>HI John,
>>>try with this function
>>>
>>>*** function compobjs
>>>lparameters obj1,obj2
>>>local oldtag,retval
>>>oldtag = obj1.tag
>>>obj1.tag = "test"
>>>retval = obj1.tag == obj2.tag
>>>obj1.tag = oldtag
>>>return retval
>>>
>>>
>>>HTH
>>>
>>>Silvio
>>>
>>>>Hi,
>>>> How could I compare the object references in VFP?
>>>> ABC = thisform.text1
>>>> IF ABC (what operator??) whateverobject_reference
>>>> do whatever
>>>> ENDIF
>>>>
>>>> VB:
>>>> IF ABC IS WHATEVER_REFERENCE THEN
>>>> ?????
>>>> ENDIF
>>>>
>>>>Thank you
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform