At 10:32 am +0100 2/5/01, Matthew Davies wrote:
>I am fairly new to the world of metcard and find it a fascinating piece
>of kit. I am however having a problem with menus.
>
>I have four groups of radio buttons. Group 1 has 7 buttons, group 2 has
>4 buttons, group 3 has 7 buttons and group 4 has 5 buttons.
>
>I would like to write a script that will automatically generate an id
>number, corresponding to a certain combination of radiobuttons, when one
>of the radio buttons is changed. Obviously there will be four buttons
>selected at any time, and a total of 980 combinations, so efficiency is
>important. What is the easiest way to achieve this result?

Here's a crude approach (untried).

Assumes none of these groups will ever have more than 9 buttons.

To build the value, have a mouseUp handler in each of the groups 
something like this:

on mouseUp
if the owner of the target is me ## make sure the click was in the group
   put 0 into tVal
   put the hilitedButton of group 1 after tVal
   put the hilitedButton of group 2 after tVal
   put the hilitedButton of group 3 after tVal
   put the hilitedButton of group 4 after tVal
   # do whatever with tVal
end if
end mouseUp

Then to later retrieve the setting of any group using the calculated value:

function getGroupValue pVal, pGroup
## pVal is the value calculated above, pGroup is the group number
   return char pGroup of pVal
end getGroupValue

I expect there are better and more general solutions, but it should work.

Cheers
Dave Cragg

Archives: http://www.mail-archive.com/metacard@lists.runrev.com/
Info: http://www.xworlds.com/metacard/mailinglist.htm
Please send bug reports to <[EMAIL PROTECTED]>, not this list.

Reply via email to