Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I have threePopupMenu and they work in such a way that second PopupMenu value depends on the value selected by the first PopupMenu and third PopupMenu value depends on the second PopupMenu value being selected.

If first PopupMenu has two option a and b. Then second PopupMenu should have c,d,e if a is selected and f when b is selected.

And if c is selected from second PopupMenu then third PopupMenu should have g,h and so on. These options are imported from Excel files. I wanted this to be dynamic; if someone makes any change to this file, then it should work accordingly.

At the starting time, all three PopupMenu should show Popup1, Popup2, Popup3 as the name of PopupMenu and the selected value should be shown in its title name from White color and all PopupMenu background is black.

share|improve this question
    
As a general strategy, you could run a scheduled task each n seconds and test the file date there. –  belisarius Oct 9 '12 at 12:07
    
Yes. And except If, is there any other way to associate all the three popupmenu –  Jennifer Oct 9 '12 at 12:14
    
Would the following do what you want? menu2[a]=PopupMenu[x,{c,d,e}];menu2[b]=PopupMenu[x,{f}];{PopupMenu[Dynamic[y],{‌​a,b}],Dynamic[menu2[y]]} –  celtschk Oct 9 '12 at 12:21
add comment

2 Answers 2

up vote 3 down vote accepted

The first part of your question can be done very simply by making dynamic popupmenues where the options are related to the choices of the other popupmenues:

 PopupMenu[Dynamic[varA], {a, b}]
 Dynamic[PopupMenu[Dynamic[varB], Switch[varA, a, {c, d, e}, b, {f}, _, {}]]] 
 Dynamic[PopupMenu[Dynamic[varC], Switch[varB, c, {g, h}, _, {"So on"}]]]

Hopefully someone else will be able to help with the best way to integrate this with Excel.

share|improve this answer
    
I just noticed that you got the Populist badge. Nice going. :-) –  Mr.Wizard Oct 9 '12 at 20:47
    
@Mr.Wizard Thank you. :) –  jVincent Oct 10 '12 at 16:21
    
@jVincent: How can I use ActionMenu with Switch if I have to assign some action also in second Popupmenu –  Jennifer Oct 10 '12 at 17:26
    
@Jennifer Unless I am misunderstanding your question, you should be able to just switch out PopupMenu with ActionMenu. If you are having trouble, you could extend your question. –  jVincent Oct 10 '12 at 17:54
    
@jVincent: I have edited. –  Jennifer Oct 10 '12 at 18:18
add comment

I had a similar type of problem, I have created the associated menus in a different way though.

 i := Position[{a, b, c, d}, Item1][[1, 1]]
    Menu1 := PopupMenu[Dynamic[Item1], {a, b, c, d}, a];
    Menu2 := PopupMenu[Dynamic[Item2], {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}, {10, 11,12}}[[i]],{{1, 2, 3}, {4, 5, 6}, {7, 8, 9}, {10, 11, 12}}[[i]][[1]]]
    Value1 := Item2*10;

Testing it

 Dynamic[i]

 Dynamic[Menu1]

 Dynamic[Item1]

 Dynamic[Menu2]

 Dynamic[Item2]

 Dynamic[Value1]
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.