Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #8694 > unrolled thread

Re: How add a menu item with a menu key using an init.m

Started byAndy Ross <andyr@wolfram.com>
First post2012-02-22 10:29 +0000
Last post2012-02-22 10:29 +0000
Articles 1 — 1 participant

Back to article view | Back to comp.soft-sys.math.mathematica

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: How add a menu item with a menu key using an init.m Andy Ross <andyr@wolfram.com> - 2012-02-22 10:29 +0000

#8694 — Re: How add a menu item with a menu key using an init.m

FromAndy Ross <andyr@wolfram.com>
Date2012-02-22 10:29 +0000
SubjectRe: How add a menu item with a menu key using an init.m
Message-ID<ji2g2h$k79$1@smc.vnet.net>
I would suggest replacing that block of code with

FrontEndExecute[ AddMenuCommands[ "ColorSelectorDialog", {Delimiter,  
Item["Options &Explorer", "OptionsDialog", MenuKey["O", Modifiers -> 
{"Control", "Shift"}]]}]];

One issue is that "Input from Above" isn't a Front-end token appearing 
in MenuSetup.tr so the front end doesn't know where to place it. This 
should be close to what you want, you can always add delimiters to make 
it stand out more.

-Andy

On 2/21/2012 5:14 AM, Murray Eisenberg wrote:
> I want to add an item to the Insert menu that executes a particular
> kernel command and is activated by a particular shortcut key. And I want
> to do this _without_ modifying and of the .tr files in
> $InstallationDirectory/SystemFiles/FrontEnd/TextResources but only by
> modifying files in the $UserBaseDirectory tree. (So that such changes
> will be preserved across version updates.)
>
> I know that in principle one can do this by creating (or editing an
> existing) file:
>
>     Autoload`PacletManagerConfiguration``FrontEnd``init.m
>
> Here's what I put there:
>
>     FrontEnd`AddMenuCommands["Input from Above",
>        {Delimiter,Item["Options&Explorer",
>         KernelExecute[ToExpression["OptionsExplorer[]"]],
>         MenuKey["o",Modifiers->{Control,Command}],
>         MenuEvaluator->Automatic]}];
>
> But nothing happens after a restart of Mathematica with clean cache.
>
> What's wrong? Did I err in indicating the Insert menu's entry "Item from
> Above" referenced there? Or something else.
>
> Note that the corresponding modification, instead, to MenuSetup.tr would be:
>
>     Item["Options&Explorer",
>        KernelExecute[ToExpression["OptionsExplorer[]"]],
>        MenuKey["o", Modifiers->{Control,Command}],
>        MenuEvaluator->Automatic]
>
> (This is specifically to invoke Yuri Kandrashkin's OptionsExplorer
> package. But of course my question has more general applicability.)
>

[toc] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web