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.
Switch & Case button group
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Re: Switch & Case button group
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:
Best
Jean-Marc
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
Jean-Marc
https://alternatic.ch
Re: Switch & Case button group
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:
Craig Newman
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