Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

button to emulate Shift-Enter

13 views
Skip to first unread message

Murray Eisenberg

unread,
Aug 8, 2004, 5:55:33 AM8/8/04
to
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 mur...@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

Selwyn Hollis

unread,
Aug 9, 2004, 4:34:14 AM8/9/04
to

On Aug 8, 2004, at 5:37 AM, Murray Eisenberg wrote:

> 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


Hi Murray,

Paste and then enter the following. Then select the output cell and
choose Generate Palette form Selection from your File menu.

ButtonBox[
StyleBox[" Evaluate ", FontFamily->"Helvetica",
FontWeight->"Bold", FontColor->RGBColor[0.75,0,0]],
ButtonFunction:>(CompoundExpression[
FrontEndTokenExecute["EvaluateNextCell"],
FrontEndTokenExecute["EvaluateNextCell"]]&),
ButtonEvaluator->Automatic, ButtonMinHeight->1.5,
Background->GrayLevel[0.9]]//DisplayForm


Regards,

-----
Selwyn Hollis
http://www.appliedsymbols.com
(edit reply-to to reply)

Murray Eisenberg

unread,
Aug 9, 2004, 4:36:16 AM8/9/04
to
OK, that makes the desired palette, thanks.

BUT: How do I save it? I seem to recall I need to use the Option
Inspector to make it Editable. But I cannot even seem to make the now
free-floating, single-button palette to be active (with its
"Untitled..." title bar hightlighted) without having another notebook
open, and in that case Option Inspector refers to that other notebook,
not the palette notebook.

I have the terrible feeling I've asked this before, but I cannot locate
the answer.

--

DrBob

unread,
Aug 9, 2004, 4:38:19 AM8/9/04
to
I can't tell you how to do that, but you CAN select a cell, right click, and select Evaluate Cells, without any keystrokes.

Bobby

On Sun, 8 Aug 2004 05:37:55 -0400 (EDT), Murray Eisenberg <mur...@math.umass.edu> wrote:

> 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.
>

--
Dr...@bigfoot.com
www.eclecticdreams.net

Murray Eisenberg

unread,
Aug 9, 2004, 4:39:23 AM8/9/04
to
Yes, certainly. But I want to try the button approach, too, to see
which approach will be quicker.

DrBob wrote:

--

Ingolf Dahl

unread,
Aug 9, 2004, 4:43:34 AM8/9/04
to
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:mur...@math.umass.edu]
>Sent: Sunday, August 08, 2004 11:38
>To: math...@smc.vnet.net
>Subject: 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 mur...@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: in...@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.
*******************************************************************)

DrBob

unread,
Aug 10, 2004, 6:04:32 AM8/10/04
to
Close the palette (or Mathematica) and you'll get a dialog asking whether you want to save the palette.

Bobby

On Mon, 9 Aug 2004 04:29:19 -0400 (EDT), Murray Eisenberg <mur...@math.umass.edu> wrote:

> OK, that makes the desired palette, thanks.
>
> BUT: How do I save it? I seem to recall I need to use the Option
> Inspector to make it Editable. But I cannot even seem to make the now
> free-floating, single-button palette to be active (with its
> "Untitled..." title bar hightlighted) without having another notebook
> open, and in that case Option Inspector refers to that other notebook,
> not the palette notebook.
>
> I have the terrible feeling I've asked this before, but I cannot locate
> the answer.
>
> Selwyn Hollis wrote:
>>
>> On Aug 8, 2004, at 5:37 AM, Murray Eisenberg wrote:
>>

>>> 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
>>
>>
>>

>> Hi Murray,
>>
>> Paste and then enter the following. Then select the output cell and
>> choose Generate Palette form Selection from your File menu.
>>
>> ButtonBox[
>> StyleBox[" Evaluate ", FontFamily->"Helvetica",
>> FontWeight->"Bold", FontColor->RGBColor[0.75,0,0]],
>> ButtonFunction:>(CompoundExpression[
>> FrontEndTokenExecute["EvaluateNextCell"],
>> FrontEndTokenExecute["EvaluateNextCell"]]&),
>> ButtonEvaluator->Automatic, ButtonMinHeight->1.5,
>> Background->GrayLevel[0.9]]//DisplayForm
>>
>>
>> Regards,
>>
>> -----
>> Selwyn Hollis
>> http://www.appliedsymbols.com
>> (edit reply-to to reply)
>>
>>
>

--
Dr...@bigfoot.com
www.eclecticdreams.net

0 new messages