referencing item in dropdown menu form another handler
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
referencing item in dropdown menu form another handler
I would like have the final calculation button code be able to reference a particular combination of items in two drop down menus. For example: the calculate button will have a conditional clause/code where if it is this variable do this if it is that variable do that - like this - if the user picks grams in first menu and ounces in second menu this combination will go into a myVaribiable1; if user picks the ounces in the first and grams in the second then this combination goes into myVariable2. These two conditions are governed NOT by the combination itself, but by the fact that 3 of the combinations need to be divided, and 7 need to be multiplied.
Question: My rudimentary thinking is something like this: (All this goes into the final calculate button) The actual pull down menu scripts will not need to be changed because they have the mathematics coded and contained within their variables and all set to go here.
if pulldownmenu01 contains item grams and pulldownmenu02 contains item ounces then
put this combination into myVariable01
Or should I declare a variable for example:
field pdm01 contains ounces,kilograms and fld pdm02 contains grams,lbs (uk), = gDiv
If there are any written references to this sort of thing then gladly please, let me read them, but I had trouble finding anything where people were referencing the items within the dropdown menu.
Thankyou
chris
Question: My rudimentary thinking is something like this: (All this goes into the final calculate button) The actual pull down menu scripts will not need to be changed because they have the mathematics coded and contained within their variables and all set to go here.
if pulldownmenu01 contains item grams and pulldownmenu02 contains item ounces then
put this combination into myVariable01
Or should I declare a variable for example:
field pdm01 contains ounces,kilograms and fld pdm02 contains grams,lbs (uk), = gDiv
If there are any written references to this sort of thing then gladly please, let me read them, but I had trouble finding anything where people were referencing the items within the dropdown menu.
Thankyou
chris
Re: referencing item in dropdown menu form another handler
Hi Chris,
you want to check -> the LABEL of btn "your option menu here..."
Best
Klaus
you want to check -> the LABEL of btn "your option menu here..."
Best
Klaus
Re: referencing item in dropdown menu form another handler
Such a straightforward simple answer Thankyou Klaus - and there I was reading about "integer logic implementation for drop down menu variability environmental deployment" 

Re: referencing item in dropdown menu form another handler
Where is the missing "then", I have counted the 'ifs', and the 'thens' match up?
Re: referencing item in dropdown menu form another handler
And it is even correct syntax, so please USE it, and put all STRINGS in QUOTES!chris25 wrote:Such a straightforward simple answer
-> if the label OF BUTTON "pdm01" = "lbs(uk)" ...
Missing THEN:
I have no idea, that's why I avoid nested if clauses whereer possile!

Use this form:
on mouseup
Code: Select all
if the label OF BUTTON "pdm01" = "lbs(uk)" AND the label OF BUTTON "pdm02" = "ounces" THEN
## do this or that...
EXIT moseup
end if
## Now youcan check with ONE if then else:
if .... THEN
# do that
ELSE
## do somehting else
end if
end mouseup
Code: Select all
...
switch
case the label OF BUTTON "pdm01" = "lbs(uk)" AND the label OF BUTTON "pdm02" = "ounces"
do something
break
case the label OF BUTTON "pdm01" = "kilogram)" AND the label OF BUTTON "pdm02" = "lbs(uk)"
## ...
break
case the label OF BUTTON "pdm01" = "another value" AND the label OF BUTTON "pdm02" = "yet another value"
## ...
break
end switch
...
Klaus
Re: referencing item in dropdown menu form another handler
Hi Klaus, funny I was for the first time just experimenting with the switch structure, so glad you posted that, I was hitting all sorts of issues....Thanks.
Re: referencing item in dropdown menu form another handler
I suspect the "missing then" is a spurious error because the syntax for "label" was wrong. The engine couldn't quite pinpoint what the problem was, so it reports the closest error match. Sometimes that happens. Another common one is that the line is missing a comma. It's almost never that, but it does clue you to the fact that there's a syntax error somewhere in the line.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
Re: referencing item in dropdown menu form another handler
Hallo Jacque, yes, I often find it difficult to get the syntax right after looking in the dictionary, it's hard to know how to interpret the various brackets and italics and so forth, there is no shall we say 'how to use this dictionary' page. the label and the switch and the case were just three elements where I was having a spot of bother trying to figure out the syntax from the dictionary. I usually try to find other peoples' scripts as examples but could not find a script this time.
Re: referencing item in dropdown menu form another handler
Yes, it took me a while to figure out the syntax format at first too. The easiest thing it to just look at the examples section in each entry. Those are always present.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
Re: referencing item in dropdown menu form another handler
Yes but the examples can be just as cryptic as well on ocaisions.