Next: IV. Appendix
Up: III. System Integration
Previous: 25. TkSGML System integration
  Contents
  Index
Sgml widgets make use of Tk's widget class system. The class name for
SGML widgets is Sgml, distinguished by the uppercase first
letter from the name of the widget command sgml.
Like for any other Tk widget class, class bindings can be
established for all Sgml widgets. The default bindings come from the
file sgml.tcl that has been installed in your tk_library
directory.
26.1 Default Bindings
The sgml widget automatically creates class bindings for widgets that
give them the following default behavior.
In the descriptions below, ``word'' refers to a contiguous group
of letters, entities, digits, or ``_'' characters, or any single
character other than these.
- Clicking mouse button 1 positions the insertion cursor
just before the character underneath the mouse cursor, sets the
input focus to this widget, and clears any selection in the widget.
Dragging with mouse button 1 strokes out a selection between
the insertion cursor and the character under the mouse. When the end
of the selection reaches an element tag, the selection is extended to
cover the whole element.
- Double-clicking with mouse button 1 selects the word under the mouse
and positions the insertion cursor at the beginning of the word.
Dragging after a double click will stroke out a selection consisting
of whole words. When the end of the selection reaches an element tag,
the selection is extended to cover the whole element.
- Triple-clicking with mouse button 1 selects the line under the mouse
and positions the insertion cursor at the beginning of the line.
Dragging after a triple click will stroke out a selection consisting
of whole lines. When the end of the selection reaches an element tag,
the selection is extended to cover the whole element.
- The ends of the selection can be adjusted by dragging with mouse
button 1 while the Shift key is down; this will adjust the end
of the selection that was nearest to the mouse cursor when button
1 was pressed.
If the button is double-clicked before dragging then the selection
will be adjusted in units of whole words; if it is triple-clicked
then the selection will be adjusted in units of whole lines.
- Clicking mouse button 1 with the Control key down will reposition the
insertion cursor without affecting the selection.
- If any normal printing characters are typed, they are
inserted at the point of the insertion cursor.
- The view in the widget can be adjusted by dragging with mouse button 2.
If mouse button 2 is clicked without moving the mouse, the selection
is copied into the text at the position of the mouse cursor.
The Insert key also inserts the selection, but at the position of
the insertion cursor.
- If the mouse is dragged out of the widget
while button 1 is pressed, the entry will automatically scroll to
make more text visible (if there is more text off-screen on the side
where the mouse left the window).
- The Left and Right keys move the insertion cursor one character to the
left or right; they also clear any selection in the text.
If Left or Right is typed with the Shift key down, then the insertion
cursor moves and the selection is extended to include the new character.
Control-Left and Control-Right move the insertion cursor by words, and
Control-Shift-Left and Control-Shift-Right move the insertion cursor
by words and also extend the selection.
Control-b and Control-f behave the same as Left and Right, respectively.
Meta-b and Meta-f behave the same as Control-Left and Control-Right,
respectively.
- The Up and Down keys move the insertion cursor one line up or
down and clear any selection in the text.
If Up or Right is typed with the Shift key down, then the insertion
cursor moves and the selection is extended to include the new character.
Control-Up and Control-Down move the insertion cursor by paragraphs (groups
of lines separated by blank lines), and
Control-Shift-Up and Control-Shift-Down move the insertion cursor
by paragraphs and also extend the selection.
Control-p and Control-n behave the same as Up and Down, respectively.
- The Next and Prior keys move the insertion cursor forward or backwards
by one screenful and clear any selection in the text.
If the Shift key is held down while Next or Prior is typed, then
the selection is extended to include the new character.
Control-v moves the view down one screenful without moving the
insertion cursor or adjusting the selection.
- Control-Next and Control-Prior scroll the view right or left by one page
without moving the insertion cursor or affecting the selection.
- Home and Control-a move the insertion cursor to the
beginning of its line and clear any selection in the widget.
Shift-Home moves the insertion cursor to the beginning of the line
and also extends the selection to that point.
- End and Control-e move the insertion cursor to the
end of the line and clear any selection in the widget.
Shift-End moves the cursor to the end of the line and extends the selection
to that point.
- Control-Home and Meta-
move the insertion cursor to the beginning of
the text and clear any selection in the widget.
Control-Shift-Home moves the insertion cursor to the beginning of the text
and also extends the selection to that point. Since the selection will
be extended to completely cover any selected elements, this means that
the whole document will be selected.
- Control-End and Meta-
move the insertion cursor to the end of the
text and clear any selection in the widget.
Control-Shift-End moves the cursor to the end of the text and extends
the selection to that point. Since the selection will
be extended to completely cover any selected elements, this means that
the whole document will be selected.
- The Select key and Control-Space set the selection anchor to the position
of the insertion cursor. They don't affect the current selection.
Shift-Select and Control-Shift-Space adjust the selection to the
current position of the insertion cursor, selecting from the anchor
to the insertion cursor if there was not any selection previously.
- Control-/ selects the entire contents of the widget.
- Control-
clears any selection in the widget.
- The F16 key (labelled Copy on many Sun workstations) or Meta-w
copies the selection in the widget to the clipboard, if there is a selection.
- The F20 key (labelled Cut on many Sun workstations) or Control-w
copies the selection in the widget to the clipboard and deletes
the selection.
If there is no selection in the widget then these keys have no effect.
- The F18 key (labelled Paste on many Sun workstations) or Control-y
inserts the contents of the clipboard at the position of the
insertion cursor.
- The Delete key deletes the selection, if there is one in the widget.
If there is no selection, it deletes the character to the right of
the insertion cursor.
- Backspace and Control-h delete the selection, if there is one
in the widget.
If there is no selection, they delete the character to the left of
the insertion cursor.
- Control-d deletes the character to the right of the insertion cursor.
- Meta-d deletes the word to the right of the insertion cursor.
- Control-k deletes from the insertion cursor to the end of its line;
if the insertion cursor is already at the end of a line, then
Control-k deletes the newline character.
- Control-o opens a new line by inserting a newline character in
front of the insertion cursor without moving the insertion cursor.
- Meta-backspace and Meta-Delete delete the word to the left of the
insertion cursor.
- Control-x deletes whatever is selected in the text widget.
- Control-t reverses the order of the two characters to the right of
the insertion cursor.
If the widget is disabled using the -state option, then its
view can still be adjusted and text can still be selected, but no
insertion cursor will be displayed and no text modifications will take
place.
The behavior of sgml widgets can be changed by defining new bindings
for individual widgets or by redefining the class bindings. Please
refer to the documentation for the Tk bind command for details
on how to change bindings.
Next: IV. Appendix
Up: III. System Integration
Previous: 25. TkSGML System integration
  Contents
  Index
TkSGML Reference Manual