how to make a whole group into a target

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

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9567
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: how to make a whole group into a target

Post by dunbarx » Fri Apr 02, 2021 9:20 pm

Jacque.

Well, almost. :wink:

If I have a handler in a locked field or button, both of which are containers, and where either control contains some text, then:

Code: Select all

on mouseup
   answer me
 end mouseup
returns the text itself, what I described as the "contents". If I place this handler into an object that is not a container, however, then that handler returns the short name of the target. We both know this.

I never liked the fact that "me", for objects that are not containers, returned the object name. I think that for consistency empty should be returned, or even throw an error.

Craig

EDIT. Of course this has nothing to do with the construction "of me", which does indeed reference the target itself, as opposed to the naked "me", which is what I wanted to restrict above to container contents only.

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

Re: how to make a whole group into a target

Post by jacque » Sat Apr 03, 2021 5:03 pm

I see. "Me" is still referencing the control but the engine resolves it, just as it does with field references; i.e., "put fld 1" also gives you the text. It's an ancient inheritance from HC. I suppose this could be confusing to new users.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9567
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: how to make a whole group into a target

Post by dunbarx » Sat Apr 03, 2021 8:01 pm

Jacque wrote:
I suppose this could be confusing to new users.
HC worked exactly this way. All those "me's" are very compact and useful if one is accustomed to them and their subtle variants. A short lesson on "me" might be useful, if anyone asks.

Craig

Post Reply

Return to “Talking LiveCode”