Page 1 of 1

put name of button into

Posted: Tue Dec 23, 2014 5:35 pm
by DavJans
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?

Re: put name of button into

Posted: Tue Dec 23, 2014 5:50 pm
by Klaus
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

Re: put name of button into

Posted: Tue Dec 23, 2014 7:28 pm
by DavJans
Thank you Klaus

Re: put name of button into

Posted: Tue Dec 23, 2014 8:04 pm
by dunbarx
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