What you're doing is comparing the object reference, which won't do much
good. I assume what you've done is actually something like:
* Assume a property ioMySelfRef of ThisForm
*
thisform.ioMySelfRef = this
...
* Later, in another method of the embedded object (so context is
maintained)
IF thisform.ioMySelfRef == this
...
The above code checks to make sure you're in the same control on the form
since you examine the pointer to the object. You aren't checking
the -content- of the object, but the -pointer- to the object. If the
context of 'this' in code relative to the parent control remains the same,
the pointer stays the same unless you redefine the instantiation of the
object. You need to make a copy of the object decoupled from the current
object, and check the content, since the following will always be true:
this.visible = .T.
oRefPointer = thisform
this.visible = .F.
*control disappears
oRefPointer.visible = .T.
*control, not a copy of the control, reappears
*oRefPointer. will always be the same as this.
*unless the object itself is released and recreated without resetting
oRefPointer,
*or the context of 'this' is changed.
Save copies of the properties and compare them, not the pointer to the
object.
>
>Help!
>I have stored the value of this to a custom property on my form which I
then compare, using;
>
>if thisform.surrounded==this
>
>basically checking that the original value is either the same or not.
>This code I should add is in the mousemove event of my controls.
>
>Anyone keen to tell me the *right* way? < S >
>
>Cheers
>John
>
Attachment Converted: Edward M Rauh.vcf