1ntextBindings(n)   Alternative Bindings for the Text Widget   ntextBindings(n)
2
3
4
5______________________________________________________________________________
6

NAME

8       ntextBindings - Alternative Bindings for the Text Widget
9

SYNOPSIS

11       package require Tcl  8.5
12
13       package require Tk  8.5
14
15       package require ntext  ?0.81?
16
17______________________________________________________________________________
18

DESCRIPTION

20       The  ntext  package  provides a binding tag named Ntext for use by text
21       widgets in place of the default Text binding tag.
22
23       The Text binding tag provides around one hundred bindings to  the  text
24       widget (the exact number is platform-dependent).  A few of these behave
25       in a way that is different from most contemporary text-editing applica‐
26       tions.  Ntext aims to provide more familiar behaviour.
27
28       Features  of the Ntext bindings that differ from the default Text bind‐
29       ings:
30
31       ·      Clicking near the end of a (logical) line moves  the  cursor  to
32              the  end  of that line (not the start of the next line).  If the
33              widget is in -wrap word mode, the same rule applies  to  display
34              lines.
35
36       ·      Double-clicking  or  dragging  near  the end of a (logical) line
37              will highlight/select characters from the end of that line  (not
38              the  next line, or the region at the end of the line where there
39              are no characters).  If the widget is in -wrap  word  mode,  the
40              same rule applies to display lines.
41
42       ·      The  End  key implements "Smart End" (successive keypresses move
43              the cursor to the end of the display line, then to  the  end  of
44              the  logical  line); the Home key implements "Smart Home" (which
45              is similar to "Smart End", but also toggles between  the  begin‐
46              ning and end of leading whitespace).
47
48       ·      When  a  selection exists, a <<Paste>> operation (e.g. <Control-
49              v>) overwrites the selection (as most editors do), and  does  so
50              on all platforms.
51
52       ·      The  <Insert> key toggles between "Insert" and "Overwrite" modes
53              for keyboard input.  (In contrast, the  Text  binding  tag  uses
54              <Insert>  as  a  method to paste the "primary selection", a task
55              that can be accomplished instead by mouse middle-click.)
56
57       ·      The <Escape> key clears the selection.
58
59       ·      Selecting with <Shift-Button1> selects from the  previous  posi‐
60              tion  of  the  insertion  cursor.  (In the Text binding tag, the
61              selection anchor may be  the  position  of  the  previous  mouse
62              click.)
63
64       ·      <Shift-Button1>  operations  do  not alter the selection anchor.
65              (In the Text binding tag, they do.)
66
67       ·      By default, the Ntext binding tag does not  provide  several  of
68              the Control-key bindings supplied by the Text binding tag.  Mod‐
69              ern keyboards offer alternatives, such as cursor keys for  navi‐
70              gation;  modern  applications often use the Control-key bindings
71              for other purposes (e.g. <Control-p> for "print").
72
73       The last three cases, the behavior of Text is often  useful,  so  Ntext
74       gives  you  the option of retaining it, by setting variables defined in
75       the ::ntext namespace to 1 (instead of their  default  0).   Explaining
76       these features in more detail:
77
78       ·      If the mouse is clicked at position A, then the keyboard is used
79              to move the cursor to B, then shift is held down, and the  mouse
80              is  clicked  at C: the Text binding tag gives a selection from A
81              to C; the Ntext gives a selection from B  to  C.   If  you  want
82              Ntext to behave like Text in this respect, set ::ntext::classic‐
83              MouseSelect to 1.
84
85       ·      The Text binding tag allows successive  <Shift-Button-1>  events
86              to  change  both  ends of the selection, by moving the selection
87              anchor to the end of  the  selection  furthest  from  the  mouse
88              click.   Instead,  the  Ntext  binding tag fixes the anchor, and
89              multiple Shift-Button-1 events can only  move  the  non-anchored
90              end  of the selection.  If you want Ntext to behave like Text in
91              this respect, set ::ntext::classicAnchor to 1.  In both Text and
92              Ntext,  keyboard  navigation with the Shift key held down alters
93              the selection and keeps the selection anchor fixed.
94
95       ·      The following "extra" Text bindings are switched off by default,
96              but  can be activated in Ntext by setting ::ntext::classicExtras
97              to 1: <Control-a>, <Control-b>, <Control-d>, <Control-e>,  <Con‐
98              trol-f>,  <Control-h>,  <Control-i>,  <Control-k>,  <Control-n>,
99              <Control-o>, <Control-p>,  <Control-t>,  <Control-space>,  <Con‐
100              trol-Shift-space>.
101

CONFIGURATION OPTIONS

103       Ntext  provides  alternatives  to a number of behaviours of the classic
104       Text binding tag.  Where there is an option,  the  Ntext  behaviour  is
105       switched  on  by  default, except for display-line indentation which is
106       discussed on a separate page at ntextIndent.
107
108       The behaviour of Ntext may be configured  application-wide  by  setting
109       the values of a number of namespace variables:
110
111       ::ntext::classicAnchor
112
113       ·      0  -  (default  value)  selects Ntext behaviour, i.e. the anchor
114              point is fixed
115
116       ·      1 - selects classic Text behaviour, i.e.  the  anchor  point  is
117              variable
118
119       ::ntext::classicExtras
120
121       ·      0  -  (default  value)  selects  Ntext  behaviour,  i.e. several
122              "extra" Text bindings are de-activated
123
124       ·      1 - selects classic Text behaviour, i.e. the "extra" Text  bind‐
125              ings are activated
126
127       ::ntext::classicMouseSelect
128
129       ·      0  -  (default  value)  selects Ntext behaviour, i.e. the anchor
130              point for mouse selection operations is moved by keyboard  navi‐
131              gation
132
133       ·      1 - selects classic Text behaviour
134
135       ::ntext::overwrite
136
137       ·      0  - (initial value) text typed at the keyboard is inserted into
138              the widget
139
140       ·      1 - text typed at the keyboard overwrites text  already  in  the
141              widget
142
143       ·      The value is toggled by the Insert key.
144

EXAMPLE

146       To use Ntext but keep classic Text 's variable-anchor feature:
147
148
149              package require ntext
150              text .t
151              set ::ntext::classicAnchor 1
152              bindtags .t {.t Ntext . all}
153
154

SEE ALSO

156       bindtags, ntext, ntextIndent, text
157

KEYWORDS

159       bindtags, text
160
161
162
163ntext                                0.81                     ntextBindings(n)
Impressum