selectedText confusion
Graham Samuel
livfoss at blueyonder.co.uk
Tue Mar 23 05:37:40 EST 2004
Thanks to Klaus, Ray and Hershev for answering this. All in all, it was my
fault because a mistake about context. I also reported the problem
incorrectly. I said
>I've got a list field where one line is hilited (I can see the hilite),
>and I have the following handler in it
>on mouseUp
> global lcgCurrentPerson
> put the selectedText into lcgCurrentPerson
>end mouseUp
>
>I send a mouseUp from a handler in the stack which owns the field in order
>to fill my variable lcgCurrentPerson, but all I get is empty. Can anyone
>explain this?
I wasn't getting 'empty' consistently, I was getting the selectedText of
the object (a field) which had sent the message to my list field. In other
words, by not qualifying 'the selectedText' with the name of the target
field (or 'me') I had got the wrong value for it. In a way this is quite a
subtle point: if 'me' refers to the target of my message, I might perhaps
be forgiven for thinking that an unqualified 'the selectedText' also refers
to the target. This is similar to the confusion one can get into about what
'this' refers to. In fact, hershev was wrong to say
>if the script isn't in the field the text is then you have to write
>put the selectedText of field "theTextIsIn" into myVar
My script **is** in the field the text is in - it's just that the handler
there was activated from another field.
Anyway it works now
Thanks again
Graham
Graham Samuel / The Living Fossil Co. / UK & France
More information about the use-livecode
mailing list