Detect Name of Button on Mouse Click

Richmond richmondmathewson at gmail.com
Wed May 29 13:00:48 EDT 2013


On 05/29/2013 07:55 PM, Richmond wrote:
> Well, I don't know what is so difficult about that:
>
> on openCard declare a global string variable (e.g. BNAME)
>
> and then have this as 2 lines of code in each button script:
>
> put the name of me into BNAME
> pass mouseUp
>
> and then this in your card script:
>
> on mouseUp
>    put BNAME
> end mouseUp
>
> Of course, things will get very difficult indeed if you are generating 
> buttons on the fly
> and you cannot work out how to inject those 2 lines of code into each 
> of them.
>
> Richmond.

One way round this is to put this sort of script in your card:

on mouseDown
   put the target into fld "INN"
end mouseDown

and, always assuming your buttons don't have mouseDown scripts
the name of the button clicked on will be output to the fld "INN".




More information about the use-livecode mailing list