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.

To programmatically add to menus you can do as described here:

How do I add to menus?

What can I do to programmatically add to contextual menus? Is something similar to AddMenuCommands available?

share|improve this question
add comment

1 Answer 1

There's an option ContextMenu, which you seem to be able to set at cell, notebook, or even box level. They all default to something like

FEPrivate`FrontEndResource["ContextMenus", "something"]

That info seems to be in the ContextMenus.tr file in the $InstallationDirectory, SystemFiles, FrontEnd, TextResources.

In any case, all that that option needs is a list of MenuItem[...]. You can look at that file (or at MenuSetup.tr) to get a hang on the syntax. Then it's just setting the option.

Apart from the brute force method of reading the file, creating your own, adding your Menus, and setting that option, I still haven't found a way to "append" the MenuItems. Only to replace... I'll edit if I find something

share|improve this answer
2  
You're right...you can't append menu items. But you missed a second source of context menus...the ComponentwiseContextMenu option. ContextMenu is used where you can easily dictate context menus by style, whereas ComponentwiseContextMenu allows you to determine context menus which belong to certain box types, the various cell-related widgets, etc., which may be difficult or impossible to apply styles to. –  John Fultz Mar 6 '12 at 15:52
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.