Re: user-defined functions in KeyEventTranslations.tr
- To: mathgroup at smc.vnet.net
- Subject: [mg112306] Re: user-defined functions in KeyEventTranslations.tr
- From: John Fultz <jfultz at wolfram.com>
- Date: Wed, 8 Sep 2010 01:00:32 -0400 (EDT)
It actually doesn't technically matter whether you use KernelExecute or FrontEndExecute in this case...I make the distinction as a matter of clarity, not technical necessity. But MenuEvaluator->Automatic forces the contents of KernelExecute to be sent to the default kernel (you could also name a kernel on the rhs of MenuEvaluator), which is what AlexG was asking for. Sincerely, John Fultz jfultz at wolfram.com User Interface Group Wolfram Research, Inc. On Tue, 7 Sep 2010 06:07:40 -0400 (EDT), magma wrote: > John, > it is not clear to me what is the practical difference between your > suggested method and the one mentioned by AlexG. > That is: what difference/advantage does it make to use KernelExecute > instead of FrontEndExecute? > And what is the purpose of MenuEvaluator->Automatic ? > > > On Sep 7, 8:00 am, John Fultz <jfu... at wolfram.com> wrote: >> On Sun, 5 Sep 2010 05:27:28 -0400 (EDT), AlexG wrote: >>> Mathematica would be about 200% more useful if I could call my own >>> functions from KeyEventTranslations.tr. Does anybody know a way of >>> accomplishing this? On this board, examples of item entries in the >>> file take this form: >>> Item[KeyEvent["...", Modifiers -> {...}], FrontEndExecute[...] >>> >>> Is there any way to communicate with the Kernel through >>> FrontEndExecute[] here? >>> >>> Thanks, All >>> >> You can make this work by wrapping the thing you wish to evaluate in >> KernelExecute, and by adding the option MenuEvaluator->Automatic to the >> I= > tem[] >> listing. E.g., >> >> Item[KeyEvent["F8"], KernelExecute[Print["F8 was pressed"= > ]], >> MenuEvaluator->Automatic] >> >> Sincerely, >> >> John Fultz >> jfu... at wolfram.com >> User Interface Group >> Wolfram Research, Inc.