Text Bindings

   

Practical Programming in Tcl & Tk, Third Edition
By Brent B. Welch

Table of Contents
Chapter 33.  The Text Widget


There is an extensive set of default bindings for text widgets. In general, the commands that move the insertion cursor also clear the selection. Often you can hold the Shift key down to extend the selection, or hold the Control key down to move the insertion cursor without affecting the selection. Table 33-8 lists the default bindings for the text widget:

Table 33-8. Bindings for the text widget.
<Any-Key>Inserts normal printing characters.
<Button-1>Sets the insert point, clears the selection, sets focus.
<Control-Button-1>Sets the insert point without affecting the selection.
<B1-Motion>Sweeps out a selection from the insert point.
<Double-Button-1>Selects the word under the mouse.
<Triple-Button-1>Selects the line under the mouse.
<Shift-Button-1>Adjusts the end of selection closest to the mouse.
<Shift-B1-Motion>Continues to adjust the selection.
<Button-2>Pastes the selection, or set the scrolling anchor.
<B2-Motion>Scrolls the window.
<Key-Left> <Control-b>Moves the cursor left one character and clears the selection.
<Shift-Left>Moves the cursor and extend the selection.
<Control-Left>Moves the cursor by words. Clears the selection.
<Control-Shift-Left>Moves the cursor by words. Extends selection.
<Key-Right> <Control-f>Right bindings are analogous to Left bindings.
<Meta-b> <Meta-f>Same as <Control-Left>, <Control-Right>.
<Key-Up> <Control-p>Moves the cursor up one line. Clears the selection.
<Shift-Up>Moves the cursor up one line. Extends the selection.
<Control-Up>Moves the cursor up by paragraphs, which are a group of lines separated by a blank line.
<Control-Shift-Up>Moves the cursor up by paragraph. Extends the selection.
<Key-Down> <Control-n>All Down bindings are analogous to Up bindings.
<Next> <Prior>Moves the cursor by one screen. Clears the selection.
<Shift-Next> <Shift-Prior>Moves the cursor by one screen. Extends the selection.
<Home> <Control-a>Moves the cursor to line start. Clears the selection.
<Shift-Home>Moves the cursor to line start. Extends the selection.
<End> <Control-e>Moves the cursor to line end. Clears the selection.
<Shift-End>Moves the cursor to line end. Extends the selection.
<Control-Home> <Meta-less>Moves the cursor to the beginning of text. Clears the selection.
<Control-End> <Meta-greater>Moves the cursor to the end of text. Clears the selection.
<Select> <Control-space>Sets the selection anchor to the position of the cursor.
<Shift-Select> <Control-Shift-space>Adjusts the selection to the position of the cursor.
<Control-slash>Selects everything in the text widget.
<Control-backslash>Clears the selection.
<Delete>Deletes the selection, if any. Otherwise deletes the character to the right of the cursor.
<BackSpace> <Control-h>Deletes the selection, if any. Otherwise deletes the character to the left of the cursor.
<Control-d>Deletes character to the right of the cursor.
<Meta-d>Deletes word to the right of the cursor.
<Control-k>Deletes from cursor to end of the line. If you are at the end of line, delete the newline character.
<Control-o>Inserts a newline but does not advance the cursor.
<Meta-Delete> <Meta-BackSpace>Deletes the word to the left of the cursor.
<Control-t>Transposes the characters on either side of the cursor.
<<Copy>> <Meta-w>Copies the selection to the clipboard.
<<Cut>> <Control-w>Cuts the selection and saves it on the clipboard.
<<Paste>> <Control-y>Pastes from the clipboard.


       
    Top
     



    Practical Programming in Tcl and Tk
    Practical Programming in Tcl and Tk (4th Edition)
    ISBN: 0130385603
    EAN: 2147483647
    Year: 1999
    Pages: 478

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net