author | Claus Gittinger <cg@exept.de> |
Fri, 01 Sep 2017 14:24:45 +0200 | |
changeset 6201 | 5493871b7dd2 |
parent 6141 | 72ad437c9e52 |
child 6220 | 319368c35cb9 |
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 |
" |
|
2227 | 12 |
"{ Package: 'stx:libwidg' }" |
13 |
||
5285 | 14 |
"{ NameSpace: Smalltalk }" |
15 |
||
77 | 16 |
DialogBox subclass:#EnterBox |
669
fef6f8160573
allow blank-trimming to be turned off
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
17 |
instanceVariableNames:'labelField enterField trimBlanks' |
306
6a6a1513b713
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods
Claus Gittinger <cg@exept.de>
parents:
242
diff
changeset
|
18 |
classVariableNames:'' |
6a6a1513b713
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods
Claus Gittinger <cg@exept.de>
parents:
242
diff
changeset
|
19 |
poolDictionaries:'' |
6a6a1513b713
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods
Claus Gittinger <cg@exept.de>
parents:
242
diff
changeset
|
20 |
category:'Views-DialogBoxes' |
0 | 21 |
! |
22 |
||
1613 | 23 |
!EnterBox class methodsFor:'documentation'! |
3 | 24 |
|
38 | 25 |
copyright |
26 |
" |
|
27 |
COPYRIGHT (c) 1990 by Claus Gittinger |
|
59 | 28 |
All Rights Reserved |
38 | 29 |
|
30 |
This software is furnished under a license and may be used |
|
31 |
only in accordance with the terms of that license and with the |
|
32 |
inclusion of the above copyright notice. This software may not |
|
33 |
be provided or otherwise made available to, or used by, any |
|
34 |
other person. No title to or ownership of the software is |
|
35 |
hereby transferred. |
|
36 |
" |
|
37 |
! |
|
38 |
||
3 | 39 |
documentation |
40 |
" |
|
355 | 41 |
Historic note: |
42 |
originally, ST/X had separate classes for the various entry methods; |
|
43 |
there were YesNoBox, EnterBox, InfoBox and so on. |
|
44 |
In the meantime, the DialogBox class (and therefore its alias: Dialog) |
|
5896 | 45 |
is going to duplicate most functionality found in these classes. |
355 | 46 |
|
47 |
In the future, those existing subclasses' functionality is going to |
|
48 |
be moved fully into Dialog, and the subclasses will be replaced by dummy |
|
49 |
delegators. (They will be kept for backward compatibility, though). |
|
50 |
||
51 |
||
5286 | 52 |
This class implements a pop-up box to enter some string |
38 | 53 |
with 2 buttons; a cancel button, and a trigger-action button. |
242 | 54 |
Normally, the box is created and opened with the single message: |
55 |
EnterBox request:'someString' |
|
56 |
which returns nil if aborted and the entered string otherwise. |
|
3 | 57 |
|
242 | 58 |
However, to control more details of the box, it may also be created first |
5286 | 59 |
(EnterBox new) and then modified as appropriate before it is shown. |
242 | 60 |
|
5896 | 61 |
For example, the boxes title can be changed with: |
242 | 62 |
|
63 |
aBox title:'some string' |
|
38 | 64 |
|
5896 | 65 |
The two button-labels default to 'abort' and 'ok'; |
38 | 66 |
they can be changed using: |
3 | 67 |
|
242 | 68 |
aBox okText:'someString' |
69 |
aBox abortText:'someString' |
|
38 | 70 |
|
71 |
The initial text in the enterfield can be set using: |
|
3 | 72 |
|
242 | 73 |
aBox initialText:'someString' |
3 | 74 |
|
38 | 75 |
when the ok-button is pressed, an action is performed, which is |
76 |
set using: |
|
3 | 77 |
|
242 | 78 |
aBox action:[ ... ] |
3 | 79 |
|
38 | 80 |
the abort-action defaults to no-action, but can also be set. |
242 | 81 |
|
38 | 82 |
The box can be opened modal (i.e. the currently active view will |
83 |
be suspended) or modeless. The default is modal (i.e. sending #open |
|
84 |
is equivalent to #openModal). |
|
242 | 85 |
|
86 |
Most of the above is also available via messages to Dialog for ST-80 compatibility |
|
5286 | 87 |
(i.e. ""Dialog request:someString"" is the same as ""EnterBox request:'someString'"") |
585 | 88 |
|
89 |
[author:] |
|
90 |
Claus Gittinger |
|
91 |
||
92 |
[see also:] |
|
93 |
DialogBox |
|
593 | 94 |
EnterBox2 YesNoBox ListSelectionBox FileSelectionBox FileSaveBox |
95 |
EditField EditTextView |
|
96 |
EnterFieldGroup |
|
62 | 97 |
" |
98 |
! |
|
3 | 99 |
|
5896 | 100 |
examples |
62 | 101 |
" |
242 | 102 |
examples (for ST-80 compatibility, please use Dialog messages): |
103 |
||
104 |
simple (most common): |
|
593 | 105 |
[exBegin] |
242 | 106 |
|someString| |
107 |
||
108 |
someString := EnterBox request:'enter a string'. |
|
655 | 109 |
Transcript showCR:someString |
593 | 110 |
[exEnd] |
111 |
||
59 | 112 |
|
242 | 113 |
creating first, setting actions and manually opening: |
593 | 114 |
[exBegin] |
242 | 115 |
|box| |
116 |
||
117 |
box := EnterBox new. |
|
118 |
box title:'your name please:'. |
|
669
fef6f8160573
allow blank-trimming to be turned off
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
119 |
box action:[:arg | Transcript showCR:'entered: ''' , arg printString , '''']. |
fef6f8160573
allow blank-trimming to be turned off
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
120 |
box open |
fef6f8160573
allow blank-trimming to be turned off
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
121 |
[exEnd] |
fef6f8160573
allow blank-trimming to be turned off
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
122 |
|
fef6f8160573
allow blank-trimming to be turned off
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
123 |
|
fef6f8160573
allow blank-trimming to be turned off
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
124 |
turning off trimming of leading/trailing spaces (seldom required): |
fef6f8160573
allow blank-trimming to be turned off
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
125 |
[exBegin] |
fef6f8160573
allow blank-trimming to be turned off
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
126 |
|box| |
fef6f8160573
allow blank-trimming to be turned off
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
127 |
|
fef6f8160573
allow blank-trimming to be turned off
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
128 |
box := EnterBox new. |
fef6f8160573
allow blank-trimming to be turned off
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
129 |
box title:'your name please:'. |
fef6f8160573
allow blank-trimming to be turned off
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
130 |
box action:[:arg | Transcript showCR:'entered: ''' , arg printString , '''']. |
fef6f8160573
allow blank-trimming to be turned off
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
131 |
box trimBlanks:false. |
242 | 132 |
box open |
593 | 133 |
[exEnd] |
59 | 134 |
|
242 | 135 |
|
593 | 136 |
non-modal |
137 |
(just for the demo; it does not really make sense, |
|
138 |
since cancel-button has no effect): |
|
139 |
[exBegin] |
|
242 | 140 |
|box| |
8 | 141 |
|
242 | 142 |
box := EnterBox new. |
143 |
box title:'your name please:'. |
|
655 | 144 |
box action:[:arg | Transcript showCR:'entered: ' , arg printString]. |
242 | 145 |
box openModeless |
593 | 146 |
[exEnd] |
147 |
||
59 | 148 |
|
242 | 149 |
for easier instance creation, there are also some combination methods: |
593 | 150 |
[exBegin] |
242 | 151 |
|box| |
62 | 152 |
|
5896 | 153 |
box := EnterBox |
242 | 154 |
title:'your name please:' |
655 | 155 |
action:[:arg | Transcript showCR:'entered: ' , arg printString]. |
593 | 156 |
box open |
157 |
[exEnd] |
|
158 |
||
62 | 159 |
|
59 | 160 |
If the box is needed to ask for a simple string, you can also use the |
161 |
#request method, to bring up a box, let it ask for something and return |
|
162 |
the entered string. This method will return nil, if the box was |
|
163 |
closed with the 'abort' button. |
|
164 |
Example: |
|
593 | 165 |
[exBegin] |
242 | 166 |
|box string| |
59 | 167 |
|
242 | 168 |
box := EnterBox request:'input some string:'. |
169 |
string isNil ifTrue:[ |
|
655 | 170 |
Transcript showCR:'no input' |
242 | 171 |
] ifFalse:[ |
655 | 172 |
Transcript showCR:('the entered string was: ' , string) |
242 | 173 |
] |
593 | 174 |
[exEnd] |
175 |
||
38 | 176 |
|
59 | 177 |
of course, this can be written shorter as: |
593 | 178 |
[exBegin] |
242 | 179 |
|string| |
59 | 180 |
|
242 | 181 |
string := EnterBox request:'input some string:'. |
182 |
string isNil ifTrue:[ |
|
655 | 183 |
Transcript showCR:'no input' |
242 | 184 |
] ifFalse:[ |
655 | 185 |
Transcript showCR:('the entered string was: ' , string) |
242 | 186 |
] |
593 | 187 |
[exEnd] |
181 | 188 |
|
189 |
||
190 |
A box for passwords is created with: |
|
593 | 191 |
[exBegin] |
242 | 192 |
|box| |
181 | 193 |
|
5896 | 194 |
box := EnterBox |
242 | 195 |
title:'your name please:' |
655 | 196 |
action:[:arg | Transcript showCR:'entered: ' , arg printString]. |
242 | 197 |
box enterField passwordCharacter:$*. |
198 |
box showAtPointer |
|
593 | 199 |
[exEnd] |
200 |
||
181 | 201 |
|
202 |
or simply: |
|
593 | 203 |
[exBegin] |
242 | 204 |
|string| |
181 | 205 |
|
242 | 206 |
string := EnterBox requestPassword:'enter your password:'. |
655 | 207 |
Transcript showCR:string. |
593 | 208 |
[exEnd] |
209 |
||
210 |
ATTENTION: |
|
5896 | 211 |
for ST-80 compatibility, please use protocol from Dialog |
593 | 212 |
(which is an alias for DialogBox): |
213 |
[exBegin] |
|
214 |
|string| |
|
215 |
||
216 |
string := Dialog request:'input some string:'. |
|
217 |
string isNil ifTrue:[ |
|
655 | 218 |
Transcript showCR:'no input' |
593 | 219 |
] ifFalse:[ |
655 | 220 |
Transcript showCR:('the entered string was: ' , string) |
593 | 221 |
] |
222 |
[exEnd] |
|
5896 | 223 |
and: |
593 | 224 |
[exBegin] |
225 |
|string| |
|
226 |
||
227 |
string := Dialog requestPassword:'enter your password:'. |
|
655 | 228 |
Transcript showCR:string. |
593 | 229 |
[exEnd] |
3 | 230 |
" |
181 | 231 |
|
232 |
"Modified: 16.11.1995 / 21:28:11 / cg" |
|
3 | 233 |
! ! |
234 |
||
1613 | 235 |
!EnterBox class methodsFor:'instance creation'! |
0 | 236 |
|
237 |
action:aBlock |
|
5896 | 238 |
"create and return a new EnterBox |
5285 | 239 |
which will evaluate aBlock when 'ok' is pressed. |
5896 | 240 |
Obsolete (but kept for backward compatibility): |
5285 | 241 |
boxes are never used without a proper label" |
0 | 242 |
|
243 |
^ (self new) action:aBlock |
|
244 |
||
5285 | 245 |
" |
246 |
(EnterBox action:[:string | Transcript showCR:string]) showAtPointer |
|
247 |
(EnterBox action:[:string | Transcript showCR:string]) open |
|
248 |
(EnterBox action:[:string | Transcript showCR:string]) open |
|
249 |
" |
|
0 | 250 |
! |
251 |
||
62 | 252 |
title:titleString |
253 |
"create and return a new EnterBox with title aString" |
|
254 |
||
255 |
^ self new title:titleString |
|
256 |
! |
|
257 |
||
101 | 258 |
title:titleString action:aBlock |
259 |
"create and return a new EnterBox with title aString, |
|
260 |
which will evaluate aBlock when 'ok' is pressed" |
|
261 |
||
262 |
^ (self title:titleString) action:aBlock |
|
263 |
! |
|
264 |
||
197 | 265 |
title:titleString okText:okText abortText:abortText action:aBlock |
266 |
"create and return a new EnterBox with title aString, and buttons showing |
|
267 |
okText and abortText; it will evaluate aBlock when 'ok' is pressed" |
|
268 |
||
5896 | 269 |
^ (self title:titleString okText:okText action:aBlock) abortText:abortText |
197 | 270 |
! |
271 |
||
101 | 272 |
title:titleString okText:okText action:aBlock |
273 |
"create and return a new EnterBox with title aString, and ok button showing |
|
274 |
okText; it will evaluate aBlock when 'ok' is pressed" |
|
275 |
||
276 |
^ (self title:titleString action:aBlock) okText:okText |
|
77 | 277 |
! ! |
278 |
||
1613 | 279 |
!EnterBox class methodsFor:'defaults'! |
77 | 280 |
|
197 | 281 |
defaultExtent |
571 | 282 |
"return the default extent of my instances. |
283 |
The value returned here is usually ignored, and |
|
284 |
the value from preferredExtent taken instead." |
|
285 |
||
1613 | 286 |
^ (Screen current pixelPerMillimeter * (60 @ 20)) rounded |
571 | 287 |
|
1613 | 288 |
"Modified: / 22.1.1998 / 09:57:26 / md" |
289 |
"Modified: / 27.7.1998 / 20:15:52 / cg" |
|
197 | 290 |
! |
291 |
||
77 | 292 |
minExtent |
293 |
^ self defaultExtent |
|
294 |
! ! |
|
295 |
||
2447 | 296 |
!EnterBox class methodsFor:'easy startup'! |
77 | 297 |
|
298 |
request:aTitle |
|
299 |
"create and show an enterBox asking for aTitle. |
|
5607 | 300 |
Return the entered string or an empty string (if abort was pressed). |
77 | 301 |
The string may be empty, in case return was pressed immediately." |
302 |
||
303 |
^ self new request:aTitle |
|
304 |
||
305 |
" |
|
5286 | 306 |
EnterBox request:'Enter a string:' |
77 | 307 |
" |
306
6a6a1513b713
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods
Claus Gittinger <cg@exept.de>
parents:
242
diff
changeset
|
308 |
|
6a6a1513b713
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods
Claus Gittinger <cg@exept.de>
parents:
242
diff
changeset
|
309 |
"Modified: 27.1.1996 / 14:34:23 / cg" |
181 | 310 |
! |
311 |
||
312 |
requestPassword:aTitle |
|
313 |
"create and show an enterBox asking for aTitle. |
|
314 |
The box is setup to NOT display entered characters (as with password entry). |
|
315 |
Return the entered string or nil (if abort was pressed). |
|
316 |
The string may be empty, in case return was pressed immediately." |
|
317 |
||
318 |
^ self new requestPassword:aTitle |
|
319 |
||
320 |
" |
|
321 |
|s| |
|
322 |
||
5286 | 323 |
s := EnterBox requestPassword:'Enter a password string:'. |
324 |
Transcript showCR:'you entered: ' , s asString |
|
181 | 325 |
" |
326 |
||
327 |
"Created: 16.11.1995 / 21:25:08 / cg" |
|
77 | 328 |
! ! |
329 |
||
2227 | 330 |
!EnterBox methodsFor:'accessing-behavior'! |
669
fef6f8160573
allow blank-trimming to be turned off
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
331 |
|
fef6f8160573
allow blank-trimming to be turned off
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
332 |
entryCompletionBlock:aBlock |
fef6f8160573
allow blank-trimming to be turned off
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
333 |
"define an entryCompletion block; if nonNil, that one |
fef6f8160573
allow blank-trimming to be turned off
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
334 |
is evaluated if TAB is pressed in the field and should |
2628 | 335 |
try to complete the input. |
336 |
The block gets the current contents and the field itself as optional arguments |
|
337 |
(i.e. it can be a 0, 1 or 2-arg block). |
|
669
fef6f8160573
allow blank-trimming to be turned off
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
338 |
Typically used with fileName-boxes." |
fef6f8160573
allow blank-trimming to be turned off
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
339 |
|
fef6f8160573
allow blank-trimming to be turned off
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
340 |
enterField entryCompletionBlock:aBlock |
fef6f8160573
allow blank-trimming to be turned off
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
341 |
|
fef6f8160573
allow blank-trimming to be turned off
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
342 |
"Modified: 22.5.1996 / 15:19:31 / cg" |
fef6f8160573
allow blank-trimming to be turned off
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
343 |
! |
fef6f8160573
allow blank-trimming to be turned off
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
344 |
|
fef6f8160573
allow blank-trimming to be turned off
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
345 |
trimBlanks:aBoolean |
fef6f8160573
allow blank-trimming to be turned off
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
346 |
"set/clear blank trimming in the returned string. |
fef6f8160573
allow blank-trimming to be turned off
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
347 |
By default, leading and trailing spaces are removed from the input; |
fef6f8160573
allow blank-trimming to be turned off
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
348 |
setting trimBlanks to false disables this behavior. |
fef6f8160573
allow blank-trimming to be turned off
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
349 |
(not normally useful in most applications)" |
fef6f8160573
allow blank-trimming to be turned off
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
350 |
|
fef6f8160573
allow blank-trimming to be turned off
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
351 |
trimBlanks := aBoolean |
fef6f8160573
allow blank-trimming to be turned off
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
352 |
|
fef6f8160573
allow blank-trimming to be turned off
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
353 |
"Created: 22.5.1996 / 15:23:45 / cg" |
fef6f8160573
allow blank-trimming to be turned off
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
354 |
! ! |
fef6f8160573
allow blank-trimming to be turned off
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
355 |
|
2227 | 356 |
!EnterBox methodsFor:'accessing-components'! |
669
fef6f8160573
allow blank-trimming to be turned off
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
357 |
|
fef6f8160573
allow blank-trimming to be turned off
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
358 |
enterField |
fef6f8160573
allow blank-trimming to be turned off
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
359 |
"provide access to the entryfield" |
fef6f8160573
allow blank-trimming to be turned off
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
360 |
|
fef6f8160573
allow blank-trimming to be turned off
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
361 |
^ enterField |
fef6f8160573
allow blank-trimming to be turned off
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
362 |
|
fef6f8160573
allow blank-trimming to be turned off
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
363 |
"Created: 16.11.1995 / 21:23:48 / cg" |
fef6f8160573
allow blank-trimming to be turned off
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
364 |
! |
fef6f8160573
allow blank-trimming to be turned off
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
365 |
|
fef6f8160573
allow blank-trimming to be turned off
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
366 |
labelField |
fef6f8160573
allow blank-trimming to be turned off
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
367 |
"provide access to the labelfield" |
fef6f8160573
allow blank-trimming to be turned off
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
368 |
|
fef6f8160573
allow blank-trimming to be turned off
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
369 |
^ labelField |
fef6f8160573
allow blank-trimming to be turned off
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
370 |
|
fef6f8160573
allow blank-trimming to be turned off
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
371 |
"Created: 16.11.1995 / 21:23:48 / cg" |
fef6f8160573
allow blank-trimming to be turned off
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
372 |
! ! |
fef6f8160573
allow blank-trimming to be turned off
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
373 |
|
2227 | 374 |
!EnterBox methodsFor:'accessing-contents'! |
77 | 375 |
|
376 |
contents |
|
377 |
"return my contents" |
|
378 |
||
379 |
^ enterField contents |
|
380 |
! |
|
381 |
||
144 | 382 |
contents:aString |
383 |
"set my contents" |
|
384 |
||
385 |
enterField contents:aString |
|
386 |
! |
|
387 |
||
2728
9a63179c0d0f
+initialAnswer: for protocol completeness
Claus Gittinger <cg@exept.de>
parents:
2628
diff
changeset
|
388 |
initialAnswer:aString |
9a63179c0d0f
+initialAnswer: for protocol completeness
Claus Gittinger <cg@exept.de>
parents:
2628
diff
changeset
|
389 |
"for protocol compatibility - an alias for initialText:" |
9a63179c0d0f
+initialAnswer: for protocol completeness
Claus Gittinger <cg@exept.de>
parents:
2628
diff
changeset
|
390 |
|
9a63179c0d0f
+initialAnswer: for protocol completeness
Claus Gittinger <cg@exept.de>
parents:
2628
diff
changeset
|
391 |
self initialText:aString |
9a63179c0d0f
+initialAnswer: for protocol completeness
Claus Gittinger <cg@exept.de>
parents:
2628
diff
changeset
|
392 |
! |
9a63179c0d0f
+initialAnswer: for protocol completeness
Claus Gittinger <cg@exept.de>
parents:
2628
diff
changeset
|
393 |
|
77 | 394 |
initialText:aString |
395 |
"define the initial text in the enterfield. all will be selected initially" |
|
396 |
||
2444 | 397 |
self initialText:aString selected:true |
77 | 398 |
! |
399 |
||
197 | 400 |
initialText:aString selectFrom:start to:stop |
401 |
"define the initial text in the enterfield, and the part to be selected" |
|
402 |
||
2081 | 403 |
self initialText:aString. |
4557 | 404 |
self selectFromCharacterPosition:start to:stop |
2081 | 405 |
! |
406 |
||
2444 | 407 |
initialText:someString selected:selected |
408 |
"define the initial text in the enterfield; optionally, all is selected initially" |
|
409 |
||
410 |
enterField initialText:someString selected:selected |
|
411 |
! |
|
412 |
||
2081 | 413 |
selectFrom:start to:stop |
414 |
"define the initial selection in the enterfield" |
|
415 |
||
197 | 416 |
enterField selectFromLine:1 col:start toLine:1 col:stop |
4559 | 417 |
! |
418 |
||
419 |
selectFromCharacterPosition:start to:stop |
|
420 |
"define the initial selection in the enterfield" |
|
421 |
||
422 |
enterField selectFromCharacterPosition:start to:stop |
|
669
fef6f8160573
allow blank-trimming to be turned off
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
423 |
! ! |
197 | 424 |
|
2227 | 425 |
!EnterBox methodsFor:'accessing-look'! |
144 | 426 |
|
2020 | 427 |
noCancel |
428 |
"make the cancel button invisible - i.e. only the ok button is shown. |
|
429 |
Not useful here, but useful with display-only textBoxes." |
|
430 |
||
431 |
abortButton beInvisible. |
|
432 |
! |
|
433 |
||
77 | 434 |
title:aString |
435 |
"set the title to be displayed at top of enterBox" |
|
436 |
||
437 |
|oldSize| |
|
438 |
||
439 |
aString ~= labelField label ifTrue:[ |
|
3329 | 440 |
oldSize := labelField extent. |
441 |
labelField label:aString. |
|
442 |
labelField forceResize. |
|
77 | 443 |
|
3329 | 444 |
shown ifTrue:[ |
445 |
labelField extent ~= oldSize ifTrue:[ |
|
446 |
self resize |
|
447 |
] |
|
448 |
] ifFalse:[ |
|
449 |
self sizeChanged:nil. |
|
450 |
] |
|
77 | 451 |
] |
452 |
! |
|
453 |
||
454 |
title:titleString okText:okString |
|
455 |
"set title and text in okbutton" |
|
456 |
||
457 |
(titleString ~= labelField label or:[okString ~= okButton label]) ifTrue:[ |
|
3329 | 458 |
okButton label:okString. |
459 |
okButton resize. |
|
460 |
labelField label:titleString. |
|
461 |
labelField forceResize. |
|
5896 | 462 |
shown |
3329 | 463 |
ifTrue:[self resize] |
464 |
ifFalse:[ self sizeChanged:nil]. |
|
77 | 465 |
] |
466 |
! |
|
467 |
||
468 |
title:titleString okText:okString abortText:abortString |
|
469 |
"set title and texts in the buttons" |
|
470 |
||
5896 | 471 |
(titleString ~= labelField label |
77 | 472 |
or:[okString ~= okButton label |
473 |
or:[abortString ~= abortButton label]]) ifTrue:[ |
|
3329 | 474 |
okButton label:okString. |
475 |
okButton resize. |
|
476 |
abortButton label:abortString. |
|
477 |
abortButton resize. |
|
478 |
labelField label:titleString. |
|
479 |
labelField forceResize. |
|
5896 | 480 |
shown |
3329 | 481 |
ifTrue:[self resize] |
482 |
ifFalse:[ self sizeChanged:nil]. |
|
77 | 483 |
] |
197 | 484 |
! ! |
181 | 485 |
|
197 | 486 |
!EnterBox methodsFor:'change & update'! |
181 | 487 |
|
197 | 488 |
update:something with:someArgument from:changedObject |
489 |
"sent if my enterbox thinks it needs more real-estate ..." |
|
181 | 490 |
|
197 | 491 |
changedObject == enterField ifTrue:[ |
492 |
something == #preferredExtent ifTrue:[ |
|
493 |
shown ifTrue:[self resizeUnderPointer]. |
|
494 |
^ self |
|
495 |
] |
|
496 |
]. |
|
497 |
super update:something with:someArgument from:changedObject |
|
0 | 498 |
! ! |
499 |
||
500 |
!EnterBox methodsFor:'initialization'! |
|
501 |
||
2555
c2d277241837
refactored enterField creation
Claus Gittinger <cg@exept.de>
parents:
2542
diff
changeset
|
502 |
addEnterField:aWidget |
c2d277241837
refactored enterField creation
Claus Gittinger <cg@exept.de>
parents:
2542
diff
changeset
|
503 |
|space2 innerWidth| |
c2d277241837
refactored enterField creation
Claus Gittinger <cg@exept.de>
parents:
2542
diff
changeset
|
504 |
|
c2d277241837
refactored enterField creation
Claus Gittinger <cg@exept.de>
parents:
2542
diff
changeset
|
505 |
enterField notNil ifTrue:[ |
c2d277241837
refactored enterField creation
Claus Gittinger <cg@exept.de>
parents:
2542
diff
changeset
|
506 |
enterField removeDependent:self. |
c2d277241837
refactored enterField creation
Claus Gittinger <cg@exept.de>
parents:
2542
diff
changeset
|
507 |
enterField destroy. |
c2d277241837
refactored enterField creation
Claus Gittinger <cg@exept.de>
parents:
2542
diff
changeset
|
508 |
enterField := nil. |
c2d277241837
refactored enterField creation
Claus Gittinger <cg@exept.de>
parents:
2542
diff
changeset
|
509 |
]. |
5286 | 510 |
enterField := aWidget. |
2555
c2d277241837
refactored enterField creation
Claus Gittinger <cg@exept.de>
parents:
2542
diff
changeset
|
511 |
|
3937 | 512 |
space2 := 2 * ViewSpacing. |
513 |
innerWidth := width - space2. |
|
2555
c2d277241837
refactored enterField creation
Claus Gittinger <cg@exept.de>
parents:
2542
diff
changeset
|
514 |
|
5286 | 515 |
self addComponent:aWidget. |
5896 | 516 |
enterField |
4087 | 517 |
width:1.0; |
518 |
origin:[0.0 @ (space2 + labelField preferredHeight "height")]; |
|
5896 | 519 |
leftInset:ViewSpacing-aWidget borderWidth; |
4358 | 520 |
rightInset:1 "ViewSpacing". |
2555
c2d277241837
refactored enterField creation
Claus Gittinger <cg@exept.de>
parents:
2542
diff
changeset
|
521 |
|
5286 | 522 |
aWidget addDependent:self. "to get preferredExtent-changes" |
2555
c2d277241837
refactored enterField creation
Claus Gittinger <cg@exept.de>
parents:
2542
diff
changeset
|
523 |
|
5286 | 524 |
self makeTabable:aWidget |
2555
c2d277241837
refactored enterField creation
Claus Gittinger <cg@exept.de>
parents:
2542
diff
changeset
|
525 |
|
4358 | 526 |
"Modified: / 23-01-2012 / 17:30:17 / cg" |
2555
c2d277241837
refactored enterField creation
Claus Gittinger <cg@exept.de>
parents:
2542
diff
changeset
|
527 |
! |
c2d277241837
refactored enterField creation
Claus Gittinger <cg@exept.de>
parents:
2542
diff
changeset
|
528 |
|
77 | 529 |
createEnterField |
530 |
"this has been extracted from the initialize method |
|
121 | 531 |
to allow redefinition in subclasses. (FilenameEnterBox for example). |
532 |
It shall return a new instance of the desired editField class." |
|
77 | 533 |
|
2555
c2d277241837
refactored enterField creation
Claus Gittinger <cg@exept.de>
parents:
2542
diff
changeset
|
534 |
|widget| |
c2d277241837
refactored enterField creation
Claus Gittinger <cg@exept.de>
parents:
2542
diff
changeset
|
535 |
|
c2d277241837
refactored enterField creation
Claus Gittinger <cg@exept.de>
parents:
2542
diff
changeset
|
536 |
widget := EditField new. |
c2d277241837
refactored enterField creation
Claus Gittinger <cg@exept.de>
parents:
2542
diff
changeset
|
537 |
widget leaveAction:[:key | self okPressed]. |
c2d277241837
refactored enterField creation
Claus Gittinger <cg@exept.de>
parents:
2542
diff
changeset
|
538 |
^ widget |
77 | 539 |
! |
540 |
||
0 | 541 |
initialize |
90 | 542 |
|space2 innerWidth| |
0 | 543 |
|
544 |
super initialize. |
|
545 |
||
1763 | 546 |
self addAbortAndOkButtons. |
77 | 547 |
|
669
fef6f8160573
allow blank-trimming to be turned off
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
548 |
trimBlanks := true. |
5286 | 549 |
label := resources string:'Enter'. "/ bad name: this is the window label |
73 | 550 |
|
0 | 551 |
space2 := 2 * ViewSpacing. |
73 | 552 |
innerWidth := width - space2. |
0 | 553 |
|
3937 | 554 |
labelField := Label in:self. |
5896 | 555 |
labelField |
556 |
label:''; |
|
669
fef6f8160573
allow blank-trimming to be turned off
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
557 |
borderWidth:0; |
fef6f8160573
allow blank-trimming to be turned off
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
558 |
adjust:#left; |
fef6f8160573
allow blank-trimming to be turned off
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
559 |
origin:(0.0 @ ViewSpacing) extent:[1.0 @ labelField height]; |
5896 | 560 |
leftInset:ViewSpacing; |
669
fef6f8160573
allow blank-trimming to be turned off
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
561 |
rightInset:ViewSpacing. |
0 | 562 |
|
2555
c2d277241837
refactored enterField creation
Claus Gittinger <cg@exept.de>
parents:
2542
diff
changeset
|
563 |
self addEnterField:(self createEnterField). |
3943
253c9ebed9fe
yPosition fixes when adding components in the aboutToOpen hook.
Claus Gittinger <cg@exept.de>
parents:
3937
diff
changeset
|
564 |
yPosition := enterField bottom + ViewSpacing. |
0 | 565 |
! |
566 |
||
567 |
reAdjustGeometry |
|
5286 | 568 |
"sent late in the setup process - gives me a chance |
0 | 569 |
to resize for new font dimensions" |
570 |
||
571 |
super reAdjustGeometry. |
|
572 |
labelField resize. |
|
573 |
okButton resize. |
|
574 |
abortButton resize. |
|
575 |
self resize |
|
59 | 576 |
! ! |
577 |
||
62 | 578 |
!EnterBox methodsFor:'queries'! |
0 | 579 |
|
5896 | 580 |
preferredExtent |
572 | 581 |
"compute the boxes preferredExtent from the components' sizes" |
582 |
||
6141 | 583 |
|wWanted hWanted vs2 min |
110 | 584 |
labelPref enterPref panelPref| |
59 | 585 |
|
5324 | 586 |
"/ If I have an explicit preferredExtent.. |
587 |
explicitExtent notNil ifTrue:[ |
|
588 |
^ explicitExtent |
|
589 |
]. |
|
590 |
||
591 |
"/ If I have a cached preferredExtent value.. |
|
592 |
preferredExtent notNil ifTrue:[ |
|
593 |
^ preferredExtent |
|
594 |
]. |
|
713
0c38ad51016d
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
669
diff
changeset
|
595 |
|
5324 | 596 |
panelPref := buttonPanel preferredExtent. |
597 |
labelPref := labelField preferredExtent. |
|
598 |
enterPref := enterField preferredExtent. |
|
6141 | 599 |
wWanted := (labelPref x max:enterPref x) max:panelPref x. |
600 |
||
5324 | 601 |
hWanted := labelPref y + ViewSpacing + enterPref y + |
602 |
ViewSpacing + panelPref y + ViewSpacing. |
|
603 |
verticalPanel notNil ifTrue:[ |
|
5896 | 604 |
hWanted := hWanted + ViewSpacing + (verticalPanel preferredHeight). |
5324 | 605 |
]. |
606 |
||
6141 | 607 |
vs2 := ViewSpacing * 2. |
5324 | 608 |
min := self class minExtent. |
6141 | 609 |
wWanted := (wWanted max: min x) + vs2. |
610 |
hWanted := (hWanted max: min y) + vs2. |
|
572 | 611 |
|
6141 | 612 |
^ wWanted @ hWanted |
613 |
||
614 |
"Modified: / 22-01-1998 / 09:57:55 / md" |
|
615 |
"Modified: / 27-07-1998 / 20:18:41 / cg" |
|
616 |
"Modified: / 30-03-2017 / 18:42:12 / stefan" |
|
0 | 617 |
! ! |
618 |
||
77 | 619 |
!EnterBox methodsFor:'startup'! |
620 |
||
621 |
request |
|
306
6a6a1513b713
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods
Claus Gittinger <cg@exept.de>
parents:
242
diff
changeset
|
622 |
"open the box and return the entered string |
6a6a1513b713
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods
Claus Gittinger <cg@exept.de>
parents:
242
diff
changeset
|
623 |
or an empty string, if abort was pressed" |
77 | 624 |
|
306
6a6a1513b713
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods
Claus Gittinger <cg@exept.de>
parents:
242
diff
changeset
|
625 |
^ self requestOnCancel:'' |
6a6a1513b713
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods
Claus Gittinger <cg@exept.de>
parents:
242
diff
changeset
|
626 |
|
6a6a1513b713
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods
Claus Gittinger <cg@exept.de>
parents:
242
diff
changeset
|
627 |
"Modified: 27.1.1996 / 14:50:01 / cg" |
0 | 628 |
! |
629 |
||
77 | 630 |
request:title |
242 | 631 |
"set the title, open the box and return the entered string, |
306
6a6a1513b713
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods
Claus Gittinger <cg@exept.de>
parents:
242
diff
changeset
|
632 |
or the empty string, if abort was pressed." |
0 | 633 |
|
306
6a6a1513b713
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods
Claus Gittinger <cg@exept.de>
parents:
242
diff
changeset
|
634 |
^ self request:title onCancel:'' |
242 | 635 |
|
636 |
" |
|
5896 | 637 |
EnterBox request:'enter some string:' |
242 | 638 |
|
639 |
|bx| |
|
640 |
bx := EnterBox new. |
|
641 |
bx label:'foo bar baz'. |
|
5896 | 642 |
bx request:'enter some string:' |
242 | 643 |
" |
644 |
||
645 |
"Created: 7.12.1995 / 23:12:19 / cg" |
|
306
6a6a1513b713
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods
Claus Gittinger <cg@exept.de>
parents:
242
diff
changeset
|
646 |
"Modified: 27.1.1996 / 14:49:23 / cg" |
181 | 647 |
! |
648 |
||
306
6a6a1513b713
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods
Claus Gittinger <cg@exept.de>
parents:
242
diff
changeset
|
649 |
request:title onCancel:cancelValue |
6a6a1513b713
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods
Claus Gittinger <cg@exept.de>
parents:
242
diff
changeset
|
650 |
"set the title, open the box and return the entered string, |
6a6a1513b713
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods
Claus Gittinger <cg@exept.de>
parents:
242
diff
changeset
|
651 |
or cancelValue if abort was pressed." |
6a6a1513b713
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods
Claus Gittinger <cg@exept.de>
parents:
242
diff
changeset
|
652 |
|
6a6a1513b713
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods
Claus Gittinger <cg@exept.de>
parents:
242
diff
changeset
|
653 |
self title:title. |
6a6a1513b713
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods
Claus Gittinger <cg@exept.de>
parents:
242
diff
changeset
|
654 |
^ self requestOnCancel:cancelValue |
6a6a1513b713
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods
Claus Gittinger <cg@exept.de>
parents:
242
diff
changeset
|
655 |
|
6a6a1513b713
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods
Claus Gittinger <cg@exept.de>
parents:
242
diff
changeset
|
656 |
" |
6a6a1513b713
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods
Claus Gittinger <cg@exept.de>
parents:
242
diff
changeset
|
657 |
EnterBox request:'enter some string:' onCancel:nil |
181 | 658 |
|
306
6a6a1513b713
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods
Claus Gittinger <cg@exept.de>
parents:
242
diff
changeset
|
659 |
|bx| |
6a6a1513b713
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods
Claus Gittinger <cg@exept.de>
parents:
242
diff
changeset
|
660 |
bx := EnterBox new. |
6a6a1513b713
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods
Claus Gittinger <cg@exept.de>
parents:
242
diff
changeset
|
661 |
bx label:'foo bar baz'. |
5896 | 662 |
bx request:'enter some string:' onCancel:#foo |
306
6a6a1513b713
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods
Claus Gittinger <cg@exept.de>
parents:
242
diff
changeset
|
663 |
" |
6a6a1513b713
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods
Claus Gittinger <cg@exept.de>
parents:
242
diff
changeset
|
664 |
|
6a6a1513b713
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods
Claus Gittinger <cg@exept.de>
parents:
242
diff
changeset
|
665 |
"Created: 7.12.1995 / 23:12:19 / cg" |
6a6a1513b713
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods
Claus Gittinger <cg@exept.de>
parents:
242
diff
changeset
|
666 |
"Modified: 27.1.1996 / 14:48:39 / cg" |
6a6a1513b713
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods
Claus Gittinger <cg@exept.de>
parents:
242
diff
changeset
|
667 |
! |
181 | 668 |
|
306
6a6a1513b713
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods
Claus Gittinger <cg@exept.de>
parents:
242
diff
changeset
|
669 |
requestOnCancel:cancelValue |
5896 | 670 |
"open the box and return the entered string |
306
6a6a1513b713
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods
Claus Gittinger <cg@exept.de>
parents:
242
diff
changeset
|
671 |
or cancelValue, if abort was pressed" |
6a6a1513b713
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods
Claus Gittinger <cg@exept.de>
parents:
242
diff
changeset
|
672 |
|
6a6a1513b713
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods
Claus Gittinger <cg@exept.de>
parents:
242
diff
changeset
|
673 |
self action:[:string | ^ string]. |
6a6a1513b713
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods
Claus Gittinger <cg@exept.de>
parents:
242
diff
changeset
|
674 |
self open. |
6a6a1513b713
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods
Claus Gittinger <cg@exept.de>
parents:
242
diff
changeset
|
675 |
^ cancelValue value |
6a6a1513b713
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods
Claus Gittinger <cg@exept.de>
parents:
242
diff
changeset
|
676 |
|
6a6a1513b713
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods
Claus Gittinger <cg@exept.de>
parents:
242
diff
changeset
|
677 |
"Created: 27.1.1996 / 14:47:47 / cg" |
181 | 678 |
! |
679 |
||
680 |
requestPassword:title |
|
5896 | 681 |
"set the title, set password mode, open the box and return the entered string |
1879
25ac1b89ed31
change: return nil if cancel is pressed in #requestPassword.
Claus Gittinger <cg@exept.de>
parents:
1790
diff
changeset
|
682 |
or nil, if abort was pressed" |
306
6a6a1513b713
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods
Claus Gittinger <cg@exept.de>
parents:
242
diff
changeset
|
683 |
|
1879
25ac1b89ed31
change: return nil if cancel is pressed in #requestPassword.
Claus Gittinger <cg@exept.de>
parents:
1790
diff
changeset
|
684 |
^ self requestPassword:title onCancel:nil |
306
6a6a1513b713
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods
Claus Gittinger <cg@exept.de>
parents:
242
diff
changeset
|
685 |
|
6a6a1513b713
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods
Claus Gittinger <cg@exept.de>
parents:
242
diff
changeset
|
686 |
"Created: 16.11.1995 / 21:25:33 / cg" |
6a6a1513b713
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods
Claus Gittinger <cg@exept.de>
parents:
242
diff
changeset
|
687 |
"Modified: 27.1.1996 / 14:52:36 / cg" |
6a6a1513b713
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods
Claus Gittinger <cg@exept.de>
parents:
242
diff
changeset
|
688 |
! |
6a6a1513b713
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods
Claus Gittinger <cg@exept.de>
parents:
242
diff
changeset
|
689 |
|
6a6a1513b713
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods
Claus Gittinger <cg@exept.de>
parents:
242
diff
changeset
|
690 |
requestPassword:title onCancel:cancelValue |
5896 | 691 |
"set the title, set password mode, open the box and return the entered string |
306
6a6a1513b713
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods
Claus Gittinger <cg@exept.de>
parents:
242
diff
changeset
|
692 |
or cancelValue, if abort was pressed" |
181 | 693 |
|
3586 | 694 |
enterField bePassword. |
306
6a6a1513b713
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods
Claus Gittinger <cg@exept.de>
parents:
242
diff
changeset
|
695 |
^ self request:title onCancel:cancelValue |
181 | 696 |
|
306
6a6a1513b713
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods
Claus Gittinger <cg@exept.de>
parents:
242
diff
changeset
|
697 |
"Modified: 27.1.1996 / 14:34:07 / cg" |
6a6a1513b713
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods
Claus Gittinger <cg@exept.de>
parents:
242
diff
changeset
|
698 |
"Created: 27.1.1996 / 14:52:13 / cg" |
77 | 699 |
! ! |
197 | 700 |
|
701 |
!EnterBox methodsFor:'user actions'! |
|
702 |
||
2542
53fc213c8815
refactored action evaluation
Claus Gittinger <cg@exept.de>
parents:
2447
diff
changeset
|
703 |
actionArgument |
5286 | 704 |
"fetch the entered string, optionally trim spaces and return it" |
197 | 705 |
|
706 |
|string| |
|
707 |
||
2542
53fc213c8815
refactored action evaluation
Claus Gittinger <cg@exept.de>
parents:
2447
diff
changeset
|
708 |
string := self contents. |
53fc213c8815
refactored action evaluation
Claus Gittinger <cg@exept.de>
parents:
2447
diff
changeset
|
709 |
string isNil ifTrue:[ |
53fc213c8815
refactored action evaluation
Claus Gittinger <cg@exept.de>
parents:
2447
diff
changeset
|
710 |
string := '' |
53fc213c8815
refactored action evaluation
Claus Gittinger <cg@exept.de>
parents:
2447
diff
changeset
|
711 |
] ifFalse:[ |
53fc213c8815
refactored action evaluation
Claus Gittinger <cg@exept.de>
parents:
2447
diff
changeset
|
712 |
trimBlanks ifTrue:[ |
53fc213c8815
refactored action evaluation
Claus Gittinger <cg@exept.de>
parents:
2447
diff
changeset
|
713 |
string := string withoutSeparators |
53fc213c8815
refactored action evaluation
Claus Gittinger <cg@exept.de>
parents:
2447
diff
changeset
|
714 |
] |
197 | 715 |
]. |
669
fef6f8160573
allow blank-trimming to be turned off
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
716 |
|
2542
53fc213c8815
refactored action evaluation
Claus Gittinger <cg@exept.de>
parents:
2447
diff
changeset
|
717 |
^ string |
197 | 718 |
! ! |
719 |
||
1613 | 720 |
!EnterBox class methodsFor:'documentation'! |
242 | 721 |
|
722 |
version |
|
5607 | 723 |
^ '$Header$' |
4087 | 724 |
! |
725 |
||
726 |
version_CVS |
|
5607 | 727 |
^ '$Header$' |
242 | 728 |
! ! |
4557 | 729 |