put name of button into

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
DavJans
Posts: 275
Joined: Thu Dec 12, 2013 4:21 pm

put name of button into

Post by DavJans » Tue Dec 23, 2014 5:35 pm

in the dictionary I found this

put me into myVariable -- puts contents, if me is a container
put me into myVariable -- puts name, if me is not a container

however..

on mouseUp
put me into fld "Test" on card "card2"
go to card "card2"
end mouseUp

... does not work.

Is it counting a button as a container or is a button not considered either? is there a way to do this?
"Det bästa stället att hitta en hjälpande hand är i slutet av din egen arm" förutom här

Klaus
Posts: 14199
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: put name of button into

Post by Klaus » Tue Dec 23, 2014 5:50 pm

Hi DavJans,

ME will not return the name of an object, you need to:
...
put the short name of me into fld "xyz" OF cd "abc"
## -> xyz
...
## Or:
put the name of me into fld "xyz" OF cd "abc"
## Will also return the TYPE of the object -> button "xyz"
...


Best

Klaus

DavJans
Posts: 275
Joined: Thu Dec 12, 2013 4:21 pm

Re: put name of button into

Post by DavJans » Tue Dec 23, 2014 7:28 pm

Thank you Klaus
"Det bästa stället att hitta en hjälpande hand är i slutet av din egen arm" förutom här

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10332
Joined: Wed May 06, 2009 2:28 pm

Re: put name of button into

Post by dunbarx » Tue Dec 23, 2014 8:04 pm

Hi.

A button is indeed a container:

Code: Select all

on mouseUp
   put "xxx" into btn 1
   answer btn 1
   answer me
end mouseUp
The contents are returned. Twice. But as Klaus said, when referring to "me" in the sense of an object descriptor, and this can be confusing, the syntax changes:

Code: Select all

on mouseUp
   put "xxx" into btn 3
   answer the width of me
end mouseUp
You get, perhaps, 82. Note that the use of "me" here, as in Klaus' example, is usually associated syntactically with a property. Takes practice. So start practicing. :D

Craig

Post Reply