author | Claus Gittinger <cg@exept.de> |
Wed, 17 Jan 1996 12:18:40 +0100 | |
changeset 291 | 71f4a66b3281 |
parent 290 | f539121393b1 |
child 298 | 932fa5ca44f8 |
permissions | -rw-r--r-- |
0 | 1 |
" |
5 | 2 |
COPYRIGHT (c) 1990 by Claus Gittinger |
59 | 3 |
All Rights Reserved |
0 | 4 |
|
5 |
This software is furnished under a license and may be used |
|
6 |
only in accordance with the terms of that license and with the |
|
7 |
inclusion of the above copyright notice. This software may not |
|
8 |
be provided or otherwise made available to, or used by, any |
|
9 |
other person. No title to or ownership of the software is |
|
10 |
hereby transferred. |
|
11 |
" |
|
12 |
||
13 |
EditTextView subclass:#EditField |
|
261
afcea54bd74e
added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents:
258
diff
changeset
|
14 |
instanceVariableNames:'leaveAction enabled enableAction crAction tabAction converter |
209
7a6db7fac566
dont allow multiline selections in EditField
Claus Gittinger <cg@exept.de>
parents:
192
diff
changeset
|
15 |
leaveKeys immediateAccept acceptOnLeave acceptOnReturn |
7a6db7fac566
dont allow multiline selections in EditField
Claus Gittinger <cg@exept.de>
parents:
192
diff
changeset
|
16 |
lengthLimit entryCompletionBlock passwordCharacter |
290
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
17 |
cursorMovementWhenUpdating enableChannel autoScrollHorizontally' |
261
afcea54bd74e
added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents:
258
diff
changeset
|
18 |
classVariableNames:'DefaultForegroundColor DefaultBackgroundColor |
209
7a6db7fac566
dont allow multiline selections in EditField
Claus Gittinger <cg@exept.de>
parents:
192
diff
changeset
|
19 |
DefaultSelectionForegroundColor DefaultSelectionBackgroundColor |
7a6db7fac566
dont allow multiline selections in EditField
Claus Gittinger <cg@exept.de>
parents:
192
diff
changeset
|
20 |
DefaultFont' |
261
afcea54bd74e
added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents:
258
diff
changeset
|
21 |
poolDictionaries:'' |
afcea54bd74e
added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents:
258
diff
changeset
|
22 |
category:'Views-Text' |
0 | 23 |
! |
24 |
||
19 | 25 |
!EditField class methodsFor:'documentation'! |
26 |
||
38 | 27 |
copyright |
28 |
" |
|
29 |
COPYRIGHT (c) 1990 by Claus Gittinger |
|
59 | 30 |
All Rights Reserved |
38 | 31 |
|
32 |
This software is furnished under a license and may be used |
|
33 |
only in accordance with the terms of that license and with the |
|
34 |
inclusion of the above copyright notice. This software may not |
|
35 |
be provided or otherwise made available to, or used by, any |
|
36 |
other person. No title to or ownership of the software is |
|
37 |
hereby transferred. |
|
38 |
" |
|
39 |
! |
|
40 |
||
19 | 41 |
documentation |
42 |
" |
|
38 | 43 |
an editable text-field. Realized by using an EditTextView, |
44 |
and forcing its size to 1 line - disabling cursor movement |
|
45 |
in the vertical direction. |
|
121 | 46 |
|
290
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
47 |
Basically, an editField is an editor for a single line text, |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
48 |
and provides the usual access protocol as defined in its superClasses |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
49 |
(especially: #contents / #contents:). |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
50 |
|
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
51 |
The above underlying internal mechanism can be used for fields which |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
52 |
are passive; i.e. into which text can be entered and the value (string) |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
53 |
is extracted actively by someone else. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
54 |
|
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
55 |
accepting: |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
56 |
The opposite way to use editFields is to connect them to a model |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
57 |
and let the field notify changes to it. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
58 |
This notification is called ``accepting''. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
59 |
Unless accepted, the models value is not updated from the editFields contents |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
60 |
this default is the normal operation and way things should work, since most |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
61 |
uses of editFields are not interrested in every individual change |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
62 |
(i.e. getting each keyStroke when a long number is entered). |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
63 |
The default behavior is to ``accept'' when either return or a cursorUp/Down |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
64 |
key is pressed in a field. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
65 |
However, the field can setup to accept/not accept on leave, on return |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
66 |
or on each individual key input. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
67 |
See the methods #acceptOnLeave: / #acceptOnReturn: / #immediateAccept. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
68 |
|
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
69 |
In addition, the set of keys which are considered ``leaveKeys'' can be |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
70 |
specified by #leaveKeys: (in case you need keys other than Return, CursorUp/Down). |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
71 |
|
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
72 |
models value vs. field contents: |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
73 |
Although the field internally keeps its contents as some string object, |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
74 |
the application may prefer to think of numbers, floats, yes/no values etc. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
75 |
To support this, a converter may defined, which is responsible for conversion of |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
76 |
strings to/from the models domain value. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
77 |
If present (i.e. nonNil), the converter is asked to convert a string to the models |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
78 |
domain with #readValueFrom:aString and vice versa, a value to a string by #printStringFor:. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
79 |
The PrintConverter class already provides a number of standard conversions, see the examples. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
80 |
To access a converted value directly (i.e. not via the model), use #editValue. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
81 |
|
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
82 |
grouping: |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
83 |
Individual fields do not know about being included in a group. This must be arranged on the |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
84 |
outside, by placing multiple fields into an EnterFieldGroup. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
85 |
This groupObject keeps a reference to one active field, and forwards input from any other |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
86 |
field to the active one. Also have a look at the examples for this. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
87 |
|
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
88 |
input completion: |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
89 |
To support input completion (i.e. filename completion, classname completion etc.), |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
90 |
a completionBlock can be defined which (if non-nil) is evaluated when the completion-key |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
91 |
is pressed and its value is taken as the new field-contents. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
92 |
The physical completion-key is the Tab key (this one cannot be defined by |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
93 |
the keyboardTranslation mechanism, since that would disable the Tab-key on regular text views. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
94 |
|
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
95 |
|
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
96 |
|
121 | 97 |
Instance variables: |
98 |
||
99 |
leaveAction <Block | nil> if non-nil, this is evaluated with |
|
100 |
the key (#Return, #CursorUp etc.) when |
|
101 |
the field is left via keyboard keys. |
|
102 |
(fieldGroups use this to decide which |
|
103 |
field has to be enabled next) |
|
104 |
||
105 |
enabled <Boolean> if false, input is ignored. |
|
106 |
||
125 | 107 |
enableAction <Block | nil> action performed if the field is |
108 |
enabled via an explicit click. |
|
109 |
(this is used by the group to |
|
110 |
set the active field to the clicked upon field) |
|
121 | 111 |
|
112 |
crAction <Block | nil> if non-nil, keyboard input of a cr are not |
|
113 |
handled specially, instead this block is evaluated |
|
114 |
(however, this block can perform additional checks and send |
|
115 |
a #accept then) |
|
116 |
||
117 |
tabAction <Block | nil> if non-nil, keyboard input of a tab character |
|
118 |
is not entered into the text, instead this block |
|
290
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
119 |
is evaluated. Also, no input completion is performed if |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
120 |
tabAction is nonNil. |
121 | 121 |
|
122 |
converter <PrintConverter | nil> if non-nil, this is supposed to convert between |
|
290
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
123 |
the object and its printed representation and vice versa. |
121 | 124 |
Defaults to nil i.e. assume that strings are edited. |
125 |
||
290
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
126 |
leaveKeys <Collection> keys which are interpreted as 'leaving the field' |
122 | 127 |
|
125 | 128 |
immediateAccept <Boolean> if true, every change of the text is immediately |
129 |
forwarded to the model/acceptBlock. If false, |
|
130 |
the changed value is only stored in the model |
|
131 |
if the field is left or accepted. |
|
132 |
Default is false. |
|
122 | 133 |
|
134 |
acceptOnLeave <Boolean> if true, leaving the field (via cursor keys) |
|
135 |
automatically accepts the value into the model. |
|
130 | 136 |
Default is true. |
122 | 137 |
|
138 |
acceptOnReturn <Boolean> if true, leaving the field via return |
|
139 |
automatically accepts the value into the model. |
|
130 | 140 |
Default is true. |
19 | 141 |
" |
120 | 142 |
! |
143 |
||
144 |
examples |
|
145 |
" |
|
122 | 146 |
see more examples in EnterFieldGroup>>examples. |
147 |
||
148 |
||
290
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
149 |
Step-by-step introduction: |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
150 |
|
120 | 151 |
|
290
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
152 |
basic field in some view: |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
153 |
|
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
154 |
|top field| |
120 | 155 |
|
290
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
156 |
top := StandardSystemView new. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
157 |
top extent:200@100. |
120 | 158 |
|
290
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
159 |
field := EditField origin:0.0@0.0 in:top. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
160 |
field width:1.0. 'let its height as-is'. |
120 | 161 |
|
290
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
162 |
top open |
120 | 163 |
|
122 | 164 |
|
125 | 165 |
forward input in topView to the field: |
166 |
(currently, the field does not know this - therefore, |
|
167 |
its been told here ... this may change) |
|
122 | 168 |
|
290
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
169 |
|top field| |
122 | 170 |
|
290
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
171 |
top := StandardSystemView new. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
172 |
top extent:200@100. |
122 | 173 |
|
290
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
174 |
field := EditField origin:0.0@0.0 in:top. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
175 |
field width:1.0. 'let its height as-is'. |
122 | 176 |
|
290
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
177 |
top delegate:(KeyboardForwarder toView:field). |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
178 |
field hasKeyboardFocus:true. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
179 |
top open |
122 | 180 |
|
181 |
||
125 | 182 |
to make it look better: set some inset: |
120 | 183 |
|
290
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
184 |
|top field spacing| |
120 | 185 |
|
290
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
186 |
top := StandardSystemView new. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
187 |
top extent:200@100. |
120 | 188 |
|
290
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
189 |
spacing := View viewSpacing. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
190 |
field := EditField origin:(0.0 @ spacing) in:top. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
191 |
field width:1.0. 'let its height as-is'. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
192 |
field leftInset:spacing; rightInset:spacing. |
120 | 193 |
|
290
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
194 |
top open |
120 | 195 |
|
122 | 196 |
|
120 | 197 |
give it an initial contents: |
198 |
||
290
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
199 |
|top field| |
120 | 200 |
|
290
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
201 |
top := StandardSystemView new. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
202 |
top extent:200@100. |
120 | 203 |
|
290
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
204 |
field := EditField origin:(0.0 @ 0@0) in:top. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
205 |
field width:1.0. |
120 | 206 |
|
290
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
207 |
field editValue:'hello world'. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
208 |
|
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
209 |
top open |
120 | 210 |
|
122 | 211 |
|
125 | 212 |
have it preselected: |
120 | 213 |
|
290
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
214 |
|top field| |
120 | 215 |
|
290
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
216 |
top := StandardSystemView new. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
217 |
top extent:200@100. |
120 | 218 |
|
290
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
219 |
field := EditField origin:(0.0 @ 0.0) in:top. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
220 |
field width:1.0. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
221 |
field editValue:'hello world' selected:true. |
120 | 222 |
|
290
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
223 |
top open |
120 | 224 |
|
122 | 225 |
|
120 | 226 |
have part of it preselected: |
227 |
||
290
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
228 |
|top field| |
120 | 229 |
|
290
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
230 |
top := StandardSystemView new. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
231 |
top extent:200@100. |
120 | 232 |
|
290
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
233 |
field := EditField origin:(0.0 @ 0.0) in:top. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
234 |
field width:1.0. |
120 | 235 |
|
290
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
236 |
field editValue:'hello world'. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
237 |
field selectFromCharacterPosition:1 to:5. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
238 |
|
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
239 |
top open |
120 | 240 |
|
122 | 241 |
|
125 | 242 |
set a size limit: |
243 |
||
290
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
244 |
|top field| |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
245 |
|
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
246 |
top := StandardSystemView new. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
247 |
top extent:200@100. |
261
afcea54bd74e
added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents:
258
diff
changeset
|
248 |
|
290
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
249 |
field := EditField origin:(0.0 @ 0.0) in:top. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
250 |
field width:1.0. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
251 |
field editValue:'hello'. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
252 |
|
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
253 |
field maxChars:8. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
254 |
|
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
255 |
top open |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
256 |
|
261
afcea54bd74e
added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents:
258
diff
changeset
|
257 |
|
290
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
258 |
set a size limit, initial width and stop it from scrolling |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
259 |
notice: you may prefer a constant-pitch font (such as courier): |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
260 |
|
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
261 |
|top field| |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
262 |
|
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
263 |
top := StandardSystemView new. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
264 |
top extent:200@100. |
261
afcea54bd74e
added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents:
258
diff
changeset
|
265 |
|
290
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
266 |
field := EditField origin:(0.0 @ 0.0) in:top. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
267 |
field innerWidth:(field font widthOf:'00000000'). |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
268 |
field editValue:'12345678'. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
269 |
|
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
270 |
field maxChars:8. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
271 |
field autoScroll:false. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
272 |
|
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
273 |
top open |
261
afcea54bd74e
added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents:
258
diff
changeset
|
274 |
|
125 | 275 |
|
261
afcea54bd74e
added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents:
258
diff
changeset
|
276 |
enable / disable: |
afcea54bd74e
added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents:
258
diff
changeset
|
277 |
|
290
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
278 |
|top panel check field ena| |
261
afcea54bd74e
added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents:
258
diff
changeset
|
279 |
|
290
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
280 |
top := StandardSystemView new. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
281 |
top extent:200@100. |
261
afcea54bd74e
added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents:
258
diff
changeset
|
282 |
|
290
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
283 |
panel := VerticalPanelView origin:0.0@0.0 corner:1.0@1.0 in:top. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
284 |
panel horizontalLayout:#leftSpace. |
261
afcea54bd74e
added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents:
258
diff
changeset
|
285 |
|
290
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
286 |
check := CheckBox label:'enable' in:panel. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
287 |
check turnOn. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
288 |
check action:[:onOff | onOff ifTrue:[field enable] ifFalse:[field disable]]. |
261
afcea54bd74e
added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents:
258
diff
changeset
|
289 |
|
290
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
290 |
panel add:(View new height:30). |
125 | 291 |
|
290
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
292 |
field := EditField in:panel. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
293 |
field width:1.0. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
294 |
field editValue:'hello'. |
261
afcea54bd74e
added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents:
258
diff
changeset
|
295 |
|
290
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
296 |
top open |
261
afcea54bd74e
added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents:
258
diff
changeset
|
297 |
|
afcea54bd74e
added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents:
258
diff
changeset
|
298 |
|
afcea54bd74e
added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents:
258
diff
changeset
|
299 |
enable / disable using a channel: |
afcea54bd74e
added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents:
258
diff
changeset
|
300 |
|
290
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
301 |
|top panel check field ena| |
261
afcea54bd74e
added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents:
258
diff
changeset
|
302 |
|
290
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
303 |
top := StandardSystemView new. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
304 |
top extent:200@100. |
125 | 305 |
|
290
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
306 |
panel := VerticalPanelView origin:0.0@0.0 corner:1.0@1.0 in:top. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
307 |
panel horizontalLayout:#leftSpace. |
261
afcea54bd74e
added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents:
258
diff
changeset
|
308 |
|
290
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
309 |
ena := true asValue. |
261
afcea54bd74e
added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents:
258
diff
changeset
|
310 |
|
290
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
311 |
check := CheckBox label:'enable' in:panel. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
312 |
check model:ena. |
261
afcea54bd74e
added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents:
258
diff
changeset
|
313 |
|
290
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
314 |
panel add:(View new height:30). |
261
afcea54bd74e
added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents:
258
diff
changeset
|
315 |
|
290
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
316 |
field := EditField in:panel. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
317 |
field enableChannel:ena. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
318 |
field width:1.0. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
319 |
field editValue:'hello'. |
261
afcea54bd74e
added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents:
258
diff
changeset
|
320 |
|
290
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
321 |
top open |
125 | 322 |
|
323 |
||
121 | 324 |
use a converter: |
125 | 325 |
- numbers (default to 0): |
121 | 326 |
|
290
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
327 |
|top field| |
121 | 328 |
|
290
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
329 |
top := StandardSystemView new. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
330 |
top extent:200@100. |
121 | 331 |
|
290
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
332 |
field := EditField origin:0.0@ViewSpacing in:top. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
333 |
field width:1.0. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
334 |
field leftInset:ViewSpacing; |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
335 |
rightInset:ViewSpacing. |
121 | 336 |
|
290
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
337 |
field converter:(PrintConverter new initForNumber). |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
338 |
field editValue:1234. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
339 |
field acceptAction:[:value | Transcript showCr:value]. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
340 |
field crAction:[field accept. top destroy]. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
341 |
top open. |
121 | 342 |
|
343 |
- dates: |
|
344 |
||
290
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
345 |
|top field| |
121 | 346 |
|
290
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
347 |
top := StandardSystemView new. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
348 |
top extent:200@100. |
121 | 349 |
|
290
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
350 |
field := EditField origin:0.0@ViewSpacing in:top. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
351 |
field width:1.0. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
352 |
field leftInset:ViewSpacing; |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
353 |
rightInset:ViewSpacing. |
121 | 354 |
|
290
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
355 |
field converter:(PrintConverter new initForDate). |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
356 |
field editValue:Date today. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
357 |
field acceptAction:[:value | Transcript showCr:value class name , ' ' , value printString]. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
358 |
field crAction:[field accept. top destroy]. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
359 |
top open. |
121 | 360 |
|
122 | 361 |
|
125 | 362 |
setting immediateAccept, makes the field update with every key: |
363 |
||
364 |
- immediate accept numbers, defaulting to nil: |
|
121 | 365 |
|
290
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
366 |
|top field| |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
367 |
|
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
368 |
top := StandardSystemView new. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
369 |
top extent:200@100. |
121 | 370 |
|
290
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
371 |
field := EditField origin:0.0@ViewSpacing in:top. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
372 |
field width:1.0. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
373 |
field leftInset:ViewSpacing; |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
374 |
rightInset:ViewSpacing. |
121 | 375 |
|
290
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
376 |
field converter:(PrintConverter new initForNumberOrNil). |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
377 |
field immediateAccept:true. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
378 |
field editValue:1234. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
379 |
field acceptAction:[:value | Transcript showCr:value]. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
380 |
field crAction:[field accept. top destroy]. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
381 |
top open. |
121 | 382 |
|
290
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
383 |
|
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
384 |
|
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
385 |
grouping multiple fields, and forward keyPres from the outer view to the active field |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
386 |
(i.e. actually: to the group): |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
387 |
|
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
388 |
|top field1 field2 field3 group| |
121 | 389 |
|
122 | 390 |
|
290
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
391 |
top := StandardSystemView new. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
392 |
top extent:200@100. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
393 |
|
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
394 |
field1 := EditField origin:(0.0 @ 0.0) in:top. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
395 |
field1 width:1.0. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
396 |
|
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
397 |
field2 := EditField origin:(0.0 @ 0.0) in:top. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
398 |
field2 width:0.5. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
399 |
field2 topInset:(field1 height); bottomInset:(field1 height negated). |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
400 |
|
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
401 |
field3 := EditField origin:(0.5 @ 0.0) in:top. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
402 |
field3 width:0.5. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
403 |
field3 topInset:(field1 height); bottomInset:(field1 height negated). |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
404 |
|
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
405 |
group := EnterFieldGroup new. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
406 |
group add:field1; add:field2; add:field3. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
407 |
|
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
408 |
top delegate:(KeyboardForwarder to:group). |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
409 |
|
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
410 |
top open. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
411 |
|
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
412 |
|
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
413 |
in addition: tell the group to close when the last field is left: |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
414 |
|
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
415 |
|top field1 field2 field3 group| |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
416 |
|
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
417 |
|
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
418 |
top := StandardSystemView new. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
419 |
top extent:200@100. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
420 |
|
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
421 |
field1 := EditField origin:(0.0 @ 0.0) in:top. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
422 |
field1 width:1.0. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
423 |
|
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
424 |
field2 := EditField origin:(0.0 @ 0.0) in:top. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
425 |
field2 width:0.5. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
426 |
field2 topInset:(field1 height); bottomInset:(field1 height negated). |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
427 |
|
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
428 |
field3 := EditField origin:(0.5 @ 0.0) in:top. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
429 |
field3 width:0.5. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
430 |
field3 topInset:(field1 height); bottomInset:(field1 height negated). |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
431 |
|
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
432 |
group := EnterFieldGroup new. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
433 |
group add:field1; add:field2; add:field3. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
434 |
group leaveAction:[top destroy]. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
435 |
|
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
436 |
top delegate:(KeyboardForwarder to:group). |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
437 |
|
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
438 |
top open. |
127 | 439 |
|
440 |
||
120 | 441 |
use a model: |
442 |
(see changing model value in inspector when return is pressed in the field) |
|
443 |
||
290
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
444 |
|top field model| |
120 | 445 |
|
290
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
446 |
model := 'hello world' asValue. |
120 | 447 |
|
290
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
448 |
top := StandardSystemView new. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
449 |
top extent:200@100. |
120 | 450 |
|
290
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
451 |
field := EditField origin:(0.0 @ 0.0) in:top. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
452 |
field width:1.0. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
453 |
field model:model. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
454 |
field acceptOnReturn:true. |
120 | 455 |
|
290
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
456 |
top open. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
457 |
model inspect. |
121 | 458 |
|
122 | 459 |
|
127 | 460 |
two views on the same model (each accepts on return): |
121 | 461 |
|
290
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
462 |
|top1 top2 field1 field2 model| |
121 | 463 |
|
290
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
464 |
model := 'hello world' asValue. |
121 | 465 |
|
290
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
466 |
top1 := StandardSystemView new. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
467 |
top1 extent:200@100. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
468 |
field1 := EditField origin:(0.0 @ 0.0) in:top1. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
469 |
field1 width:1.0. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
470 |
field1 model:model. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
471 |
field1 acceptOnReturn:true. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
472 |
top1 open. |
121 | 473 |
|
290
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
474 |
top2 := StandardSystemView new. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
475 |
top2 extent:200@100. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
476 |
field2 := EditField origin:(0.0 @ 0.0) in:top2. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
477 |
field2 width:1.0. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
478 |
field2 model:model. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
479 |
field2 acceptOnReturn:true. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
480 |
top2 open. |
121 | 481 |
|
127 | 482 |
two views on the same model (no accept on return): |
483 |
||
290
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
484 |
|top1 top2 field1 field2 model| |
127 | 485 |
|
290
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
486 |
model := 'hello world' asValue. |
127 | 487 |
|
290
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
488 |
top1 := StandardSystemView new. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
489 |
top1 extent:200@100. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
490 |
field1 := EditField origin:(0.0 @ 0.0) in:top1. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
491 |
field1 width:1.0. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
492 |
field1 model:model; acceptOnReturn:false. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
493 |
top1 open. |
127 | 494 |
|
290
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
495 |
top2 := StandardSystemView new. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
496 |
top2 extent:200@100. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
497 |
field2 := EditField origin:(0.0 @ 0.0) in:top2. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
498 |
field2 width:1.0. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
499 |
field2 model:model; acceptOnReturn:false. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
500 |
top2 open. |
127 | 501 |
|
290
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
502 |
with immediate accept (every key updates the model): |
125 | 503 |
|
290
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
504 |
|top1 top2 field1 field2 model| |
125 | 505 |
|
290
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
506 |
model := 'hello world' asValue. |
125 | 507 |
|
290
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
508 |
top1 := StandardSystemView new. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
509 |
top1 extent:200@100. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
510 |
field1 := EditField origin:(0.0 @ 0.0) in:top1. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
511 |
field1 width:1.0. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
512 |
field1 model:model; immediateAccept:true. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
513 |
top1 open. |
125 | 514 |
|
290
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
515 |
top2 := StandardSystemView new. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
516 |
top2 extent:200@100. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
517 |
field2 := EditField origin:(0.0 @ 0.0) in:top2. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
518 |
field2 width:1.0. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
519 |
field2 model:model; immediateAccept:true. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
520 |
top2 open. |
122 | 521 |
|
121 | 522 |
just an example; a checkBox and an editField on the same model: |
523 |
||
290
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
524 |
|top1 top2 field1 box model| |
121 | 525 |
|
290
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
526 |
model := false asValue. |
121 | 527 |
|
290
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
528 |
top1 := StandardSystemView new. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
529 |
top1 extent:200@100. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
530 |
field1 := EditField origin:(0.0 @ 0.0) in:top1. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
531 |
field1 width:1.0. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
532 |
field1 converter:(PrintConverter new initForYesNo). |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
533 |
field1 model:model. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
534 |
top1 open. |
121 | 535 |
|
290
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
536 |
top2 := StandardSystemView new. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
537 |
top2 extent:200@100. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
538 |
box := CheckBox on:model. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
539 |
box label:'on/off'. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
540 |
top2 add:box. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
541 |
top2 open. |
121 | 542 |
|
290
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
543 |
model inspect. |
125 | 544 |
|
545 |
||
546 |
connecting fields: |
|
547 |
update field2 wehenever field1 is changed. |
|
548 |
(normally, the processing below (xChanged) is done in your application |
|
549 |
class, or in a complex model. For the demonstration below, we use |
|
550 |
a Plug to simulate the protocol.) |
|
551 |
||
290
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
552 |
|application top field1 field2 value1 value2| |
125 | 553 |
|
290
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
554 |
application := Plug new. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
555 |
application respondTo:#value1Changed |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
556 |
with:[value2 value:(value1 value isNil ifTrue:[nil] |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
557 |
ifFalse:[value1 value squared])]. |
125 | 558 |
|
290
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
559 |
value1 := 1 asValue. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
560 |
value2 := 1 asValue. |
125 | 561 |
|
290
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
562 |
top := Dialog new. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
563 |
top extent:200@200. |
125 | 564 |
|
290
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
565 |
(top addTextLabel:'some number:') layout:#left. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
566 |
top addVerticalSpace. |
125 | 567 |
|
290
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
568 |
(top addInputFieldOn:value1 tabable:false) |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
569 |
converter:(PrintConverter new initForNumberOrNil); |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
570 |
immediateAccept:true. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
571 |
top addVerticalSpace. |
125 | 572 |
|
290
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
573 |
(top addTextLabel:'squared:') layout:#left. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
574 |
top addVerticalSpace. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
575 |
(top addInputFieldOn:value2 tabable:false) |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
576 |
converter:(PrintConverter new initForNumberOrNil). |
125 | 577 |
|
290
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
578 |
value1 onChangeSend:#value1Changed to:application. |
125 | 579 |
|
290
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
580 |
top openModeless. |
125 | 581 |
|
582 |
||
583 |
two-way connect: |
|
584 |
each field updates the other (notice, that we have to turn off |
|
585 |
onChange: notification, to avoid an endless notification cycle) |
|
586 |
||
290
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
587 |
|application top field1 field2 value1 value2| |
125 | 588 |
|
290
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
589 |
application := Plug new. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
590 |
application respondTo:#value1Changed |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
591 |
with:[value2 retractInterestsFor:application. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
592 |
value2 value:(value1 value isNil ifTrue:[nil] |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
593 |
ifFalse:[value1 value squared]). |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
594 |
value2 onChangeSend:#value2Changed to:application. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
595 |
]. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
596 |
application respondTo:#value2Changed |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
597 |
with:[value1 retractInterestsFor:application. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
598 |
value1 value:(value2 value isNil ifTrue:[nil] |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
599 |
ifFalse:[value2 value sqrt]). |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
600 |
value1 onChangeSend:#value1Changed to:application. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
601 |
]. |
125 | 602 |
|
290
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
603 |
value1 := 1 asValue. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
604 |
value2 := 1 asValue. |
125 | 605 |
|
290
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
606 |
top := Dialog new. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
607 |
top extent:200@200. |
125 | 608 |
|
290
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
609 |
(top addTextLabel:'some number:') layout:#left. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
610 |
top addVerticalSpace. |
261
afcea54bd74e
added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents:
258
diff
changeset
|
611 |
|
290
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
612 |
(top addInputFieldOn:value1 tabable:false) |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
613 |
converter:(PrintConverter new initForNumberOrNil); |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
614 |
immediateAccept:true. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
615 |
top addVerticalSpace. |
125 | 616 |
|
290
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
617 |
(top addTextLabel:'squared:') layout:#left. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
618 |
top addVerticalSpace. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
619 |
(top addInputFieldOn:value2 tabable:false) |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
620 |
converter:(PrintConverter new initForNumberOrNil); |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
621 |
immediateAccept:true. |
125 | 622 |
|
290
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
623 |
value1 onChangeSend:#value1Changed to:application. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
624 |
value2 onChangeSend:#value2Changed to:application. |
125 | 625 |
|
290
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
626 |
top openModeless. |
120 | 627 |
" |
19 | 628 |
! ! |
0 | 629 |
|
630 |
!EditField class methodsFor:'defaults'! |
|
631 |
||
125 | 632 |
defaultLeaveKeys |
128 | 633 |
"return the set of keys which are taken as leave-keys. |
634 |
If the field is in an enterFieldGroup, all leave keys will be |
|
635 |
forwarded to the group and possible step to the next/previous field. |
|
636 |
Also, if acceptOnLeave is true, leave keys will store the current |
|
637 |
value into their model (if any)" |
|
638 |
||
125 | 639 |
^ #(Return CursorUp CursorDown Next Previous Accept) |
640 |
! |
|
641 |
||
192 | 642 |
defaultNumberOfLines |
643 |
"the number of lines in the field" |
|
644 |
||
645 |
^ 1 |
|
646 |
! |
|
647 |
||
59 | 648 |
updateStyleCache |
60 | 649 |
DefaultForegroundColor := StyleSheet colorAt:'editFieldForegroundColor' default:Black. |
650 |
DefaultBackgroundColor := StyleSheet colorAt:'editFieldBackgroundColor' default:White. |
|
651 |
DefaultSelectionForegroundColor := StyleSheet colorAt:'editFieldSelectionForegroundColor' default:DefaultBackgroundColor. |
|
652 |
DefaultSelectionBackgroundColor := StyleSheet colorAt:'editFieldSelectionBackgroundColor' default:DefaultForegroundColor. |
|
653 |
DefaultFont := StyleSheet fontAt:'editFieldFont' default:nil. |
|
59 | 654 |
|
655 |
" |
|
60 | 656 |
self updateStyleCache |
59 | 657 |
" |
0 | 658 |
! ! |
659 |
||
290
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
660 |
!EditField methodsFor:'accepting'! |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
661 |
|
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
662 |
accept |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
663 |
"" |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
664 |
|val string| |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
665 |
|
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
666 |
super accept. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
667 |
converter notNil ifTrue:[ |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
668 |
val := self editValue. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
669 |
string := converter printStringFor:val. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
670 |
string ~= self contents ifTrue:[ |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
671 |
self contents:string. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
672 |
self flash |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
673 |
] |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
674 |
]. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
675 |
! ! |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
676 |
|
192 | 677 |
!EditField methodsFor:'accessing-behavior'! |
125 | 678 |
|
192 | 679 |
acceptOnLeave:aBoolean |
261
afcea54bd74e
added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents:
258
diff
changeset
|
680 |
"set/clear the acceptOnLeave flag. The default is false. |
afcea54bd74e
added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents:
258
diff
changeset
|
681 |
If true, leaving the box (via return, cursor etc) accepts my |
afcea54bd74e
added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents:
258
diff
changeset
|
682 |
string into the valueHolder (if any). |
afcea54bd74e
added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents:
258
diff
changeset
|
683 |
(actually, the set of keys can be specified with #leaveKeys:)" |
125 | 684 |
|
192 | 685 |
acceptOnLeave := aBoolean |
261
afcea54bd74e
added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents:
258
diff
changeset
|
686 |
|
afcea54bd74e
added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents:
258
diff
changeset
|
687 |
"Modified: 16.12.1995 / 16:26:45 / cg" |
192 | 688 |
! |
689 |
||
690 |
acceptOnReturn:aBoolean |
|
261
afcea54bd74e
added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents:
258
diff
changeset
|
691 |
"set/clear the acceptOnReturn flag. The default is false. |
afcea54bd74e
added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents:
258
diff
changeset
|
692 |
If true, leaving the box via return accepts my |
afcea54bd74e
added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents:
258
diff
changeset
|
693 |
string into the valueHolder (if any)." |
192 | 694 |
|
695 |
acceptOnReturn := aBoolean |
|
261
afcea54bd74e
added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents:
258
diff
changeset
|
696 |
|
afcea54bd74e
added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents:
258
diff
changeset
|
697 |
"Modified: 16.12.1995 / 16:25:34 / cg" |
125 | 698 |
! |
699 |
||
290
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
700 |
autoScroll:aBoolean |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
701 |
"turn on/off automatic scrolling upon keyboard entry |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
702 |
to make the cursor visible." |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
703 |
|
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
704 |
autoScrollHorizontally := aBoolean |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
705 |
! |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
706 |
|
192 | 707 |
crAction:aBlock |
708 |
"define an action to be evaluated when the return key is pressed." |
|
709 |
||
710 |
crAction := aBlock |
|
711 |
! |
|
125 | 712 |
|
192 | 713 |
cursorMovementWhenUpdating:aSymbol |
714 |
"define what should be done with the cursor, when I update |
|
261
afcea54bd74e
added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents:
258
diff
changeset
|
715 |
my contents from the model. Allowed arguments are: |
290
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
716 |
#keep / nil -> stay where it was |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
717 |
#endOfLine -> position cursor after the string |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
718 |
#beginOfLine -> position cursor to the beginning |
261
afcea54bd74e
added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents:
258
diff
changeset
|
719 |
The default is #endOfLine. |
afcea54bd74e
added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents:
258
diff
changeset
|
720 |
This may be useful for fields which get new values assigned from |
afcea54bd74e
added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents:
258
diff
changeset
|
721 |
the program (i.e. not from the user)" |
125 | 722 |
|
192 | 723 |
cursorMovementWhenUpdating := aSymbol |
261
afcea54bd74e
added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents:
258
diff
changeset
|
724 |
|
afcea54bd74e
added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents:
258
diff
changeset
|
725 |
"Modified: 16.12.1995 / 16:27:55 / cg" |
192 | 726 |
! |
727 |
||
728 |
disable |
|
261
afcea54bd74e
added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents:
258
diff
changeset
|
729 |
"disable the field; hide the cursor and ignore input" |
192 | 730 |
|
731 |
enabled ifTrue:[ |
|
290
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
732 |
enabled := false. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
733 |
self hideCursor |
125 | 734 |
] |
261
afcea54bd74e
added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents:
258
diff
changeset
|
735 |
|
afcea54bd74e
added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents:
258
diff
changeset
|
736 |
"Modified: 16.12.1995 / 16:28:05 / cg" |
125 | 737 |
! |
738 |
||
192 | 739 |
enable |
261
afcea54bd74e
added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents:
258
diff
changeset
|
740 |
"enable the field; show the cursor and allow input" |
127 | 741 |
|
192 | 742 |
enabled ifFalse:[ |
743 |
"/ enableAction notNil ifTrue:[ |
|
744 |
"/ enableAction value |
|
745 |
"/ ]. |
|
290
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
746 |
enabled := true. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
747 |
super showCursor |
192 | 748 |
] |
261
afcea54bd74e
added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents:
258
diff
changeset
|
749 |
|
afcea54bd74e
added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents:
258
diff
changeset
|
750 |
"Modified: 16.12.1995 / 16:28:09 / cg" |
127 | 751 |
! |
752 |
||
192 | 753 |
enableAction:aBlock |
754 |
"define an action to be evaluated when enabled by clicking upon" |
|
755 |
||
756 |
enableAction := aBlock |
|
757 |
! |
|
125 | 758 |
|
192 | 759 |
entryCompletionBlock:aOneArgBlock |
760 |
"define an action to be evaluated when Tab (NameCompletion) is pressed. |
|
761 |
The block gets the current contents as argument." |
|
762 |
||
763 |
entryCompletionBlock := aOneArgBlock |
|
125 | 764 |
! |
765 |
||
192 | 766 |
immediateAccept:aBoolean |
261
afcea54bd74e
added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents:
258
diff
changeset
|
767 |
"set/clear the immediateAccept flag. The default is false. |
afcea54bd74e
added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents:
258
diff
changeset
|
768 |
If true, every pressed key immediately accepts my |
afcea54bd74e
added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents:
258
diff
changeset
|
769 |
string into the valueHolder (if any)." |
155 | 770 |
|
192 | 771 |
immediateAccept := aBoolean |
261
afcea54bd74e
added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents:
258
diff
changeset
|
772 |
|
afcea54bd74e
added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents:
258
diff
changeset
|
773 |
"Modified: 16.12.1995 / 16:25:57 / cg" |
192 | 774 |
! |
155 | 775 |
|
192 | 776 |
leaveAction:aBlock |
261
afcea54bd74e
added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents:
258
diff
changeset
|
777 |
"define an action to be evaluated when field is left by return or cursor keys. |
afcea54bd74e
added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents:
258
diff
changeset
|
778 |
(actually, the set of keys can be specified with #leaveKeys:)" |
192 | 779 |
|
780 |
leaveAction := aBlock |
|
261
afcea54bd74e
added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents:
258
diff
changeset
|
781 |
|
afcea54bd74e
added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents:
258
diff
changeset
|
782 |
"Modified: 16.12.1995 / 16:26:36 / cg" |
155 | 783 |
! |
784 |
||
192 | 785 |
leaveKeys:aCollectionOfKeySymbols |
786 |
"define the set of keys which are interpreted as leaveKeys. |
|
787 |
I.e. those that make the field inactive and accept (if acceptOnLeave is true). |
|
788 |
The default is a set of #CursorUp, #CursorDown, #Next, #Prior and #Return." |
|
155 | 789 |
|
192 | 790 |
leaveKeys := aCollectionOfKeySymbols |
791 |
! |
|
155 | 792 |
|
192 | 793 |
tabAction:aBlock |
794 |
"define an action to be evaluated when the tabulator key is pressed." |
|
155 | 795 |
|
192 | 796 |
tabAction := aBlock |
187 | 797 |
! ! |
125 | 798 |
|
261
afcea54bd74e
added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents:
258
diff
changeset
|
799 |
!EditField methodsFor:'accessing-channels'! |
afcea54bd74e
added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents:
258
diff
changeset
|
800 |
|
afcea54bd74e
added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents:
258
diff
changeset
|
801 |
enableChannel |
afcea54bd74e
added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents:
258
diff
changeset
|
802 |
^ enableChannel |
afcea54bd74e
added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents:
258
diff
changeset
|
803 |
|
afcea54bd74e
added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents:
258
diff
changeset
|
804 |
"Modified: 6.9.1995 / 13:43:33 / claus" |
afcea54bd74e
added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents:
258
diff
changeset
|
805 |
"Created: 16.12.1995 / 16:29:05 / cg" |
afcea54bd74e
added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents:
258
diff
changeset
|
806 |
"Modified: 16.12.1995 / 16:48:47 / cg" |
afcea54bd74e
added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents:
258
diff
changeset
|
807 |
! |
afcea54bd74e
added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents:
258
diff
changeset
|
808 |
|
afcea54bd74e
added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents:
258
diff
changeset
|
809 |
enableChannel:aValueHolder |
afcea54bd74e
added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents:
258
diff
changeset
|
810 |
|wasEnabled| |
afcea54bd74e
added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents:
258
diff
changeset
|
811 |
|
afcea54bd74e
added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents:
258
diff
changeset
|
812 |
enableChannel notNil ifTrue:[ |
290
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
813 |
wasEnabled := enableChannel value. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
814 |
enableChannel retractInterestsFor:self. |
261
afcea54bd74e
added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents:
258
diff
changeset
|
815 |
] ifFalse:[ |
290
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
816 |
wasEnabled := enabled |
261
afcea54bd74e
added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents:
258
diff
changeset
|
817 |
]. |
afcea54bd74e
added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents:
258
diff
changeset
|
818 |
enableChannel := aValueHolder. |
afcea54bd74e
added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents:
258
diff
changeset
|
819 |
aValueHolder onChangeSend:#enableStateChange to:self. |
afcea54bd74e
added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents:
258
diff
changeset
|
820 |
enableChannel value ~~ wasEnabled ifTrue:[ |
290
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
821 |
self enableStateChange |
261
afcea54bd74e
added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents:
258
diff
changeset
|
822 |
] |
afcea54bd74e
added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents:
258
diff
changeset
|
823 |
|
afcea54bd74e
added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents:
258
diff
changeset
|
824 |
"Created: 16.12.1995 / 16:35:32 / cg" |
afcea54bd74e
added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents:
258
diff
changeset
|
825 |
! ! |
afcea54bd74e
added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents:
258
diff
changeset
|
826 |
|
187 | 827 |
!EditField methodsFor:'accessing-contents'! |
125 | 828 |
|
187 | 829 |
contents |
830 |
"return contents as a string |
|
831 |
- redefined since EditFields hold only one line of text. |
|
832 |
In your application, please use #editValue; |
|
833 |
it uses a converter (if any) and is compatible to ST-80." |
|
834 |
||
835 |
list isNil ifTrue:[^ '']. |
|
836 |
(list size == 0) ifTrue:[^ '']. |
|
837 |
^ list at:1 |
|
838 |
! |
|
839 |
||
125 | 840 |
contents:someText |
841 |
"set the contents from a string |
|
842 |
- redefined to place the cursor to the end. |
|
843 |
In your application, please use #editValue:; |
|
844 |
it uses a converter (if any) and is compatible to ST-80." |
|
845 |
||
187 | 846 |
|newCol| |
847 |
||
848 |
newCol := cursorCol. |
|
849 |
||
125 | 850 |
super contents:someText. |
851 |
||
187 | 852 |
cursorMovementWhenUpdating == #endOfLine ifTrue:[ |
853 |
newCol := (someText size + 1). |
|
854 |
] ifFalse:[ |
|
855 |
cursorMovementWhenUpdating == #beginOfLine ifTrue:[ |
|
856 |
newCol := 1 |
|
857 |
] ifFalse:[ |
|
858 |
"/ default: stay where it was |
|
859 |
] |
|
860 |
]. |
|
125 | 861 |
|
187 | 862 |
self cursorCol:newCol. |
125 | 863 |
! |
864 |
||
192 | 865 |
converter |
866 |
"return the converter (if any)." |
|
867 |
||
868 |
^ converter |
|
869 |
! |
|
870 |
||
871 |
converter:aConverter |
|
872 |
"set the converter. If non-nil, |
|
873 |
the converter is applied to the text to convert from the string |
|
874 |
representation to the actual object value and vice versa. |
|
875 |
The default converter is nil, meaning no-conversion |
|
876 |
(i.e. the edited object is the string itself." |
|
877 |
||
878 |
converter := aConverter |
|
879 |
! |
|
880 |
||
125 | 881 |
editValue |
882 |
"if the field edits a string, this is a name alias for #contents. |
|
883 |
Otherwise, if there is a converter, return the edited string |
|
884 |
converted to an appropriate object." |
|
885 |
||
886 |
|string| |
|
887 |
||
888 |
string := self contents. |
|
279 | 889 |
string isNil ifTrue:[string := '']. |
125 | 890 |
converter isNil ifTrue:[^ string]. |
891 |
^ converter readValueFrom:string |
|
892 |
! |
|
0 | 893 |
|
125 | 894 |
editValue:aStringOrObject |
895 |
"set the contents. If there is a converter, use it to convert |
|
896 |
the object into a printed representation. |
|
897 |
Otherwise, the argument is supposed to be a string like object, |
|
898 |
and used directly (i.e. this is equivalent to sending #contents:)." |
|
899 |
||
900 |
self editValue:aStringOrObject selected:false |
|
0 | 901 |
! |
902 |
||
125 | 903 |
editValue:aStringOrObject selected:aBoolean |
904 |
"set the contents. If there is a converter, use it to convert |
|
905 |
the object into a printed representation. |
|
906 |
Otherwise, the argument is supposed to be a string like object, |
|
187 | 907 |
and used directly (i.e. this is equivalent to sending #initialText:selected:)." |
125 | 908 |
|
909 |
|string| |
|
910 |
||
911 |
converter notNil ifTrue:[ |
|
912 |
string := converter printStringFor:aStringOrObject |
|
913 |
] ifFalse:[ |
|
914 |
string := aStringOrObject. |
|
915 |
]. |
|
916 |
self contents:string. |
|
917 |
aBoolean ifTrue:[ |
|
918 |
self selectFromLine:1 col:1 toLine:1 col:string size |
|
919 |
] |
|
920 |
! |
|
921 |
||
192 | 922 |
initialText:aString |
923 |
"set the initialText and select it" |
|
924 |
||
925 |
self initialText:aString selected:true |
|
926 |
! |
|
927 |
||
187 | 928 |
initialText:aString selected:aBoolean |
929 |
"set the initialText and select it if aBoolean is true" |
|
930 |
||
931 |
|len s| |
|
125 | 932 |
|
187 | 933 |
leftOffset := 0. |
934 |
(s := aString) notNil ifTrue:[ |
|
935 |
s := s asString |
|
936 |
]. |
|
937 |
self contents:s. |
|
938 |
aBoolean ifTrue:[ |
|
939 |
(len := s size) ~~ 0 ifTrue:[ |
|
940 |
self selectFromLine:1 col:1 toLine:1 col:len |
|
941 |
] |
|
942 |
] |
|
943 |
! |
|
944 |
||
192 | 945 |
list:someText |
946 |
"low level access to the underlying contents' list. |
|
947 |
Redefined to force text to 1 line, and notify dependents |
|
948 |
of any changed extent-wishes (for automatic box resizing)." |
|
949 |
||
950 |
|l oldWidth| |
|
187 | 951 |
|
192 | 952 |
l := someText. |
953 |
l size > 1 ifTrue:[ |
|
954 |
l := OrderedCollection with:(l at:1) |
|
955 |
]. |
|
956 |
oldWidth := self widthOfContents. |
|
957 |
super list:l. |
|
958 |
self widthOfContents ~~ oldWidth ifTrue:[ |
|
959 |
self changed:#preferredExtent |
|
960 |
] |
|
187 | 961 |
! |
962 |
||
963 |
stringValue |
|
964 |
"alias for #contents - for compatibility with ST-80's InputField" |
|
965 |
||
966 |
^ self contents |
|
967 |
! ! |
|
968 |
||
969 |
!EditField methodsFor:'accessing-look'! |
|
125 | 970 |
|
155 | 971 |
maxChars |
972 |
"return the maximum number of characters that are allowed in |
|
973 |
the field. |
|
974 |
A limit of nil means: unlimited. This is the default." |
|
975 |
||
976 |
^ lengthLimit |
|
977 |
||
978 |
"Modified: 6.9.1995 / 13:43:33 / claus" |
|
979 |
! |
|
980 |
||
125 | 981 |
maxChars:aNumberOrNil |
982 |
"set the maximum number of characters that are allowed in |
|
983 |
the field. Additional input will be ignored by the field. |
|
984 |
A limit of nil means: unlimited. This is the default. |
|
290
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
985 |
If set, a lengthLimit must be defined before any contents is placed |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
986 |
into the field, because the contents is not cut when the max is |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
987 |
changed later. I.e. it should be set early after creation of the field. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
988 |
|
125 | 989 |
This method has been renamed from #lengthLimit: for ST-80 |
990 |
compatibility." |
|
991 |
||
290
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
992 |
lengthLimit := aNumberOrNil. |
187 | 993 |
! |
994 |
||
192 | 995 |
passwordCharacter |
261
afcea54bd74e
added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents:
258
diff
changeset
|
996 |
"return the passwordCharacter; |
afcea54bd74e
added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents:
258
diff
changeset
|
997 |
If nonNil, that one is replacing typed input |
afcea54bd74e
added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents:
258
diff
changeset
|
998 |
(for secret input)" |
afcea54bd74e
added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents:
258
diff
changeset
|
999 |
|
192 | 1000 |
^ passwordCharacter |
0 | 1001 |
|
192 | 1002 |
"Modified: 6.9.1995 / 12:25:39 / claus" |
261
afcea54bd74e
added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents:
258
diff
changeset
|
1003 |
"Modified: 16.12.1995 / 16:24:25 / cg" |
125 | 1004 |
! |
1005 |
||
192 | 1006 |
passwordCharacter:aCharacter |
261
afcea54bd74e
added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents:
258
diff
changeset
|
1007 |
"set the passwordCharacter; |
afcea54bd74e
added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents:
258
diff
changeset
|
1008 |
If nonNil, that one is replacing typed input |
afcea54bd74e
added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents:
258
diff
changeset
|
1009 |
(for secret input)" |
afcea54bd74e
added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents:
258
diff
changeset
|
1010 |
|
192 | 1011 |
passwordCharacter := aCharacter |
97 | 1012 |
|
192 | 1013 |
"Modified: 6.9.1995 / 12:25:33 / claus" |
261
afcea54bd74e
added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents:
258
diff
changeset
|
1014 |
"Modified: 16.12.1995 / 16:24:33 / cg" |
38 | 1015 |
! ! |
1016 |
||
0 | 1017 |
!EditField methodsFor:'cursor drawing'! |
1018 |
||
155 | 1019 |
drawFromVisibleLine:startVisLineNr to:endVisLineNr with:fg and:bg |
1020 |
startVisLineNr to:endVisLineNr do:[:visLine | |
|
1021 |
self drawVisibleLine:visLine with:fg and:bg |
|
1022 |
] |
|
1023 |
||
1024 |
"Modified: 6.9.1995 / 12:24:29 / claus" |
|
1025 |
! |
|
1026 |
||
0 | 1027 |
showCursor |
1028 |
"make cursor visible if currently invisible - but only if this |
|
1029 |
EditField is enabled" |
|
1030 |
||
1031 |
enabled ifTrue:[super showCursor] |
|
1032 |
! ! |
|
1033 |
||
1034 |
!EditField methodsFor:'cursor movement'! |
|
1035 |
||
125 | 1036 |
cursorCol:col |
1037 |
"redefined to lock the cursor at the end, if I have a lngthLimit" |
|
1038 |
||
1039 |
|c sz| |
|
1040 |
||
1041 |
c := col. |
|
1042 |
lengthLimit notNil ifTrue:[ |
|
1043 |
sz := lengthLimit. |
|
1044 |
c > sz ifTrue:[ |
|
1045 |
c := sz+1. |
|
1046 |
] |
|
1047 |
]. |
|
1048 |
super cursorCol:c |
|
1049 |
! |
|
1050 |
||
0 | 1051 |
cursorDown |
1052 |
"catch cursor movement" |
|
1053 |
||
1054 |
(cursorVisibleLine == nLinesShown) ifFalse:[ |
|
59 | 1055 |
super cursorDown |
0 | 1056 |
] |
192 | 1057 |
! |
1058 |
||
1059 |
cursorLine:line col:col |
|
1060 |
"catch cursor movement" |
|
1061 |
||
1062 |
super cursorLine:1 col:col |
|
1063 |
! ! |
|
1064 |
||
1065 |
!EditField methodsFor:'editing'! |
|
1066 |
||
1067 |
paste:someText |
|
1068 |
"redefined to force text to 1 line" |
|
1069 |
||
1070 |
super paste:someText. |
|
1071 |
list size > 1 ifTrue:[ |
|
1072 |
self deleteFromLine:2 toLine:(list size) |
|
1073 |
] |
|
0 | 1074 |
! ! |
1075 |
||
70 | 1076 |
!EditField methodsFor:'event handling'! |
19 | 1077 |
|
192 | 1078 |
buttonPress:button x:x y:y |
1079 |
"enable myself on mouse click" |
|
1080 |
||
1081 |
enabled ifFalse:[ |
|
1082 |
enabled := true. |
|
1083 |
super buttonPress:button x:x y:y. |
|
1084 |
enableAction notNil ifTrue:[ |
|
1085 |
enableAction value |
|
1086 |
] |
|
1087 |
] ifTrue:[ |
|
1088 |
super buttonPress:button x:x y:y |
|
1089 |
] |
|
1090 |
! |
|
1091 |
||
1092 |
canHandle:aKey |
|
1093 |
"return true, if the receiver would like to handle aKey |
|
1094 |
(usually from another view, when the receiver is part of |
|
1095 |
a more complex dialog box). |
|
1096 |
We do return true here, since the editfield will handle |
|
1097 |
all keys. |
|
1098 |
OBSOLETE: dont use this anymore - its a leftover for the tableWidget" |
|
1099 |
||
1100 |
^ true |
|
1101 |
! |
|
1102 |
||
261
afcea54bd74e
added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents:
258
diff
changeset
|
1103 |
enableStateChange |
afcea54bd74e
added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents:
258
diff
changeset
|
1104 |
enableChannel value ifTrue:[ |
290
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
1105 |
self enable |
261
afcea54bd74e
added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents:
258
diff
changeset
|
1106 |
] ifFalse:[ |
290
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
1107 |
self disable |
261
afcea54bd74e
added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents:
258
diff
changeset
|
1108 |
]. |
afcea54bd74e
added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents:
258
diff
changeset
|
1109 |
|
afcea54bd74e
added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents:
258
diff
changeset
|
1110 |
"Created: 16.12.1995 / 16:35:39 / cg" |
afcea54bd74e
added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents:
258
diff
changeset
|
1111 |
"Modified: 16.12.1995 / 16:36:13 / cg" |
afcea54bd74e
added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents:
258
diff
changeset
|
1112 |
! |
afcea54bd74e
added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents:
258
diff
changeset
|
1113 |
|
192 | 1114 |
focusIn |
1115 |
"got the explicit focus" |
|
1116 |
||
1117 |
enabled ifFalse:[ |
|
1118 |
enabled := true. |
|
1119 |
super focusIn. |
|
1120 |
enableAction notNil ifTrue:[ |
|
1121 |
enableAction value |
|
1122 |
] |
|
1123 |
] ifTrue:[ |
|
1124 |
super focusIn |
|
1125 |
]. |
|
1126 |
! |
|
1127 |
||
125 | 1128 |
keyPress:key x:x y:y |
1129 |
"if keyHandler is defined, pass input; otherwise check for leave |
|
1130 |
keys" |
|
1131 |
||
132 | 1132 |
<resource: #keyboard (#DeleteLine #EndOfText)> |
1133 |
||
290
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
1134 |
|leave xCol newOffset newWidth s| |
125 | 1135 |
|
1136 |
enabled ifFalse:[ |
|
290
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
1137 |
^ self |
125 | 1138 |
]. |
1139 |
||
1140 |
(key == #DeleteLine) ifTrue:[ |
|
290
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
1141 |
Smalltalk at:#CopyBuffer put:(self contents). |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
1142 |
self contents:''. ^ self |
125 | 1143 |
]. |
19 | 1144 |
|
125 | 1145 |
(key == #Tab) ifTrue:[ |
290
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
1146 |
tabAction notNil ifTrue:[tabAction value. ^ self]. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
1147 |
entryCompletionBlock notNil ifTrue:[ |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
1148 |
s := self contents. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
1149 |
s isNil ifTrue:[ |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
1150 |
s := '' |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
1151 |
] ifFalse:[ |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
1152 |
s := s asString |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
1153 |
]. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
1154 |
entryCompletionBlock value:s. ^ self |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
1155 |
] |
125 | 1156 |
]. |
1157 |
(key == #Return) ifTrue:[ |
|
290
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
1158 |
crAction notNil ifTrue:[crAction value. ^ self]. |
125 | 1159 |
]. |
1160 |
leave := leaveKeys includes:key. |
|
1161 |
leave ifTrue:[ |
|
121 | 1162 |
|
290
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
1163 |
((key == #Return and:[acceptOnReturn]) |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
1164 |
or:[key ~~ #Return and:[acceptOnLeave]]) ifTrue:[ |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
1165 |
self accept. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
1166 |
]. |
279 | 1167 |
|
290
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
1168 |
leaveAction notNil ifTrue:[ |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
1169 |
^ leaveAction value:key |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
1170 |
]. |
125 | 1171 |
|
290
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
1172 |
x >= 0 ifTrue:[ |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
1173 |
" |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
1174 |
let superview know about the leave ... |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
1175 |
This is a temporary kludge for the tableWidget - |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
1176 |
it is no clean coding style. Should make the tableWidget |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
1177 |
a proper model and handle it via the changed mechanism .... |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
1178 |
" |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
1179 |
(superView notNil and:[superView canHandle:key from:self]) ifTrue:[ |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
1180 |
superView keyPress:key x:x y:y. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
1181 |
]. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
1182 |
]. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
1183 |
^ self |
19 | 1184 |
]. |
121 | 1185 |
|
125 | 1186 |
" |
1187 |
ignore some keys (if not a leaveKey) ... |
|
1188 |
" |
|
1189 |
(key == #Find) ifTrue:[^self]. |
|
1190 |
(key == #FindNext) ifTrue:[^self]. |
|
1191 |
(key == #FindPrev) ifTrue:[^self]. |
|
1192 |
(key == #GotoLine) ifTrue:[^self]. |
|
1193 |
||
1194 |
" |
|
1195 |
a normal key - let superclass's method insert it |
|
1196 |
" |
|
1197 |
super keyPress:key x:x y:y. |
|
1198 |
||
1199 |
" |
|
1200 |
for end-of-text, also move to end-of-line |
|
1201 |
" |
|
1202 |
key == #EndOfText ifTrue:[ |
|
290
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
1203 |
super keyPress:#EndOfLine x:x y:y. |
125 | 1204 |
]. |
290
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
1205 |
|
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
1206 |
self resizeOrScroll. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
1207 |
|
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
1208 |
"Modified: 16.1.1996 / 19:39:14 / cg" |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
1209 |
! |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
1210 |
|
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
1211 |
resizeOrScroll |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
1212 |
"helper for keyPress. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
1213 |
Extracted for easier subclass redefinition." |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
1214 |
|
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
1215 |
|xCol newOffset newWidth| |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
1216 |
|
125 | 1217 |
newWidth := self widthOfContents. |
1218 |
||
1219 |
" |
|
1220 |
should (& can) we resize ? |
|
1221 |
" |
|
1222 |
xCol := (self xOfCol:cursorCol inVisibleLine:cursorLine) - leftOffset. |
|
1223 |
(xCol > (width * (5/6))) ifTrue:[ |
|
290
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
1224 |
self changed:#preferredExtent |
125 | 1225 |
] ifFalse:[ |
290
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
1226 |
newWidth < (width * (1/6)) ifTrue:[ |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
1227 |
self changed:#preferredExtent |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
1228 |
] |
125 | 1229 |
]. |
1230 |
||
290
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
1231 |
autoScrollHorizontally ifTrue:[ |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
1232 |
" |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
1233 |
did someone react (i.e. has my extent changed) ? |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
1234 |
(if not, we scroll horizontally) |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
1235 |
" |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
1236 |
xCol := (self xOfCol:cursorCol inVisibleLine:cursorLine) - leftOffset. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
1237 |
(xCol > (width * (5/6))) ifTrue:[ |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
1238 |
newOffset := leftOffset + (width // 2). |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
1239 |
] ifFalse:[ |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
1240 |
(xCol < (width * (1/6))) ifTrue:[ |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
1241 |
newOffset := 0 max: leftOffset - (width // 2). |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
1242 |
] ifFalse:[ |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
1243 |
newOffset := leftOffset |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
1244 |
] |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
1245 |
]. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
1246 |
newOffset ~~ leftOffset ifTrue:[ |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
1247 |
self scrollHorizontalTo:newOffset. |
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
1248 |
] |
125 | 1249 |
]. |
192 | 1250 |
! ! |
1251 |
||
1252 |
!EditField methodsFor:'initialization'! |
|
1253 |
||
1254 |
editMenu |
|
1255 |
|labels selectors m| |
|
1256 |
||
1257 |
labels := #( |
|
1258 |
'copy' |
|
1259 |
'cut' |
|
1260 |
'paste' |
|
1261 |
" |
|
1262 |
'replace' |
|
1263 |
" |
|
1264 |
'-' |
|
1265 |
'accept' |
|
1266 |
). |
|
1267 |
||
1268 |
selectors := #( |
|
1269 |
copySelection |
|
1270 |
cut |
|
1271 |
paste |
|
1272 |
" |
|
1273 |
replace |
|
1274 |
" |
|
1275 |
nil |
|
1276 |
accept |
|
1277 |
). |
|
1278 |
||
1279 |
m := PopUpMenu |
|
1280 |
labels:(resources array:labels) |
|
1281 |
selectors:selectors. |
|
1282 |
||
1283 |
self hasSelection ifFalse:[ |
|
1284 |
m disableAll:#(copySelection cut) |
|
1285 |
]. |
|
1286 |
||
1287 |
^ m |
|
19 | 1288 |
! |
0 | 1289 |
|
192 | 1290 |
initStyle |
1291 |
super initStyle. |
|
1292 |
||
1293 |
DefaultBackgroundColor notNil ifTrue:[ |
|
1294 |
bgColor := DefaultBackgroundColor on:device. |
|
1295 |
self viewBackground:bgColor. |
|
1296 |
]. |
|
1297 |
fgColor := DefaultForegroundColor. |
|
1298 |
selectionFgColor := DefaultSelectionForegroundColor. |
|
1299 |
selectionBgColor := DefaultSelectionBackgroundColor. |
|
1300 |
||
1301 |
DefaultFont notNil ifTrue:[ |
|
1302 |
font := DefaultFont on:device |
|
1303 |
] |
|
1304 |
! |
|
0 | 1305 |
|
192 | 1306 |
initialize |
1307 |
super initialize. |
|
1308 |
self height:(font height + font descent + (topMargin * 2)). |
|
1309 |
enabled := true. |
|
1310 |
fixedSize := true. |
|
290
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
1311 |
autoScrollHorizontally := true. |
192 | 1312 |
nFullLinesShown := 1. |
1313 |
nLinesShown := 1. |
|
1314 |
immediateAccept := false. |
|
1315 |
"/ acceptOnLeave := false. |
|
1316 |
"/ acceptOnReturn := false. |
|
1317 |
acceptOnLeave := acceptOnReturn := true. |
|
1318 |
cursorShown := true. |
|
1319 |
leaveKeys := self class defaultLeaveKeys. |
|
1320 |
cursorMovementWhenUpdating := #endOfLine |
|
1321 |
! ! |
|
1322 |
||
1323 |
!EditField methodsFor:'private'! |
|
1324 |
||
1325 |
argForChangeMessage |
|
1326 |
"redefined to send use converted value (if I have one)" |
|
1327 |
||
1328 |
^ self editValue |
|
1329 |
! |
|
1330 |
||
1331 |
getListFromModel |
|
1332 |
"redefined to aquire the text via the aspectMsg - not the listMsg, |
|
1333 |
and to ignore updates resulting from my own change." |
|
1334 |
||
1335 |
" |
|
1336 |
ignore updates from my own change |
|
1337 |
" |
|
1338 |
lockUpdates ifTrue:[ |
|
1339 |
lockUpdates := false. |
|
1340 |
^ self |
|
1341 |
]. |
|
1342 |
||
1343 |
(model notNil and:[aspectMsg notNil]) ifTrue:[ |
|
1344 |
self editValue:(model perform:aspectMsg). |
|
0 | 1345 |
] |
1346 |
! |
|
1347 |
||
192 | 1348 |
startAutoScrollDown:y |
1349 |
"no vertical scrolling in editfields" |
|
1350 |
||
1351 |
^ self |
|
1352 |
! |
|
1353 |
||
1354 |
startAutoScrollUp:y |
|
1355 |
"no vertical scrolling in editfields" |
|
1356 |
||
1357 |
^ self |
|
1358 |
! |
|
0 | 1359 |
|
192 | 1360 |
textChanged |
1361 |
"this is sent by mySelf (somewhere in a superclass) whenever |
|
1362 |
my contents has changed. |
|
1363 |
A good place to add immediateAccept functionality and check for the |
|
1364 |
lengthLimit." |
|
1365 |
||
1366 |
|string c| |
|
1367 |
||
1368 |
super textChanged. |
|
1369 |
string := self contents. |
|
1370 |
lengthLimit notNil ifTrue:[ |
|
1371 |
string size > lengthLimit ifTrue:[ |
|
1372 |
c := cursorCol. |
|
1373 |
self contents:(string copyTo:lengthLimit). |
|
1374 |
self flash. |
|
1375 |
self cursorCol:c. |
|
125 | 1376 |
] |
0 | 1377 |
]. |
192 | 1378 |
immediateAccept ifTrue:[ |
1379 |
self accept |
|
1380 |
] |
|
105 | 1381 |
! |
1382 |
||
192 | 1383 |
visibleAt:visLineNr |
1384 |
"return the string at lineNr for display. |
|
1385 |
If there is a password character, return a string consisting of those only." |
|
1386 |
||
1387 |
|s| |
|
105 | 1388 |
|
192 | 1389 |
s := super visibleAt:visLineNr. |
1390 |
passwordCharacter notNil ifTrue:[ |
|
1391 |
^ String new:(s size) withAll:passwordCharacter |
|
1392 |
]. |
|
1393 |
^ s |
|
1394 |
||
1395 |
"Modified: 6.9.1995 / 12:25:06 / claus" |
|
0 | 1396 |
! ! |
125 | 1397 |
|
192 | 1398 |
!EditField methodsFor:'queries'! |
1399 |
||
1400 |
preferredExtent |
|
1401 |
"return the preferred extent of this view. |
|
1402 |
That is the width of the string plus some extra, |
|
1403 |
but not wider than half of the screen" |
|
1404 |
||
1405 |
|string w f| |
|
125 | 1406 |
|
192 | 1407 |
string := self contents. |
1408 |
(string isNil or:[string isBlank]) ifTrue:[ |
|
1409 |
string := ' ' "/ just any string is ok ^ super preferredExtent |
|
1410 |
]. |
|
1411 |
f := font on:device. |
|
1412 |
w := ((f widthOf:string) * 1.5) rounded. |
|
1413 |
w := w min:(device width // 2). |
|
231 | 1414 |
"/ ^ w @ (f height * 1.5) rounded |
1415 |
^ w @ (f height + f descent + (margin * 2)"* 1.5") rounded |
|
192 | 1416 |
|
1417 |
"Modified: 6.9.1995 / 19:24:06 / claus" |
|
1418 |
! |
|
1419 |
||
1420 |
specClass |
|
1421 |
self class == EditField ifTrue:[^ InputFieldSpec]. |
|
1422 |
^ nil |
|
125 | 1423 |
|
192 | 1424 |
"Modified: 5.9.1995 / 17:28:27 / claus" |
1425 |
! ! |
|
1426 |
||
1427 |
!EditField methodsFor:'realization'! |
|
1428 |
||
1429 |
realize |
|
1430 |
"scroll back to beginning when realized" |
|
1431 |
leftOffset := 0. |
|
1432 |
super realize |
|
125 | 1433 |
! ! |
192 | 1434 |
|
1435 |
!EditField methodsFor:'scrolling'! |
|
1436 |
||
1437 |
makeColVisible:col inLine:line |
|
1438 |
"dont scroll for the cursor, if its behond the text and a lengthLimit |
|
1439 |
is present." |
|
1440 |
||
1441 |
lengthLimit notNil ifTrue:[ |
|
1442 |
(col == cursorCol and:[col > lengthLimit]) ifTrue:[ |
|
1443 |
^ super makeColVisible:lengthLimit inLine:line |
|
1444 |
] |
|
1445 |
]. |
|
1446 |
^ super makeColVisible:col inLine:line |
|
1447 |
||
1448 |
"Modified: 6.9.1995 / 13:57:53 / claus" |
|
1449 |
! ! |
|
1450 |
||
261
afcea54bd74e
added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents:
258
diff
changeset
|
1451 |
!EditField methodsFor:'selections'! |
afcea54bd74e
added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents:
258
diff
changeset
|
1452 |
|
afcea54bd74e
added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents:
258
diff
changeset
|
1453 |
validateNewSelection |
afcea54bd74e
added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents:
258
diff
changeset
|
1454 |
"make certain that only one line is ever selected" |
afcea54bd74e
added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents:
258
diff
changeset
|
1455 |
|
afcea54bd74e
added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents:
258
diff
changeset
|
1456 |
selectionEndLine > 1 ifTrue:[ |
afcea54bd74e
added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents:
258
diff
changeset
|
1457 |
selectionEndLine := 2. selectionEndCol := 0 |
afcea54bd74e
added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents:
258
diff
changeset
|
1458 |
]. |
afcea54bd74e
added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents:
258
diff
changeset
|
1459 |
! ! |
afcea54bd74e
added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents:
258
diff
changeset
|
1460 |
|
afcea54bd74e
added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents:
258
diff
changeset
|
1461 |
!EditField class methodsFor:'documentation'! |
afcea54bd74e
added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents:
258
diff
changeset
|
1462 |
|
afcea54bd74e
added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents:
258
diff
changeset
|
1463 |
version |
290
f539121393b1
innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents:
279
diff
changeset
|
1464 |
^ '$Header: /cvs/stx/stx/libwidg/EditField.st,v 1.38 1996-01-16 19:07:53 cg Exp $' |
261
afcea54bd74e
added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents:
258
diff
changeset
|
1465 |
! ! |