MathGroup Archive 1999

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Select cell

  • To: mathgroup at smc.vnet.net
  • Subject: [mg20023] Re: Select cell
  • From: "P.J. Hinton" <paulh at wolfram.com>
  • Date: Sat, 25 Sep 1999 02:40:47 -0400
  • Organization: "Wolfram Research, Inc."
  • References: <7se7r5$quk@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

On 23 Sep 1999, chris wrote:

> Can I select the bracket of the cell in which the cursor rests by a
> keyboard shortcut? Like ctr-a selects all cells.
> 
> I would like to avoid the use of the mouse while working on my laptop.

I don't seem to recall such a shortcut, but you can create one by adding
an entry to a private version of KeyEventTranslations.tr.  To do this, you
will need to do the following.

1) Determine the location of the private file by evaluating this
expression in a notebook.

LinkWrite[$ParentLink, 
  FrontEnd`ToFileName[
    FrontEnd`FileName[
      {$PreferencesDirectory, "SystemFiles", "FrontEnd", "TextResources"}
    ]
  ]
]; LinkRead[$ParentLink]

This will return a string containing the full path.

2) Create a directory with the path shown in step (1).

3) Determine the location of the shared version of this file by evaluating
this expression in a notebook:

LinkWrite[$ParentLink,
  FrontEnd`ToFileName[
    FrontEnd`FileName[
      {$TopDirectory, "SystemFiles", "FrontEnd", "TextResources"}
    ]
  ]
]; LinkRead[$ParentLink]

Again, this will return a string with the full path.

4) Copy KeyEventTranslations.tr from the directory you found in step
(3) into the directory you created in step (1).

5) Open the newly copied file in your favorite text editing program.

6) Note that there is a large Mathematica expression in this file that has
the head EventTranslations.  The expression contains a list of
subexpressions with head Item.  All you need to do is add an item that
perform the action you want.

Suppose, for example, that you wanted to define Ctrl-u to be the shortcut
for extending the selection the complete cell.  You could add something
like this:

Item[
  KeyEvent["u", Modifiers -> {Control}],
  FrontEndExecute[{SelectionMove[InputNotebook[], All, Cell]}]
]

Note that you should exercise caution in adding key translations so that
they do not conflict with existing shortcuts.

--
P.J. Hinton
Mathematica Programming Group           paulh at wolfram.com
Wolfram Research, Inc.
Disclaimer: Opinions expressed herein are those of the author alone.



  • Prev by Date: Re: Linear Algebra `MatrixManipulation`
  • Next by Date: Re: fractions as axes-labels?
  • Previous by thread: Re: Select cell
  • Next by thread: Re: Select cell