0
$\begingroup$

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.

$\endgroup$
3
  • $\begingroup$ As a general strategy, you could run a scheduled task each n seconds and test the file date there. $\endgroup$ Commented Oct 9, 2012 at 12:07
  • $\begingroup$ Yes. And except If, is there any other way to associate all the three popupmenu $\endgroup$
    – Jennifer
    Commented Oct 9, 2012 at 12:14
  • $\begingroup$ 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]]} $\endgroup$
    – celtschk
    Commented Oct 9, 2012 at 12:21

2 Answers 2

4
$\begingroup$

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.

$\endgroup$
5
  • $\begingroup$ I just noticed that you got the Populist badge. Nice going. :-) $\endgroup$
    – Mr.Wizard
    Commented Oct 9, 2012 at 20:47
  • $\begingroup$ @Mr.Wizard Thank you. :) $\endgroup$
    – jVincent
    Commented Oct 10, 2012 at 16:21
  • $\begingroup$ @jVincent: How can I use ActionMenu with Switch if I have to assign some action also in second Popupmenu $\endgroup$
    – Jennifer
    Commented Oct 10, 2012 at 17:26
  • $\begingroup$ @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. $\endgroup$
    – jVincent
    Commented Oct 10, 2012 at 17:54
  • $\begingroup$ @jVincent: I have edited. $\endgroup$
    – Jennifer
    Commented Oct 10, 2012 at 18:18
1
$\begingroup$

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]
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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