[mg27708] Redefine <Shift><Enter> ??

Skip to first unread message

P.J. Hinton

Mar 13, 2001, 4:09:37 AM3/13/01
On Mon, 12 Mar 2001, J.R. Chaffer wrote:

> On a normal desktop keyboard, the necessity to use the <Shift><Enter>
> combination every time one executes a command in Mathematica is
> perhaps less annoying. This is because one can just use the 'extra'
> <Enter> key at the lower right of most full size keyboards, which
> somehow incorporates the <Shift><Enter> functionality.
> On my laptop, however, this is not possible, because there is no extra
> "Enter" key. One is forced to use the two-key combination, an added
> irritation each time.
> My question is, is there a way to 'redefine' the keys in Mathematica
> (or in win98, which I use) to render this a single-keypress operation
> ? I have several Win98 books (including 'Mother..') but the subject
> of redefining keys is characteristically ignored.

The discussion that follows is independent of platform.

Mathematica interprets the keystroke combination Shift-Enter as a command
token named "EvaluateCells". If you want to specify an alternative
keystroke, you will need to edit the corresponding Item[] entry in the
resource file KeyEventTranslations.tr.

1) First determine the location of this resource file on your system by
evaluating this expression in a notebook:

{$TopDirectory, "SystemFiles", "FrontEnd", "TextResources"},
]; LinkRead[$ParentLink]

If you are working with a shared installation, you may not have
permissions to edit this file. If that is the case, copy the resource
file to a new directory with path:

{$PreferencesDirectory, "SystemFiles", "FrontEnd", "TextResources"}
]; LinkRead[$ParentLink]

2) Open this file in your favorite text editor program and locate the

Item[KeyEvent["Return", Modifiers -> {Shift}], "EvaluateCells"]

3) Change the argument of KeyEvent[] to whatever keystroke you wish to
use. Refer to the other entries in the file to get an idea of what the
syntax is like.

4) Save your changes and exit the editor.

When you restart the front end, the new keystroke should be in effect.

P.J. Hinton
User Interface Programmer pa...@wolfram.com
Wolfram Research, Inc.
Disclaimer: Opinions expressed herein are those of the author alone.

Reply all
Reply to author
0 new messages