Group Abstract Group Abstract

Message Boards Message Boards

ActionMenu prints its output on messages window instead of notebook

Posted 4 years ago
POSTED BY: Mario Veruete
7 Replies
Attachments:
POSTED BY: Gianni Mocellin
Posted 4 years ago

Here is a code fragment, a tool to insert a function template, showing one way:

ActionMenu["Plot", 
 ht = gettmp[#] & /@ 
   getUsg3@"Plot"; (# :> NotebookApply[InputNotebook[], #]) & /@ 
  ht, Appearance -> {"Frameles"}]
POSTED BY: Andrew Meit

Dear Daniel,

Could you give some examples of the ways you used ActionMenu with NotebookApply?

Thank you beforehand for your answer.

Kindest Regards.

Gianni Mocellin

POSTED BY: Gianni Mocellin
Posted 4 years ago

This great NotebookApply feature, combined with the ActionMenu feature, helped me too!

POSTED BY: Daniell Miller

Dear Rohit,

I am Gianni Mocellin from Geneva, Switzerland, and I took notice of your prompt answer to the very interesting question by Mario Veruete.

I have a similar issue but instead of using Print, I have a FormFunction that does not execute from a menu in a Palette.

Thank you beforehand for your help, if possible.

Kindest regards.

Gianni

createQuantity := FormFunction[
   "quantity list" ->
    RepeatingElement[
     CompoundElement[
      <|
       "Property" -> "String",
       "Unit" -> "Expression",
       "Magnitude" -> "Expression"
       |>
      ]
     ],
   AppearanceRules ->
    <|
     "Title" -> "Enter an quantity"
     |>
   ];
createQuantity[]

CreatePalette[
 Grid[
  {
   {
    ActionMenu[
     "Logo",
     {"About" :> NotebookApply[SelectedNotebook[], "Info"]}
     ],
    ActionMenu[
     "Menu 1",
     {
      "Action 1.1" :> createQuantity[],
      "Action 1.2" :> Print[2 + 2]
      }
     ]
    }
   },
  Frame -> All]
 ]
POSTED BY: Gianni Mocellin
Posted 4 years ago

Dear Rohit,

Thank you so much for your prompt answer.

I was thinking about something like that but I was not aware of the use of the NotebookApply function in conjunction with the ActionMenu function because in the ActionMenu documentation there is no example for that use.

Kindest regards,

Mario

POSTED BY: Mario Veruete
Posted 4 years ago

Hi Mario,

Is this what you are trying to accomplish?

CreatePalette[Grid[{{
    ActionMenu[
     "Logo", {"About" :> NotebookApply[SelectedNotebook[], "Info"]}],
    ActionMenu["Menu 1",
     {"Action 1.1" :> NotebookApply[SelectedNotebook[], "foo"],
      "Action 1.2" :> NotebookApply[SelectedNotebook[], 2 + 2]}]}},
  Frame -> All]]
POSTED BY: Rohit Namjoshi
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard