Exact number of a radio button in a group

Richmond Mathewson richmondmathewson at gmail.com
Sun Oct 25 15:41:27 EDT 2009


tareq_tawaiha wrote:
> This might be a simple question. I have 4 buttons in a group. Each buttons
> name and label are similar for that button. If i edit the group then select
> a button and check its "Size and position" in the property inspector , at
> the end of the inspector there is a field called number, is there a way to
> use that number in a script ? 
>
> I have made sure that for all the buttons in my group (top to bottom) the
> number of the buttons are  (1, 2 , 3, 4) (In the picture i attached , if i
> inspect button "simple" it is one , button colorful it is "2" see attached
> picture). 
>
>  I want to be able to assign a letter (A,B, C and D) for every button when
> selected. If a user selects "colorful" then i want to put "b". I could use a
> switch statement IF i could get that assigned number . 
>
> I use this code , its not working ( any other way of doing this ?) 
>
> on mouseDown
>    get the  hilitedButtonName of me 
>    put it into bname
>    put bname
>    
>    get the number of button bname
>    put it into X
>
> switch X
>
> case "1" 
> put "A"
> break 
>
> case "2" 
> put "B"
>
> case "3"
> put "C"
> http://www.nabble.com/file/p26050917/Picture%2B1.png 
> case "4"
> put "D"
>
> end switch 
>
> end mouseDown
>   
What an incredibly complicated way of doing things!!!!!!

I made a stack with a copy of your group and put these scripts into
buttons "simple", "colorful", "large" and "visible" respectedly:

on mouseUp
   put "a" into fld "fOUTPUT"
end mouseUp

on mouseUp
   put "b" into fld "fOUTPUT"
end mouseUp

on mouseUp
   put "c" into fld "fOUTPUT"
end mouseUp

on mouseUp
   put "d" into fld "fOUTPUT"
end mouseUp

no stress, no mess!

Love, Richmond.



More information about the use-livecode mailing list