Re: InitializationCell -> Toggle shortcut key
- To: mathgroup at smc.vnet.net
- Subject: [mg56802] Re: InitializationCell -> Toggle shortcut key
- From: Lee Newman <leenewm at umich.edu>
- Date: Fri, 6 May 2005 03:00:27 -0400 (EDT)
- References: <d5ctpl$me6$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Trevor Baca wrote: > mathgroup, > > i'd like to create a keyboard shortcut to toggle initialization cell > status. > > reading through the archives and studying a post from paul hinton, i > edit the file KeyEventTranslations.tr (deeply buried in the filesystem) > to include the following line: > > Item[KeyEvent["i", Modifiers -> {Command, Control}], InitializationCell > -> Toggle] > > i save, restart, and blow up. (something about a syntax error on line > 52 of the file that reads \tItem[KeyEvent[\".) > > my intuition of what's wrong is that i stole the InitializationCell -> > Toggle bit from MenuSetup.tr in the same directory and that a rule like > that won't do as the second argument to Item[ ]; my guess is that i'll > need a three-part FontEndToken[ ] object to pass into the second > position of Item[ ], but i haven't a clue as to what the correct > structure for that FrontEndToken[ ] would be. > > anyone have any suggestions on formulating an initialization cell > toggle Item[ ] for KeyEventTranslation.tr? I have the following code that creates a button that toggles the init cell status on/off. Note: the code below is a snippet from notebook that I used to create a palette that includes the Init Cell button in question. ButtonBox[ RowBox[{"Toggle", " ", RowBox[{"Init", " ", "Cell"}]}], ButtonFunction:>FrontEndExecute[ { FrontEnd`FrontEndToken[ SelectedNotebook[ ], "InitializationCell", "Toggle"]}], ButtonEvaluator->None, Active->True, ButtonStyle->"PaletteButton", ButtonFrame->"DialogBox"] Lee