Unexpected result when calling a handler in a group script

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: Klaus, FourthWorld, heatherlaine, robinmiller, kevinmiller

SparkOut
Posts: 2015
Joined: Sun Sep 23, 2007 4:58 pm

Re: Unexpected result when calling a handler in a group script

Post by SparkOut » Sun Oct 07, 2018 7:28 pm

jacque wrote:
Sun Oct 07, 2018 6:50 pm
"of me" fails because it returns the short name. The engine looks on the card for a group with that name, and there isn't one, so it returns empty. Using "the long name of me" does work, as mentioned.
Yes, but "the target" also returns the short name, but still works.
And if there isn't an object, shouldn't it generate an error instead of returning empty? If the current card is used instead of card "First" without such an object, there is an error produced.
jacque wrote:
Sun Oct 07, 2018 6:50 pm
That said, there may be something wrong because changing the command to use "send" instead should work. "Send" is supposed to use the context of the card where the receiving handler lives (card "First") and in this case it isn't doing that.
I thought that too, I am relieved that I had not ungrokked the way things are supposed to behave, but perturbed by the problematic situation here.

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 5087
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: Unexpected result when calling a handler in a group script

Post by jacque » Sun Oct 07, 2018 8:29 pm

Yes, but "the target" also returns the short name, but still works.
That's why I wondered if some internal parsing was happening. Maybe it only returns the short name but internally uses the long name. Someone who can read the source code might know.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3281
Joined: Sun Jan 07, 2007 9:12 pm
Location: Bochum, Germany

Re: Unexpected result when calling a handler in a group script

Post by bn » Sun Oct 07, 2018 11:58 pm

I think this is a simple chunking error.

"me" works for these properties

Code: Select all

Command DestinationVolume
   return the rect of field "Destination" of me
   return the owner of me
   return the rect of control 1 of me
   return the name of control 1 of me
   return the number of controls of me
end DestinationVolume
comment out from top down to see the answers. "Me" is resolved for these properties when called from a different card. But not for the text of a field.

But then I may be wrong and someone please explain to me what the difference of "me" is in the case of asking for the "text of field x of me" vs above examples

Kind regards
Bernd

Post Reply

Return to “Talking LiveCode”