Hello
I am starting to become more familiar with LiveCode, but still very much a beginner stage. I am trying to accomplish what I assume is an if/then script for 2 separate option menus. I am not sure this is the east way to do this, so I am open to suggestions. I provided an example to explain what I am trying to do.
Scenario:
1. 2 option buttons, labeled “Food” and the other labeled “Type”
2. 1st Option button labeled “food”, has list of Fruit or vegetables
3. 2nd Option Button is “disabled” until a choice from the first option button is selected
4. If the “fruit” is selected from button 1, then option button 2 will display the fruit option list
5. If the “vegetable” option is selected from button 1, then the option button 2 will display the vegetables option list
Thank you again for your help
Dan
If/Then for 2 Option Buttons?
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
-
- VIP Livecode Opensource Backer
- Posts: 3901
- Joined: Sat Mar 24, 2007 2:54 am
- Location: Palo Alto
Re: If/Then for 2 Option Buttons?
Hi Dan,
The option menu comes with switch/case which is very much like if/then.
I'm sure you've seen it by now:
pItemName will contain whatever is selected from the dropdown. Here is the first one:
To load button 2 you use
Can you take it from there?
Simon
The option menu comes with switch/case which is very much like if/then.
I'm sure you've seen it by now:
Code: Select all
on menuPick pItemName
switch pItemName
end switch
end menuPick
Code: Select all
on menuPick pItemName
switch pItemName
case "Food"
disable button 2
break
case...
end switch
end menuPick
Code: Select all
set the text of button 2 to "Apple" & cr& "Pear"&cr...
Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!
Re: If/Then for 2 Option Buttons?
Thank you Simon. Perfect!