# Mouse Bindings

The jstools applications support the following operations with the mouse in text windows and text entry fields:

* Clicking mouse button 1 moves the insertion point. If you've chosen `Typing replaces selection' on the Global Preferences panel, it also clears the selection.

* Clicking mouse button 1 with the Control key pressed moves the insertion point, but doesn't clear the selection. (This doesn't work in oneline text entry fields.)

* Dragging the mouse with mouse button 1 depressed selects the text indicated. Under Tk4.0 or later, you can drag the mouse off the edge of the window, and the text will scroll to allow you to select text that was initially off the window.

* Doubleclicking with mouse button 1 lets you select text by words. (The definition of a word is slightly different between text windows and entry fields.)

* Tripleclicking with mouse button 1 lets you select entire lines.

* Clicking mouse button 2 pastes the current selection at the insertion point. It also sets the input focus, so text you type after will be inserted after the pasted text.

* Dragging with mouse button 2 causes the contents of the window to scroll quickly; it's an alternative to using a scrollbar.

Mouse button 3 is reserved for use by individual applications (i.e., it may do different things in different applications).

## Thanks

Thanks to Tom Phelps `<phelps@cs.berkeley.edu>` for the procedures that allow the middle button to paste (on a click) as well as scroll (on a drag).

Thanks to Paul Raines `<raines@cgibm1.slac.stanford.edu>` for the procedures that allow scrolling during a selection. (Actually, I'm not using much of this code any more now that Tk 4.0 provides similar features.)

``