2
$\begingroup$

I hope you can help me. I want to make a nested dynamic menu and I used the package MoreUI made by Kuba as a reference Question.

My problem is that I want to add tasks such as:

PTX[] := 
  Manipulate[Plot[Sin[a x + b], {x, 0, 6}], 
    {{a, 2, "Multiplier"}, 1, 4}, 
    {{b, 0, "Phase Parameter"}, 0, 10}];

And I added it as another option on the menu.

ActionNestedMenu[
 "Test menu" -> 
    {"lbl 11" :> Print[1],
     "lbl 12" -> {"New Option" :> PTX[], "lbl 22" :> Print[22]},
     "lbl 13" :> Print[3],
     "lbl 14" -> {"lbl 41" :> Print[41], "lbl 42" :> Print[42]},
     "lbl 15" ->
       {"lbl 51" -> {"lbl 511" :> Print[531],"lbl 512" :> Print[532]},
        "lbl 52" :> Print[41],
        "lbl 53" :> Print[42],
        "lbl 54" -> {"lbl 541" :> Print[531], "lbl 542" :> Print[532]}}}]

But when I run it, it does not do anything!

Is this fragment of the code the one that I will have to modify?

Fragment pf code from MoreUI:

Initialization :> (
  thisBox = EvaluationBox[])
$\endgroup$
  • 1
    $\begingroup$ But what do you want to happen? You Manipulate will be evaluated but won't appear anywhere, same story if you put PTX[] in Button or ActionMenu. You can e.g. MessageDialog @ PTX[]. $\endgroup$ – Kuba May 8 '19 at 22:59
  • $\begingroup$ I want that when you choose a menu option then show what that option does, in this case, a graph. Thank you, Kuba! The instruction you provided worked. I am not an expert in Mathematica but I want to continue learning. $\endgroup$ – Tomás Valencia May 8 '19 at 23:16
1
$\begingroup$

The solution is to change:

"New Option" :> PTX[],

by

"New Option" :> MessageDialog@PTX[],

Thanks to Kuba.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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