NtextBindings

| #### Bindings in the Ntext Binding Tag This document is out of date: it applies to ntext 0.81, and early versions of Tk 8.5. Red indicates differences from Text; grey indicates things removed from Text The page on the Text bindings is more reliable; this page has the same information about "Text", but might need a little more grey and red ink to properly describe the Ntext bindings. Also, the page on the Text bindings has Tables 2,3,5,6, which are the same for both classes. The "Ntext" binding tag has 97 bindings in X11, 108 in OS X, 95 in Windows (Table 1): 5 more bindings than the "Text" binding tag. In addition, several "real events" are mapped to "virtual events" that are bound in the "Ntext" binding tag (Table 2). Table 1: List of Bindings Column Headings Event is the event "sequence" specified in the bind command Type is either "keyboard" or "mouse" (either may include keyboard modifiers), or "configure"; other types of event are not bound in the Ntext binding tag The next six columns describe the effects of the binding, in eight categories. The columns are: Navigation - a change in the position of the insert mark ("cursor"), other than to accommodate insertion or removal of text at the cursor Text - a change in the text content of the widget Selection - effect on the selection Focus - changes in keyboard focus Undo Stack - the insertion of separators, and changes to the stack itself (other than the default, i.e. recording the modifications to the widget) Other - other effects are scrolling changes to the clipboard contents 'break' commands changes to selection and scroll view when the mouse pointer leaves the widget while Button 1 is pressed initialization for subsequent events The next two columns give further information on the effects of the binding: Conditions - if the conditions stated in this column are not satisfied, the binding has no effect. (Information in this column that is not a condition is given in italics and brackets.) Description - may be provided in an attempt to clarify the effects of the binding Windowing System Specific - availability on different windowing systems - Tk may not provide certain bindings on all windowing systems, and even if it does, the windowing system may intercept the event and not pass it on to the application Abbreviations used in Table 1: "DSE" = "delete selection if it exists" "DSEC" = "delete selection if it exists and if the insert mark is inside the selection or at its boundaries" "blocks" = "the existence of this binding prevents the event from being handled by the binding for" "ignore sel[ection]" means that the selection is not automatically cancelled or overwritten, but its contents may be changed if the alteration to the text lies within the selection boundaries; this is the default (i.e. applies if the table cell is empty) "Std Kbd Navigation" (standard keyboard navigation) means navigation, combined with changing the selection if the event includes the Shift modifier, or cancelling the selection and inserting a separator on the undo stack if the event does not include the Shift modifier "(a)", "(b)" and "x2 (c)", in the Undo Stack column, refer to the placement of autoseparators (note that if a separator is already present at the top of the undo stack another will not be inserted): "(a)" is a single autoseparator that is placed in order to split keyboard-entered text into lines "(b)" is a single autoseparator that is placed in order to record movement of the insert mark: the purpose is to separate changes made to the text in different places "x2 (c)" is two autoseparators that are placed before and after the change to the text, in order to make that change atomic In the Focus column, "take" means "take keyboard focus for the widget"; "move" means "keyboard focus is moved to another widget" "NSM" = "not strict Motif", meaning that the variable ::tk_strictMotif is set to boolean false. (For convenience, all consequences of "NSM" are listed in the Conditions column, but information that is not a condition is given in italics and brackets.) "CE" = "Classic Extras", meaning that the variable ::ntext::classicExtras is set to boolean true. ("CE" has no other consequences.) "preceded by" - does not necessarily mean "immediately preceded by", for example a series of events might be <Button-1>, <Double-Button-1>, <Double-Button-1>. "EOL" = "End Of Line", really means "End of Logical Line", not end of display line File: lib/tk8.5/text.tcl
Event | Type | Navigation | Text | Selection | Focus | Undo Stack | Other | Description | Conditions | Windowing System Specific
<Key> | Keyboard |  | Y | DSEC |  | if DSEC or overwrite, then x2 (c) |  | DSEC, then insert or overwrite the keypress character into the widget; overwrite if switched on by <Insert> and if insert mark is not at EOL | widget is not disabled and key is one that inserts text |
<Key-BackSpace> | Keyboard |  | Y | DSE |  |  |  | DSE, else delete prev char |  |
<Key-Delete> | Keyboard |  | Y | DSE |  |  |  | DSE, else delete next char |  |
<Key-Return> | Keyboard |  | Y | DSEC |  | if DSEC x2 (c), else (a) |  | DSEC, then insert newline, add autoseparator | widget is not disabled |
<Key-Tab> | Keyboard |  | Y | DSEC | take@ | if DSEC x2 (c) | break to prevent the binding tag "all" from changing the focus | DSEC and insert tab, then take focus, then break | widget is not disabled |
<Shift-Key-Tab> | Keyboard |  |  |  |  |  | break to prevent the binding tag "all" from changing the focus | no action except break; blocks <Key-Tab> note that your "Shift Tab" key probably has a different name and is not covered by this binding but by <<PrevWindow>>: see Tables 5, 6 below. |  |
<Control-Key-Tab> | Keyboard |  |  |  | move |  |  | move focus to another widget |  | intercepted by KDE
<Control-Shift-Key-Tab> | Keyboard |  |  |  | move |  |  | move focus to another widget |  | intercepted by KDE
<Control-Key> | Keyboard |  |  |  |  |  |  | no action; blocks <Key> |  |
<Alt-Key> | Keyboard |  |  |  |  |  |  | no action; blocks <Key> |  |
<Meta-Key> | Keyboard |  |  |  |  |  |  | no action; blocks <Key> |  |
<Command-KeyPress> | Keyboard |  |  |  |  |  |  | no action; blocks <Key> |  | Aqua only
<Key-Escape> | Keyboard |  |  |  |  |  |  | no action; blocks <Key> |  |
<Key-Escape> | Keyboard |  |  | cancel sel |  | (b) |  | (event is used in Text for a different purpose) |  |
<Key-KP_Enter> | Keyboard |  |  |  |  |  |  | no action; blocks <Key> |  |
<Key-Insert> | Keyboard |  | Y | DSEC |  | if DSEC x2 (c) |  | DSEC, then insert selected text (use with <Control-1>) | widget is not disabled and selection is not empty |
<Key-Insert> | Keyboard |  |  |  |  |  | toggle Insert/Overwrite mode | (event is used in Text for a different purpose) |  |
<Meta-Key-b> | Keyboard | Y |  | cancel sel |  | (b) |  | Std Kbd Navigation; move to previous word-start | NSM |
<Meta-Key-d> | Keyboard |  | Y | ignore sel |  |  |  | delete to next word-start | NSM |
<Meta-Key-f> | Keyboard | Y |  | cancel sel |  | (b) |  | Std Kbd Navigation; move to next word-start | NSM |
<Meta-Key-less> | Keyboard | Y |  | cancel sel |  | (b) |  | Std Kbd Navigation; move to top (1.0) | NSM |
<Meta-Key-greater> | Keyboard | Y |  | cancel sel |  | (b) |  | Std Kbd Navigation; move to bottom (end-1c) | NSM |
<Meta-Key-BackSpace> | Keyboard |  | Y | ignore sel |  |  |  | delete to previous word-start | NSM |
<Meta-Key-Delete> | Keyboard |  | Y | ignore sel |  |  |  | delete to previous word-start | NSM |
<Control-Key-a> | Keyboard | Y |  | cancel sel |  | (b) |  | Std Kbd Navigation; move to display line start | NSM, and CE |
<Control-Key-b> | Keyboard | Y |  | cancel sel |  | (b) |  | Std Kbd Navigation; move -1 char | NSM, and CE |
<Control-Key-d> | Keyboard |  | Y | ignore sel |  |  |  | delete next char | NSM, and CE |
<Control-Key-e> | Keyboard | Y |  | cancel sel |  | (b) |  | Std Kbd Navigation; move to display line end | NSM, and CE |
<Control-Key-f> | Keyboard | Y |  | cancel sel |  | (b) |  | Std Kbd Navigation; move +1 char | NSM, and CE |
<Control-Key-h> | Keyboard |  | Y | ignore sel |  |  |  | Backspace: delete previous char | NSM, and CE, and insert mark not at 1.0 |
<Control-Key-i> | Keyboard |  | Y | DSEC |  | if DSEC x2 (c) |  | DSEC, then insert tab char | CE, and widget is not disabled |
<Control-Key-k> | Keyboard |  | Y | ignore sel |  |  |  | if at EOL, delete EOL; else delete to EOL | NSM, and CE |
<Control-Key-n> | Keyboard | Y |  | cancel sel |  | (b) |  | Std Kbd Navigation; move to next line | NSM, and CE |
<Control-Key-o> | Keyboard |  | Y | ignore sel |  |  |  | insert newline after insert mark | NSM, and CE |
<Control-Key-p> | Keyboard | Y |  | cancel sel |  | (b) |  | Std Kbd Navigation; move to previous line | NSM, and CE |
<Control-Key-t> | Keyboard |  | Y | ignore sel |  | x2 (c) |  | swap chars each side of insert cursor; move cursor +1 char | NSM, and CE, and insert mark not at 1.0 |
<Control-Key-backslash> | Keyboard |  |  | cancel sel |  | (b) |  | Clear Selection |  |
<Control-Key-slash> | Keyboard |  |  | change sel |  |  |  | Select All |  |
<Shift-Key-Select> | Keyboard |  |  | change sel |  |  |  | select from anchor to insert |  |
<Control-Shift-Key-space> | Keyboard |  |  | change sel |  |  |  | select from anchor to insert | CE |
<Key-Select> | Keyboard |  |  | ignore sel; set anchor |  |  |  | set selection anchor |  |
<Control-Key-space> | Keyboard |  |  | ignore sel; set anchor |  |  |  | set selection anchor | CE |
|  |  |  |  |  |  |  | Navigation Events |  |
<Key-Left> | Keyboard | Y |  | cancel sel |  | (b) |  | Std Kbd Navigation |  |
<Key-Right> | Keyboard | Y |  | cancel sel |  | (b) |  | Std Kbd Navigation |  |
<Key-Up> | Keyboard | Y |  | cancel sel |  | (b) |  | Std Kbd Navigation |  |
<Key-Down> | Keyboard | Y |  | cancel sel |  | (b) |  | Std Kbd Navigation |  |
<Shift-Key-Left> | Keyboard | Y |  | change sel |  |  |  | Std Kbd Navigation |  |
<Shift-Key-Right> | Keyboard | Y |  | change sel |  |  |  | Std Kbd Navigation |  |
<Shift-Key-Up> | Keyboard | Y |  | change sel |  |  |  | Std Kbd Navigation |  |
<Shift-Key-Down> | Keyboard | Y |  | change sel |  |  |  | Std Kbd Navigation |  |
<Control-Key-Left> | Keyboard | Y |  | cancel sel |  | (b) |  | Std Kbd Navigation |  |
<Control-Key-Right> | Keyboard | Y |  | cancel sel |  | (b) |  | Std Kbd Navigation |  |
<Control-Key-Up> | Keyboard | Y |  | cancel sel |  | (b) |  | Std Kbd Navigation |  |
<Control-Key-Down> | Keyboard | Y |  | cancel sel |  | (b) |  | Std Kbd Navigation |  |
<Control-Shift-Key-Left> | Keyboard | Y |  | change sel |  |  |  | Std Kbd Navigation |  |
<Control-Shift-Key-Right> | Keyboard | Y |  | change sel |  |  |  | Std Kbd Navigation |  |
<Control-Shift-Key-Up> | Keyboard | Y |  | change sel |  |  |  | Std Kbd Navigation |  |
<Control-Shift-Key-Down> | Keyboard | Y |  | change sel |  |  |  | Std Kbd Navigation |  |
<Key-Home> | Keyboard | Y |  | cancel sel |  | (b) |  | Std Kbd Navigation |  |
<Key-End> | Keyboard | Y |  | cancel sel |  | (b) |  | Std Kbd Navigation |  |
<Control-Key-Home> | Keyboard | Y |  | cancel sel |  | (b) |  | Std Kbd Navigation |  |
<Control-Key-End> | Keyboard | Y |  | cancel sel |  | (b) |  | Std Kbd Navigation |  |
<Shift-Key-Home> | Keyboard | Y |  | change sel |  |  |  | Std Kbd Navigation |  |
<Shift-Key-End> | Keyboard | Y |  | change sel |  |  |  | Std Kbd Navigation |  |
<Control-Shift-Key-Home> | Keyboard | Y |  | change sel |  |  |  | Std Kbd Navigation |  |
<Control-Shift-Key-End> | Keyboard | Y |  | change sel |  |  |  | Std Kbd Navigation |  |
<Key-Next> | Keyboard | Y |  | cancel sel |  | (b) |  | Std Kbd Navigation |  |
<Key-Prior> | Keyboard | Y |  | cancel sel |  | (b) |  | Std Kbd Navigation |  |
<Shift-Key-Next> | Keyboard | Y |  | change sel |  |  |  | Std Kbd Navigation |  |
<Shift-Key-Prior> | Keyboard | Y |  | change sel |  |  |  | Std Kbd Navigation |  |
<Control-Key-Next> | Keyboard |  |  |  |  |  | horizontal scrolling | No navigation (insert cursor is unchanged) |  |
<Control-Key-Prior> | Keyboard |  |  |  |  |  | horizontal scrolling | No navigation (insert cursor is unchanged) |  |
<Option-Left> | Keyboard | Y |  | cancel sel |  | (b) |  | Std Kbd Navigation |  | Aqua Only (Option Key)
<Option-Right> | Keyboard | Y |  | cancel sel |  | (b) |  | Std Kbd Navigation |  | Aqua Only (Option Key)
<Option-Up> | Keyboard | Y |  | cancel sel |  | (b) |  | Std Kbd Navigation |  | Aqua Only (Option Key)
<Option-Down> | Keyboard | Y |  | cancel sel |  | (b) |  | Std Kbd Navigation |  | Aqua Only (Option Key)
<Shift-Option-Left> | Keyboard | Y |  | change sel |  |  |  | Std Kbd Navigation |  | Aqua Only (Option Key)
<Shift-Option-Right> | Keyboard | Y |  | change sel |  |  |  | Std Kbd Navigation |  | Aqua Only (Option Key)
<Shift-Option-Up> | Keyboard | Y |  | change sel |  |  |  | Std Kbd Navigation |  | Aqua Only (Option Key)
<Shift-Option-Down> | Keyboard | Y |  | change sel |  |  |  | Std Kbd Navigation |  | Aqua Only (Option Key)
<Control-v> | Keyboard |  |  |  |  |  | vertical scrolling | No navigation (insert cursor is unchanged) |  | Aqua Only
<<Undo>> | Keyboard | Y | Y | ignore sel |  | x2 (c) (bugfix) move item to redo stack |  | Undo changes back to previous separator | undo activated for the widget |
<<Redo>> | Keyboard | Y | Y | ignore sel |  | move item from redo stack |  | Redo "undone" changes up to the next separator | undo activated for the widget |
<<Cut>> | Keyboard |  | Y | cancel sel |  | x2 (c) | change clipboard | Move text from selection to clipboard | selection not empty |
<<Copy>> | Keyboard |  |  | ignore sel |  |  | change clipboard | Copy text from selection to clipboard | selection not empty |
<<Paste>> | Keyboard |  | Y | DSE |  | x2 (c) |  | Copy text from clipboard to widget. If selection exists, delete it and replace with clipboard text; else insert clipboard text at insert mark. | clipboard not empty |
<<Clear>> | Keyboard |  | Y | DSE |  |  |  | delete selected text |  | Aqua Only*
<<PasteSelection>> | Mouse | Y | Y | ignore sel | take | x2 (c) |  | Mapped to <ButtonRelease-2>. If "strict Motif", or if the mouse pointer has not moved since <Button-2>, then navigate, paste selection, and if widget not disabled take focus. If "not strict Motif" ("NSM"), and if the mouse has moved since <Button-2>, then nothing is done, and instead <B2-Motion> implements ScanDrag. | (N.B. precise action depends on NSM) |
<Button-1> | Mouse | Y |  | cancel sel | take | (b) |  | navigate; if widget not disabled or if platform is windows, take focus |  |
<ButtonRelease-1> | Mouse |  |  |  |  |  | See "Description" | See <B1-Leave> |  |
<B1-Motion> | Mouse | Y |  | change sel |  |  |  |  |  |
<Shift-Button-1> | Mouse | Y |  | change sel |  |  |  |  |  |
<Control-Button-1> | Mouse | Y |  | ignore sel |  | (b) |  |  |  |
<Double-Control-1> | Mouse |  |  |  |  |  |  | (new binding) no action; blocks <Double-Button-1> so that only <Control-Button-1> fires |  |
<Control-B1-Motion> | Mouse |  |  |  |  |  |  | (new binding) no action; blocks <B1-Motion> so that only <Control-Button-1> fires |  |
<B1-Enter> | Mouse |  |  |  |  |  | See "Description" | See <B1-Leave> |  |
<B1-Leave> | Mouse |  |  |  |  |  | See "Description" | Start monitoring the mouse coordinates in order to update the selection range and scroll view of the widget. Do not stop until either <B1-Enter> or <ButtonRelease-1>. |  |
<Double-Button-1> | Mouse | Y |  | change sel |  |  |  | preceded by <Button-1> |  |
<Double-Shift-Button-1> | Mouse |  |  | change sel |  |  |  | preceded by <Shift-Button-1> |  |
<Triple-Button-1> | Mouse | Y |  | change sel |  |  |  | preceded by <Button-1>, <Double-Button-1> |  |
<Triple-Shift-Button-1> | Mouse |  |  | change sel |  |  |  | preceded by <Shift-Button-1>, <Double-Shift-Button-1> |  |
<Quadruple-Button-1> | Mouse |  |  |  |  |  | Housekeeping for multiple Button-1 events | (new binding) preceded by <Button-1>, <Double-Button-1>, <Triple-Button-1> |  |
<Quadruple-Shift-Button-1> | Mouse |  |  |  |  |  | Housekeeping for multiple Button-1 events | (new binding) preceded by <Shift-Button-1>, <Double-Shift-Button-1>, <Triple-Shift-Button-1> |  |
<Button-2> | Mouse |  |  | ignore sel |  |  | See "Description" | Initialization for <ButtonRelease-2> and possible <B2-Motion> events | NSM |
<B2-Motion> | Mouse |  |  | ignore sel |  |  | ScanDrag scrolling | No navigation (insert cursor is unchanged) | NSM |
<Button-4> | Mouse |  |  |  |  |  | vertical scrolling |  | NSM | X11 only - for Mouse Wheel
<Button-5> | Mouse |  |  |  |  |  | vertical scrolling |  | NSM | X11 only - for Mouse Wheel
<MouseWheel> | Mouse |  |  |  |  |  | vertical scrolling |  |  | Not Aqua
<MouseWheel> | Mouse |  |  |  |  |  | vertical scrolling |  |  | Aqua Only
<Option-MouseWheel> | Mouse |  |  |  |  |  | vertical scrolling |  |  | Aqua Only (Option Key)
<Shift-MouseWheel> | Mouse |  |  |  |  |  | horizontal scrolling |  |  | Aqua Only
<Shift-Option-MouseWheel> | Mouse |  |  |  |  |  | horizontal scrolling |  |  | Aqua Only (Option Key)
<Configure> | Configure |  |  |  |  |  | adjust hanging indents | (new binding) | -wrap word mode, and !$classicWrap |
* The virtual event <<Clear>> is provided on all windowing systems, but is used only on Aqua, where it is mapped to the <Clear> key. @ Why does <Key-Tab> take focus? The widget must already have focus to receive the event, so why take it? ??Possibly some platforms respond to <Tab> by moving the focus before passing the event to the application/window that received it - if so, reclaiming the focus would be necessary here. The widget prevents text insertion or deletion if its state is "disabled". However, the widget's bindings still fire, and so the bindings test the widget state, to provide control over operations other than text manipulation - usually changes to focus, and placement of autoseparators. Table 4: Actions that modify the text contents of the widget File: lib/tk8.5/text.tcl - data extracted from Table 1.
Binding | Mapped To | Notes
<Key> |  |
<Key-BackSpace> |  |
<Key-Delete> |  |
<Key-Return> |  |
<Key-Tab> |  |
<Key-Insert> |  | Modifies text in Text bindtag, but not in Ntext
<Meta-Key-d> |  |
<Meta-Key-BackSpace> |  |
<Meta-Key-Delete> |  |
<Control-Key-d> |  |
<Control-Key-h> |  |
<Control-Key-i> |  |
<Control-Key-k> |  |
<Control-Key-o> |  |
<Control-Key-t> |  |
<<Undo>> | windowing-system-dependent: e.g. in X11 <Control-Key-z> (and others) |
<<Redo>> | windowing-system-dependent: e.g. in X11 <Control-Key-Z> |
<<Cut>> | windowing-system-dependent: e.g. in X11 <Control-Key-x> (and others) |
<<Paste>> | windowing-system-dependent: e.g. in X11 <Control-Key-v> (and others) |
<<Clear>> | windowing-system-dependent: Aqua only, <Clear> key |
<<PasteSelection>> | <ButtonRelease-2> |