Page 1 of 1
Switch & Case button group
Posted: Wed Sep 25, 2013 10:51 am
by dbailey
Hi All,
If I have a group of buttons on a card how do I check which button has been pressed/selected. I understand using the switch & case commands but not sure how to check against the buttons.
Re: Switch & Case button group
Posted: Wed Sep 25, 2013 11:33 am
by jmburnod
Hi,
For radio btn
You can use the radiobehavior (hilite one radio button at time" of the group
or write your own script to check the changed state of each btn
Something like that:
Code: Select all
on mouseUp
put getNumHilitedBtnInGroup(MyGroupName)
end mouseUp
function getNumHilitedBtnInGroup pGroup -- return a list of the number of each hilited btn like "1,3,5"
put the num of btns of group pGroup into nb
put empty into tBtnHilited
repeat with i = 1 to nb
if the hilite of btn i of group pGroup then
put i & "," after tBtnHilited
end if
end repeat
delete char -1 of tBtnHilited
return tBtnHilited
end getNumHilitedBtnInGroup
Best
Jean-Marc
Re: Switch & Case button group
Posted: Wed Sep 25, 2013 2:50 pm
by dunbarx
Hi.
You can also just check the "target" in a mouseUp handler. Not sure where in your project that handler ought to be placed, or whether each button might have its own. And I am not sure how the buttons in your group are named or distinguished, but:
Code: Select all
on mouseup
answer the target
end mouseUp
Craig Newman