Locality of control references

Peter Haworth pete at lcsql.com
Sat Mar 14 22:15:56 EDT 2015


In a preOpenCard handler, I have an unqualified reference to a field on the
card which causes a "no such object" runtime error.  The reference is
correct, no typos, and the control exists on the card.

If I qualify the reference with "of me", the runtime error goes away.

This card is opened by a dragEnd handler after a control has been dropped
onto a different card in a different stack.  I suspect that without the "of
me" qualification, LC thinks I'm referring to a control on the card it was
dropped on to.

In fact, if I display the value of "this card" at the start of the handler,
it points to the card on which the control has been dropped, not the
current card

I can easily fix the issue by setting the defaultStack to the stack my
preOpenCard handler is on (I think) but shouldn't any control references
refer to the card the preOpenCard handler is executing on unless the
default stack has been changed to something else?



More information about the use-livecode mailing list