Re: button to emulate Shift-Enter
- To: mathgroup at smc.vnet.net
- Subject: [mg49988] Re: [mg49968] button to emulate Shift-Enter
- From: "Ingolf Dahl" <ingolf.dahl at telia.com>
- Date: Mon, 9 Aug 2004 04:29:28 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
Here is one way to get a Shift+Enter button Evaluate: ButtonBox["Shift+Enter", ButtonFunction :> FrontEndExecute[SetSelectedNotebook[InputNotebook[]]; FrontEndToken["EvaluateCells"]], ButtonEvaluator -> None, Active -> True] // DisplayForm Select it, use "Evaluate Palette from Selection", close and save it to some FrontEnd\Palettes directory beneath the $UserBaseDirectory or $BaseDirectory. The resulting notebook is included below. Best regards Ingolf Dahl Sweden >-----Original Message----- >From: Murray Eisenberg [mailto:murray at math.umass.edu] To: mathgroup at smc.vnet.net >Sent: Sunday, August 08, 2004 11:38 >To: mathgroup at smc.vnet.net >Subject: [mg49988] [mg49968] button to emulate Shift-Enter > > >How would I create a button, for a one-button palette, that when clicked >by the mouse, sends the Shift-Enter key combination to the active >notebook (i.e., not the palette notebook) for the cell in which the >cursor was positioned in that active notebook? > >Explanation: For presentations, I want to be able to use a >remote-control mouse device that cannot transmit any keystrokes but can >move the mouse around the screen and transmit a left-click (or >right-click). So my thought is to have the sort of button, as a >sepaately floating palette, that I could click so as to emulate pressing >Shift-Enter in the target notebook being presented. > >-- >Murray Eisenberg murray at math.umass.edu >Mathematics & Statistics Dept. >Lederle Graduate Research Tower phone 413 549-1020 (H) >University of Massachusetts 413 545-2859 (W) >710 North Pleasant Street fax 413 545-1801 >Amherst, MA 01003-9305 > Here below the palette follows as Mathematica Notebook: (************** Content-type: application/mathematica ************** CreatedBy='Mathematica 5.0' Mathematica-Compatible Notebook This notebook can be used with any Mathematica-compatible application, such as Mathematica, MathReader or Publicon. The data for the notebook starts with the line containing stars above. To get the notebook into a Mathematica-compatible application, do one of the following: * Save the data starting with the line of stars above into a file with a name ending in .nb, then open the file inside the application; * Copy the data starting with the line of stars above to the clipboard, then use the Paste menu command inside the application. Data for notebooks contains only printable 7-bit ASCII and can be sent directly in email or through ftp in text mode. Newlines can be CR, LF or CRLF (Unix, Macintosh or MS-DOS style). NOTE: If you modify the data for this notebook not in a Mathematica- compatible application, you must delete the line below containing the word CacheID, otherwise Mathematica-compatible applications may try to use invalid cache data. For more information on notebooks and Mathematica-compatible applications, contact Wolfram Research: web: http://www.wolfram.com email: info at wolfram.com phone: +1-217-398-0700 (U.S.) Notebook reader applications are available free of charge from Wolfram Research. *******************************************************************) (*CacheID: 232*) (*NotebookFileLineBreakTest NotebookFileLineBreakTest*) (*NotebookOptionsPosition[ 3073, 89]*) (*NotebookOutlinePosition[ 4217, 131]*) (* CellTagsIndexPosition[ 4173, 127]*) (*WindowFrame->Palette*) Notebook[{ Cell[BoxData[ TagBox[ ButtonBox[\(Shift + Enter\), ButtonFunction:>FrontEndExecute[ CompoundExpression[ SetSelectedNotebook[ InputNotebook[ ]], FrontEndToken[ "EvaluateCells"]]], ButtonEvaluator->None, Active->True], DisplayForm]], NotebookDefault, CellMargins->{{Inherited, Inherited}, {7, Inherited}}, CellBracketOptions->{"Color"->RGBColor[0.269993, 0.308507, 0.6]}, CellEditDuplicate->True, CellGroupingRules->"OutputGrouping", CellHorizontalScrolling->True, PageBreakAbove->True, PageBreakWithin->False, GroupPageBreakWithin->False, GeneratedCell->True, CellAutoOverwrite->True, CellLabelMargins->{{12, Inherited}, {Inherited, Inherited}}, DefaultFormatType->DefaultOutputFormatType, InputAutoReplacements->{ "->"->"\[Rule]", ":>"->"\[RuleDelayed]", "<="->"\[LessEqual]", ">="->"\[GreaterEqual]", "!="->"\[NotEqual]", "=="->"\[Equal]", Inherited}, "TwoByteSyntaxCharacterAutoReplacement"->True, HyphenationOptions->{"HyphenationCharacter"->"\[Continuation]"}, LineSpacing->{1.25, 0}, AutoItalicWords->{}, LanguageCategory->None, FormatType->InputForm, ScriptMinSize->9, CounterIncrements->"Output", StyleMenuListing->None, FontFamily->"Courier"] }, FrontEndVersion->"5.0 for Microsoft Windows", ScreenRectangle->{{0, 1280}, {0, 923}}, ClosingAutoSave->True, Editable->False, WindowToolbars->{}, Selectable->True, PageWidth->361, WindowSize->{Fit, Fit}, WindowMargins->{{5, Automatic}, {Automatic, 69}}, WindowFrame->"Palette", WindowElements->{}, WindowFrameElements->"CloseBox", WindowClickSelect->False, ScrollingOptions->{"PagewiseScrolling"->True, "VerticalScrollRange"->Fit}, ShowCellBracket->False, CellMargins->{{0, 0}, {Inherited, 0}}, Active->True, CellOpen->True, ShowCellLabel->False, ShowCellTags->False, ImageMargins->{{0, Inherited}, {Inherited, 0}}, Background->GrayLevel[1], Magnification->1 ] (******************************************************************* Cached data follows. If you edit this Notebook file directly, not using Mathematica, you must remove the line containing CacheID at the top of the file. The cache data will then be recreated when you save this file from within Mathematica. *******************************************************************) (*CellTagsOutline CellTagsIndex->{} *) (*CellTagsIndex CellTagsIndex->{} *) (*NotebookFileOutline Notebook[{ Cell[1755, 51, 1314, 36, 27, NotebookDefault, CellGroupingRules->"OutputGrouping", PageBreakAbove->True, PageBreakWithin->False, CounterIncrements->"Output"] } ] *) (******************************************************************* End of Mathematica Notebook file. *******************************************************************)