Page 1 of 1

choosing TWO selections

Posted: Fri Jan 09, 2009 9:37 pm
by TheBigDuck
I am creating drop down menu that (for this example) has a list of all countries that MANUFACTURE CARS (again, this is an example)

SWEDEN
GERMANY
USA
ITALY

So if they choose GERMANY

I create the buttons AUDI, VW, Porsche, Mercedes in group AUTO

Code: Select all

create group "AUTO"
set the radiobehavior of group "AUTO" to false
    
    create button "Audi" in group "AUTO"
    set the style of it to radiobutton
repeat the other three...

Now the user has four radiobuttons (or checkboxes, doesn't matter).

I want the user to be able to choose MORE THAN ONE and then take action based on the choices

so if they choose "Audi" AND "Porsche", I can say,

"congrats, we are sending you a new Audi"

"congrats, we are sending you a new Porsche"

How do I do this?

Posted: Fri Jan 09, 2009 11:50 pm
by Mark
Dear TheBigDuck,

You should use checkboxes. Yes, it does matter! The user doesn't expect to be able to activate more than one radio button and, as you have noticed, you need to fiddle with the radiobehavior if you use radio buttons.

To find out which checkboxes are hilited, use a repeat loop that checks the hilite of each checkbox.

Code: Select all

repeat with x = 1 to number of buttons of grp "Cars"
  if the style of btn x is "checkbox" and the hilite of btn x then
    put the id of btn x & cr after myList
  end if
end repeat
delete last char of myList -- most of the time optional
-- do something with myList here
Kind regards,

Mark