author | Claus Gittinger <cg@exept.de> |
Sat, 05 Feb 2000 15:20:44 +0100 | |
changeset 2116 | c51b55fda393 |
parent 2112 | 46a837520f47 |
child 2126 | a2e54b57e1af |
permissions | -rw-r--r-- |
76 | 1 |
" |
2 |
COPYRIGHT (c) 1994 by Claus Gittinger |
|
3 |
All Rights Reserved |
|
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 |
ModalBox subclass:#DialogBox |
|
253
f071ff350cd5
added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents:
241
diff
changeset
|
14 |
instanceVariableNames:'buttonPanel okButton okAction abortButton abortAction |
950
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
15 |
acceptReturnAsOK yPosition leftIndent rightIndent addedComponents |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
16 |
inputFieldGroup acceptOnLeave acceptValue tabableElements |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
17 |
hideOnAccept acceptCheck needResize autoAccept focusToOKOnLeave |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
18 |
bindings namedComponents' |
1757 | 19 |
classVariableNames:'DefaultFocusToOKOnLeave' |
253
f071ff350cd5
added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents:
241
diff
changeset
|
20 |
poolDictionaries:'' |
f071ff350cd5
added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents:
241
diff
changeset
|
21 |
category:'Views-DialogBoxes' |
76 | 22 |
! |
23 |
||
846
75c5dc601522
added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents:
831
diff
changeset
|
24 |
!DialogBox class methodsFor:'documentation'! |
76 | 25 |
|
197 | 26 |
copyright |
27 |
" |
|
28 |
COPYRIGHT (c) 1994 by Claus Gittinger |
|
29 |
All Rights Reserved |
|
30 |
||
31 |
This software is furnished under a license and may be used |
|
32 |
only in accordance with the terms of that license and with the |
|
33 |
inclusion of the above copyright notice. This software may not |
|
34 |
be provided or otherwise made available to, or used by, any |
|
35 |
other person. No title to or ownership of the software is |
|
36 |
hereby transferred. |
|
37 |
" |
|
76 | 38 |
! |
39 |
||
40 |
documentation |
|
41 |
" |
|
42 |
this class implements the common behavior of dialogboxes. |
|
43 |
||
647 | 44 |
DialogBox is also a superclass of many other boxes - see InfoBox, |
76 | 45 |
WarningBox, YesNoBox etc. for concrete examples. |
46 |
Most of them simply add buttons or other elements. |
|
47 |
||
121 | 48 |
For programmatically created boxes, instances support adding of components |
49 |
in a top-to-bottom fashion, and also keep track of added text-fields and, |
|
50 |
since they are most common, automatically create an EnterFieldGroup for |
|
51 |
them. |
|
950
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
52 |
|
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
53 |
Caveat: |
1401 | 54 |
more adding support is required - especially for row-wise |
55 |
construction. |
|
56 |
The programmatic interface is best suited for row-wise |
|
57 |
arranged components; laying out elements in columns is a bit |
|
58 |
complicate - for complicated dialogs, it may be better to not use |
|
59 |
the automatic arrangement, but instead give explicit layouts to |
|
60 |
the components (in a subclass). |
|
122 | 61 |
|
600 | 62 |
Compatibility note: |
1401 | 63 |
For ST-80 compatibility, DialogBox is also accessable under |
64 |
the global named 'Dialog' (which is the name of an ST-80 class, |
|
65 |
providing a very similar protocol). |
|
66 |
This may lead to confusion, if DialogBox is recompiled - you have |
|
67 |
to manually assign Dialog again to refer to the new DialogBox class. |
|
68 |
In future versions of ST/X, DialogBox may be renamed to Dialog. |
|
600 | 69 |
|
183 | 70 |
Historic note: |
1401 | 71 |
originally, ST/X had separate classes for the various entry methods; |
72 |
there were YesNoBox, EnterBox, InfoBox and so on. |
|
73 |
ST-80 has all this defined in the common Dialog. |
|
74 |
Therefore, for compatibility, many ST/X methods defined here in Dialogs |
|
75 |
class protocol simply dispatch to some other boxes class method. |
|
76 |
In the future, those existing subclasses' functionality is going to |
|
77 |
be moved full into Dialog, and the subclasses will be replaced by dummy |
|
78 |
delegators. (They will be kept for backward compatibility, though). |
|
183 | 79 |
|
121 | 80 |
|
585 | 81 |
[instance variables:] |
76 | 82 |
|
1401 | 83 |
buttonPanel <PanelView> contains the button(s) |
84 |
||
85 |
okButton <Button> the ok-Button |
|
86 |
||
87 |
okAction <Block> the action to be performed when ok is pressed, |
|
88 |
or return is pressed. |
|
89 |
||
90 |
acceptReturnAsOK <Boolean> if true, pressing the return-key counts |
|
91 |
as if ok was pressed. Default is true. |
|
92 |
||
93 |
abortButton <Button> the cancel-Button |
|
94 |
||
95 |
abortAction <Block> the action to be performed when cancel is |
|
96 |
pressed. |
|
97 |
||
98 |
yPosisition <Integer> current y position when adding components |
|
99 |
||
100 |
leftIndent <Integer> left inset to use when adding components |
|
101 |
||
102 |
rightIndent <Integer> right inset to use when adding components |
|
103 |
||
104 |
addedComponents <Collection> programmatically added components |
|
105 |
||
106 |
inputFieldGroup <EnterFieldGroup> |
|
107 |
for added input fields |
|
108 |
||
109 |
acceptOnLeave <Boolean> if true (the default) and there are |
|
110 |
tabable inputFields, accept and close when |
|
111 |
the last field is left. If false, the ok |
|
112 |
button must be pressed to close the box. |
|
113 |
||
114 |
acceptedValue v(<Boolean>) valueHolder on a boolean |
|
115 |
after close: holds true if box was accepted |
|
116 |
(i.e. ok-Button was pressed), false if box was |
|
117 |
closed via cancel or window manager. |
|
118 |
||
119 |
autoAccept Boolean if true, pressing ok (or return) |
|
120 |
sends #accept to all subcomponents. |
|
121 |
I.e. all subfields update their models |
|
122 |
first. The default is true. |
|
469
1d86f97ab2e5
autoAccept as default; configurable
Claus Gittinger <cg@exept.de>
parents:
436
diff
changeset
|
123 |
|
100 | 124 |
For compatibility with ST-80, this class is also available under |
125 |
the global names DialogView and Dialog (see patches file). |
|
585 | 126 |
|
127 |
[author:] |
|
1401 | 128 |
Claus Gittinger |
593 | 129 |
|
130 |
[see also:] |
|
1401 | 131 |
Button CheckToggle Toggle |
132 |
EditField SelectionInListView FileSelectionList |
|
133 |
FramedBox Separator |
|
134 |
( introduction to view programming :html: programming/viewintro.html ) |
|
76 | 135 |
" |
136 |
! |
|
137 |
||
138 |
examples |
|
139 |
" |
|
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
140 |
historically, DialogBox was used as an abstract class as a base for InfoBox, |
600 | 141 |
YesNoBox etc. |
142 |
However, the programmatic construction protocol (#addComponent:) |
|
143 |
now allows those classes to be easily replaced and future versions of |
|
144 |
ST/X may do this and make those subclasses obsolete. |
|
145 |
However, dummy stubs will remain to exist for backward compatibility |
|
146 |
(i.e. do not fear using YesNoBox, EnterBox etc.) |
|
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
147 |
|
125 | 148 |
For most simple standard dialogs, there are ready to use |
149 |
methods in the class protocol. |
|
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
150 |
|
125 | 151 |
For example: |
152 |
||
153 |
info & warnings: |
|
1401 | 154 |
[exBegin] |
155 |
Dialog information:'hi there' |
|
156 |
[exEnd] |
|
157 |
[exBegin] |
|
158 |
Dialog warn:'oops' |
|
159 |
[exEnd] |
|
125 | 160 |
|
161 |
||
162 |
yes/no questions: |
|
1401 | 163 |
[exBegin] |
164 |
(Dialog confirm:'is this simple ?') |
|
165 |
ifTrue:[ |
|
166 |
Transcript showCR:'thats what I expected' |
|
167 |
] ifFalse:[ |
|
168 |
Transcript showCR:'read more examples and documentation' |
|
169 |
] |
|
170 |
[exEnd] |
|
125 | 171 |
|
172 |
||
173 |
yes/no question with cancel option: |
|
1401 | 174 |
[exBegin] |
175 |
|answer| |
|
176 |
||
177 |
answer := Dialog confirmWithCancel:'is this simple ?'. |
|
178 |
answer isNil ifTrue:[ |
|
179 |
Transcript showCR:'no easy decision' |
|
180 |
] ifFalse:[ |
|
181 |
answer ifTrue:[ |
|
182 |
Transcript showCR:'thats what I expected' |
|
183 |
] ifFalse:[ |
|
184 |
Transcript showCR:'read more examples and documentation' |
|
185 |
] |
|
186 |
] |
|
187 |
[exEnd] |
|
125 | 188 |
|
189 |
||
190 |
asking for a string: |
|
1401 | 191 |
[exBegin] |
192 |
|s| |
|
193 |
||
194 |
s := Dialog request:'enter your name, please:'. |
|
195 |
s notEmpty ifTrue:[ |
|
196 |
Transcript showCR:'you entered: ' , s. |
|
197 |
] |
|
198 |
[exEnd] |
|
125 | 199 |
|
200 |
||
201 |
asking for a string with given default: |
|
1401 | 202 |
[exBegin] |
203 |
|s| |
|
204 |
||
205 |
s := Dialog |
|
206 |
request:'enter your name, please:' |
|
207 |
initialAnswer:(OperatingSystem getLoginName). |
|
208 |
s notEmpty ifTrue:[ |
|
209 |
Transcript showCR:'you entered: ' , s. |
|
210 |
] |
|
211 |
[exEnd] |
|
125 | 212 |
|
213 |
||
214 |
asking for a filename: |
|
1401 | 215 |
[exBegin] |
216 |
|s| |
|
217 |
||
218 |
s := Dialog |
|
219 |
requestFileName:'select a file, please:' |
|
220 |
default:''. |
|
221 |
Transcript show:'you entered: '; showCR:s. |
|
222 |
[exEnd] |
|
125 | 223 |
|
224 |
||
1030 | 225 |
with a namefiler pattern: |
1401 | 226 |
[exBegin] |
227 |
|s| |
|
228 |
||
229 |
s := Dialog |
|
230 |
requestFileName:'select a file, please:' |
|
231 |
default:'' |
|
232 |
pattern:'*.rc'. |
|
233 |
Transcript show:'you entered: '; showCR:s. |
|
234 |
[exEnd] |
|
1030 | 235 |
|
236 |
||
237 |
another namefiler pattern: |
|
1401 | 238 |
[exBegin] |
239 |
|s| |
|
240 |
||
241 |
s := Dialog |
|
242 |
requestFileName:'select a file, please:' |
|
243 |
default:'' |
|
244 |
pattern:'*.rc;*.st;*.h'. |
|
245 |
Transcript show:'you entered: '; showCR:s. |
|
246 |
[exEnd] |
|
1030 | 247 |
|
248 |
||
125 | 249 |
with changed button label and pattern: |
1401 | 250 |
[exBegin] |
251 |
|s| |
|
252 |
||
253 |
s := Dialog |
|
254 |
requestFileName:'select a file, please:' |
|
255 |
default:'' |
|
256 |
ok:'show' |
|
257 |
abort:'cancel' |
|
258 |
pattern:'*.rc'. |
|
259 |
Transcript show:'you entered: '; showCR:s. |
|
260 |
[exEnd] |
|
125 | 261 |
|
302 | 262 |
|
263 |
asking for a password: |
|
1401 | 264 |
[exBegin] |
265 |
|s| |
|
266 |
||
267 |
s := Dialog |
|
268 |
requestPassword:'enter your secret, please:'. |
|
269 |
Transcript show:'you entered: '; showCR:s. |
|
270 |
[exEnd] |
|
302 | 271 |
|
645 | 272 |
multiple choice dialogs: |
1401 | 273 |
[exBegin] |
274 |
Dialog |
|
275 |
choose:'choose any' |
|
276 |
fromList:nil |
|
277 |
values:nil |
|
278 |
buttons:#('one' 'two' 'three' 'four') |
|
279 |
values:#(1 2 3 4) |
|
280 |
lines:nil |
|
281 |
cancel:nil |
|
282 |
[exEnd] |
|
645 | 283 |
|
284 |
multiple choice dialog, with list & buttons: |
|
1401 | 285 |
[exBegin] |
286 |
Transcript showCR:( |
|
287 |
Dialog |
|
288 |
choose:'choose example' |
|
289 |
fromList:#('one' 'two' 'three' 'four') |
|
290 |
values:#(1 2 3 4) |
|
291 |
buttons:#('five' 'six' 'seven') |
|
292 |
values:#(5 6 7) |
|
293 |
lines:4 |
|
294 |
cancel:[Transcript flash. #aborted] |
|
295 |
) |
|
296 |
[exEnd] |
|
645 | 297 |
|
298 |
You can (and often have to) construct custom dialogs programmatically, |
|
299 |
from individual components. As shown in the following examples: |
|
91 | 300 |
|
121 | 301 |
basic (unusable) example: |
1401 | 302 |
[exBegin] |
303 |
DialogBox new open |
|
304 |
[exEnd] |
|
76 | 305 |
|
121 | 306 |
still unusable - only an ok-button: |
1401 | 307 |
[exBegin] |
308 |
DialogBox new addOkButton; open |
|
309 |
[exEnd] |
|
121 | 310 |
|
311 |
both ok- and abortButtons: |
|
1401 | 312 |
[exBegin] |
313 |
DialogBox new addAbortButton; addOkButton; open |
|
314 |
[exEnd] |
|
121 | 315 |
|
122 | 316 |
with different ok-label: |
1401 | 317 |
[exBegin] |
318 |
DialogBox new addAbortButton; addOkButtonLabelled:'yeah'; open |
|
319 |
[exEnd] |
|
122 | 320 |
|
645 | 321 |
adding a (centered by default) textlabel gives an infoBox: |
1401 | 322 |
[exBegin] |
323 |
DialogBox new |
|
324 |
addTextLabel:'hello'; |
|
325 |
addOkButton; |
|
326 |
open |
|
327 |
[exEnd] |
|
121 | 328 |
|
329 |
a textlabel with abort- and okButton gives a yesNoBox: |
|
1401 | 330 |
[exBegin] |
331 |
DialogBox new |
|
332 |
addTextLabel:'hello'; |
|
333 |
addAbortButton; |
|
334 |
addOkButton; |
|
335 |
open |
|
336 |
[exEnd] |
|
121 | 337 |
|
338 |
the same, adjusting the labels contents to the left: |
|
1401 | 339 |
[exBegin] |
340 |
|box| |
|
341 |
||
342 |
box := DialogBox new. |
|
343 |
(box addTextLabel:'hello') adjust:#left. |
|
344 |
box addAbortButton; |
|
345 |
addOkButton; |
|
346 |
open |
|
347 |
[exEnd] |
|
121 | 348 |
|
122 | 349 |
with modified buttons: |
1401 | 350 |
[exBegin] |
351 |
|box| |
|
352 |
||
353 |
box := DialogBox new. |
|
354 |
(box addTextLabel:'are you certain ?') adjust:#left. |
|
355 |
box addAbortButtonLabelled:'not really'. |
|
356 |
(box addOkButtonLabelled:'yes, absolutely') |
|
357 |
activeBackgroundColor:Color red. |
|
358 |
box open |
|
359 |
[exEnd] |
|
122 | 360 |
|
361 |
||
645 | 362 |
mswindows style (different up/down bitmaps in buttons): |
363 |
((try tabbing ...) |
|
1401 | 364 |
[exBegin] |
365 |
|b box| |
|
366 |
||
367 |
box := DialogBox new. |
|
368 |
(box addTextLabel:'are you certain ?') adjust:#left. |
|
369 |
b := Button new. |
|
370 |
b activeLogo:(Image fromFile:'bitmaps/cancel_down.bmp'). |
|
371 |
b passiveLogo:(Image fromFile:'bitmaps/cancel_up.bmp'). |
|
372 |
b focusLogo:(Image fromFile:'bitmaps/cancel_focus.bmp'). |
|
373 |
b beImageButton. |
|
374 |
box addAbortButton:b. |
|
375 |
||
376 |
b := Button new. |
|
377 |
b activeLogo:(Image fromFile:'bitmaps/ok_down.bmp'). |
|
378 |
b passiveLogo:(Image fromFile:'bitmaps/ok_up.bmp'). |
|
379 |
b focusLogo:(Image fromFile:'bitmaps/ok_focus.bmp'). |
|
380 |
b beImageButton. |
|
381 |
box addOkButton:b. |
|
382 |
box open |
|
383 |
[exEnd] |
|
162 | 384 |
|
385 |
||
121 | 386 |
two textlabels: |
1401 | 387 |
[exBegin] |
388 |
DialogBox new |
|
389 |
addTextLabel:'hello'; |
|
390 |
addTextLabel:'world'; |
|
391 |
addAbortButton; |
|
392 |
addOkButton; |
|
393 |
open |
|
394 |
[exEnd] |
|
118 | 395 |
|
121 | 396 |
fixing the dialogs size (suppres it calculating its size from the |
130 | 397 |
preferredExtents of its components): |
1401 | 398 |
[exBegin] |
399 |
DialogBox new |
|
400 |
label:'a simple dialog'; |
|
401 |
addTextLabel:'hello'; |
|
402 |
addAbortButton; |
|
403 |
addOkButton; |
|
404 |
extent:200@200; |
|
405 |
sizeFixed:true; |
|
406 |
open |
|
407 |
[exEnd] |
|
118 | 408 |
|
121 | 409 |
asking the box if it was closed via ok: |
1401 | 410 |
[exBegin] |
411 |
(DialogBox new |
|
412 |
label:'a simple dialog'; |
|
413 |
addTextLabel:'hello'; |
|
414 |
addAbortButton; |
|
415 |
addOkButton; |
|
416 |
extent:200@200; |
|
417 |
sizeFixed:true; |
|
418 |
open |
|
419 |
) accepted ifTrue:[ |
|
420 |
Transcript showCR:'yes' |
|
421 |
] ifFalse:[ |
|
422 |
Transcript showCR:'no' |
|
423 |
] |
|
424 |
[exEnd] |
|
118 | 425 |
|
121 | 426 |
textLabels are not limited to strings (although, the name which is |
427 |
used for ST-80 compatibility, suggests it): |
|
1401 | 428 |
[exBegin] |
429 |
DialogBox new |
|
430 |
addTextLabel:(Image fromFile:'bitmaps/garfield.gif'); |
|
431 |
addOkButton; |
|
432 |
open |
|
433 |
[exEnd] |
|
434 |
||
435 |
[exBegin] |
|
436 |
DialogBox new |
|
437 |
addTextLabel:'hello'; |
|
438 |
addTextLabel:((Image fromFile:'bitmaps/garfield.gif') |
|
439 |
magnifiedTo:200@150); |
|
440 |
addTextLabel:'world'; |
|
441 |
addAbortButton; |
|
442 |
addOkButton; |
|
443 |
open |
|
444 |
[exEnd] |
|
120 | 445 |
|
121 | 446 |
adding an input field (on a string model): |
1401 | 447 |
[exBegin] |
448 |
|stringModel| |
|
449 |
||
450 |
stringModel := '' asValue. |
|
451 |
(DialogBox new |
|
452 |
addTextLabel:'Please enter a string:'; |
|
453 |
addInputFieldOn:stringModel; |
|
454 |
addAbortButton; |
|
455 |
addOkButton; |
|
456 |
open |
|
457 |
) accepted ifTrue:[ |
|
458 |
Transcript showCR:'entered: ', stringModel value |
|
459 |
] |
|
460 |
[exEnd] |
|
120 | 461 |
|
462 |
||
121 | 463 |
multiple input fields (notice, that the dialog connects the fields |
464 |
in a group, so stepping is allowed via Cursor and Return keys): |
|
1401 | 465 |
[exBegin] |
466 |
|firstName lastName| |
|
467 |
||
468 |
firstName := '' asValue. |
|
469 |
lastName := '' asValue. |
|
470 |
(DialogBox new |
|
471 |
addTextLabel:'Please enter your name:'; |
|
472 |
addInputFieldOn:firstName; |
|
473 |
addVerticalSpace; |
|
474 |
addInputFieldOn:lastName; |
|
475 |
addAbortButton; |
|
476 |
addOkButton; |
|
477 |
open |
|
478 |
) accepted ifTrue:[ |
|
479 |
Transcript showCR:'entered: ', firstName value , ' ' , lastName value |
|
480 |
] |
|
481 |
[exEnd] |
|
121 | 482 |
|
483 |
||
484 |
of course, the model may contain a value initially: |
|
1401 | 485 |
[exBegin] |
486 |
|firstName lastName p line i name| |
|
487 |
||
488 |
firstName := '' asValue. |
|
489 |
lastName := '' asValue. |
|
490 |
p := PipeStream readingFrom:'finger ' , OperatingSystem getLoginName. |
|
491 |
p notNil ifTrue:[ |
|
492 |
line := p nextLine. |
|
493 |
(i := line findString:'Name:') ~~ 0 ifTrue:[ |
|
494 |
name := line copyFrom:(i + 'Name:' size). |
|
495 |
] ifFalse:[ |
|
496 |
(i := line findString:'real life:') == 0 ifTrue:[ |
|
497 |
line := p nextLine. |
|
498 |
]. |
|
499 |
(i := line findString:'real life:') ~~ 0 ifTrue:[ |
|
500 |
name := line copyFrom:(i + 'real life:' size). |
|
501 |
] |
|
502 |
]. |
|
503 |
name notNil ifTrue:[ |
|
504 |
firstName value: name asCollectionOfWords first. |
|
505 |
lastName value: name asCollectionOfWords last. |
|
506 |
Transcript showCR:'initially ' , firstName value , ' ' , lastName value. |
|
507 |
]. |
|
508 |
p close. |
|
509 |
]. |
|
510 |
||
511 |
(DialogBox new |
|
512 |
addTextLabel:'Please enter your name:'; |
|
513 |
addInputFieldOn:firstName; |
|
514 |
addVerticalSpace; |
|
515 |
addInputFieldOn:lastName; |
|
516 |
addAbortButton; |
|
517 |
addOkButton; |
|
518 |
open |
|
519 |
) accepted ifTrue:[ |
|
520 |
Transcript showCR:'entered: ', firstName value , ' ' , lastName value |
|
521 |
] |
|
522 |
[exEnd] |
|
121 | 523 |
|
120 | 524 |
|
302 | 525 |
validated password entry: |
1401 | 526 |
[exBegin] |
527 |
|box firstEntry secondEntry| |
|
528 |
||
529 |
firstEntry := '' asValue. |
|
530 |
secondEntry := '' asValue. |
|
531 |
||
532 |
box := DialogBox new. |
|
533 |
(box addTextLabel:'Please enter your secret:') adjust:#left. |
|
534 |
(box addInputFieldOn:firstEntry) passwordCharacter:$*. |
|
535 |
box addVerticalSpace. |
|
536 |
(box addInputFieldOn:secondEntry) passwordCharacter:$*. |
|
537 |
box addAbortButton. |
|
538 |
box addOkButton. |
|
539 |
box open. |
|
540 |
box accepted ifTrue:[ |
|
541 |
firstEntry value ~= secondEntry value ifTrue:[ |
|
542 |
Transcript showCR:'wrong input - try again' |
|
543 |
] ifFalse:[ |
|
544 |
Transcript showCR:'entered: ', firstEntry value |
|
545 |
] |
|
546 |
] |
|
547 |
[exEnd] |
|
593 | 548 |
|
549 |
input fields with a label: |
|
1401 | 550 |
[exBegin] |
551 |
|box firstNameHolder middleNameHolder lastNameHolder| |
|
552 |
||
553 |
firstNameHolder := 'John' asValue. |
|
554 |
middleNameHolder := 'F' asValue. |
|
555 |
lastNameHolder := 'Peters' asValue. |
|
556 |
||
557 |
box := DialogBox new. |
|
558 |
box |
|
559 |
addLabelledInputField:'first name:' |
|
560 |
adjust:#right |
|
561 |
on:firstNameHolder |
|
562 |
tabable:true |
|
563 |
separateAtX:0.4. |
|
564 |
||
565 |
box |
|
566 |
addLabelledInputField:'middle initial:' |
|
567 |
adjust:#right |
|
568 |
on:middleNameHolder |
|
569 |
tabable:true |
|
570 |
separateAtX:0.4. |
|
571 |
||
572 |
box |
|
573 |
addLabelledInputField:'last name:' |
|
574 |
adjust:#right |
|
575 |
on:lastNameHolder |
|
576 |
tabable:true |
|
577 |
separateAtX:0.4. |
|
578 |
||
579 |
box addOkButton. |
|
580 |
box open. |
|
581 |
[exEnd] |
|
593 | 582 |
|
583 |
||
584 |
constructing a dialog from other elements: |
|
121 | 585 |
adding a fileSelectionList: |
586 |
(since the dialog adds the component with its preferred extent, |
|
587 |
ignoring the 300-height, this looks ugly ... |
|
588 |
... especially when resized vertically) |
|
1401 | 589 |
[exBegin] |
590 |
|top l scr fileName| |
|
591 |
||
592 |
fileName := '' asValue. |
|
593 |
||
594 |
top := DialogBox new. |
|
595 |
||
596 |
l := FileSelectionList new. |
|
597 |
l useIndex:false. |
|
598 |
l doubleClickAction:[:name | top okPressed]. |
|
599 |
l action:[:name | fileName value:name]. |
|
600 |
scr := ScrollableView forView:l. |
|
601 |
scr extent:(1.0 @ 300). |
|
602 |
||
603 |
top addComponent:scr. |
|
604 |
top addAbortButton; addOkButton. |
|
605 |
top openModal. |
|
606 |
||
607 |
top accepted ifTrue:[ |
|
608 |
Transcript show:'fileName: '; showCR:fileName value storeString. |
|
609 |
] |
|
610 |
[exEnd] |
|
121 | 611 |
|
612 |
same, looks better, since the height is made larger (not using |
|
613 |
fileLists preferredExtent): |
|
1401 | 614 |
[exBegin] |
615 |
|top l scr fileName| |
|
616 |
||
617 |
fileName := '' asValue. |
|
618 |
||
619 |
top := DialogBox new. |
|
620 |
||
621 |
l := FileSelectionList new. |
|
622 |
l useIndex:false. |
|
623 |
l doubleClickAction:[:name | top okPressed]. |
|
624 |
l action:[:name | fileName value:name]. |
|
625 |
scr := ScrollableView forView:l. |
|
626 |
||
627 |
top addComponent:scr withExtent:300@300. |
|
628 |
top addAbortButton; addOkButton. |
|
629 |
top openModal. |
|
630 |
||
631 |
top accepted ifTrue:[ |
|
632 |
Transcript show:'fileName: '; showCR:fileName value storeString. |
|
633 |
] |
|
634 |
[exEnd] |
|
121 | 635 |
|
636 |
||
637 |
again, setting the boxes initial size and fixing it |
|
130 | 638 |
(let it ignore the components' preferredExtent): |
1401 | 639 |
[exBegin] |
640 |
|top fixFrame l scr fileName| |
|
641 |
||
642 |
fileName := '' asValue. |
|
643 |
||
644 |
top := DialogBox new. |
|
645 |
top extent:300@300. |
|
646 |
||
647 |
fixFrame := View new. |
|
648 |
fixFrame extent:(1.0 @ 300). |
|
649 |
||
650 |
l := FileSelectionList new. |
|
651 |
l useIndex:false. |
|
652 |
l doubleClickAction:[:name | top okPressed]. |
|
653 |
l action:[:name | fileName value:name]. |
|
654 |
scr := ScrollableView forView:l. |
|
655 |
scr origin:0.0@0.0 corner:1.0@1.0. |
|
656 |
fixFrame add:scr. |
|
657 |
||
658 |
top addComponent:fixFrame. |
|
659 |
top addAbortButton; addOkButton. |
|
660 |
top openModal. |
|
661 |
||
662 |
top accepted ifTrue:[ |
|
663 |
Transcript show:'fileName: '; showCR:fileName value storeString. |
|
664 |
] |
|
665 |
[exEnd] |
|
118 | 666 |
|
667 |
||
668 |
adding a panel with checkBoxes: |
|
1401 | 669 |
[exBegin] |
670 |
|top panel b value1 value2 value3 value4| |
|
671 |
||
672 |
value1 := true asValue. |
|
673 |
value2 := false asValue. |
|
674 |
value3 := false asValue. |
|
675 |
value4 := true asValue. |
|
676 |
||
677 |
top := DialogBox new. |
|
678 |
top extent:200@300. |
|
679 |
||
680 |
panel := VerticalPanelView new. |
|
681 |
||
682 |
b := CheckBox on:value1. b label:'check1'. |
|
683 |
panel addSubView:b. |
|
684 |
||
685 |
b := CheckBox on:value2. b label:'check2'. |
|
686 |
panel addSubView:b. |
|
687 |
||
688 |
b := CheckBox on:value3. b label:'check3'. |
|
689 |
panel addSubView:b. |
|
690 |
||
691 |
b := CheckBox on:value4. b label:'check4'. |
|
692 |
panel addSubView:b. |
|
693 |
||
694 |
top addComponent:panel. |
|
695 |
top addAbortButton; addOkButton. |
|
696 |
top open. |
|
697 |
||
698 |
top accepted ifTrue:[ |
|
699 |
Transcript show:'value1: '; showCR:value1 value. |
|
700 |
Transcript show:'value2: '; showCR:value2 value. |
|
701 |
Transcript show:'value3: '; showCR:value3 value. |
|
702 |
Transcript show:'value4: '; showCR:value4 value. |
|
703 |
] |
|
704 |
[exEnd] |
|
118 | 705 |
|
120 | 706 |
same, using a more convenient interface: |
1401 | 707 |
[exBegin] |
708 |
|box value1 value2 value3 value4| |
|
709 |
||
710 |
value1 := true asValue. |
|
711 |
value2 := false asValue. |
|
712 |
value3 := false asValue. |
|
713 |
value4 := true asValue. |
|
714 |
||
715 |
box := DialogBox new. |
|
716 |
box extent:200@300. |
|
717 |
||
718 |
box addCheckBox:'check1' on:value1. |
|
719 |
box addVerticalSpace. |
|
720 |
box addCheckBox:'check2' on:value2. |
|
721 |
box addVerticalSpace. |
|
722 |
box addCheckBox:'check3' on:value3. |
|
723 |
box addVerticalSpace. |
|
724 |
box addCheckBox:'check4' on:value4. |
|
725 |
||
726 |
box addAbortButton; addOkButton. |
|
727 |
box open. |
|
728 |
||
729 |
box accepted ifTrue:[ |
|
730 |
Transcript show:'value1: '; showCR:value1 value. |
|
731 |
Transcript show:'value2: '; showCR:value2 value. |
|
732 |
Transcript show:'value3: '; showCR:value3 value. |
|
733 |
Transcript show:'value4: '; showCR:value4 value. |
|
734 |
] |
|
735 |
[exEnd] |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
736 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
737 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
738 |
same, using an even better interface: |
1401 | 739 |
[exBegin] |
740 |
|box values labels| |
|
741 |
||
742 |
values := #(true false false true) collect:[:val | val asValue]. |
|
743 |
labels := #('check1' 'check2' 'check3' 'check4'). |
|
744 |
||
745 |
box := Dialog new. |
|
746 |
||
747 |
box |
|
748 |
addColumn:(1 to:labels size) |
|
749 |
fromX:0.0 |
|
750 |
toX:1.0 |
|
751 |
collect:[:index | CheckBox label:(labels at:index) model:(values at:index)] |
|
752 |
tabable:true. |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
753 |
|
1401 | 754 |
box addAbortButton; addOkButton. |
755 |
box open. |
|
756 |
||
757 |
box accepted ifTrue:[ |
|
758 |
values with:labels do:[:val :lbl | |
|
759 |
Transcript show:(lbl , ': '); showCR:val value. |
|
760 |
] |
|
761 |
] |
|
762 |
[exEnd] |
|
126 | 763 |
|
764 |
||
164 | 765 |
adding two panels in a frame: |
1401 | 766 |
[exBegin] |
767 |
|box frame vPanel1 vPanel2 m1 m2 m3 m4 chk ef| |
|
768 |
||
769 |
box := Dialog new. |
|
770 |
box label:'example'. |
|
771 |
||
772 |
frame := FramedBox label:'frame'. |
|
773 |
||
774 |
vPanel1 := VerticalPanelView origin:0.0@0.0 corner:0.5@1.0 in:frame. |
|
775 |
vPanel1 horizontalLayout:#leftSpace. |
|
776 |
vPanel1 verticalLayout:#spreadSpace. |
|
777 |
||
778 |
vPanel2 := VerticalPanelView origin:0.5@0.0 corner:1.0@1.0 in:frame. |
|
779 |
vPanel2 horizontalLayout:#leftSpace. |
|
780 |
vPanel2 verticalLayout:#spreadSpace. |
|
781 |
||
782 |
m1 := true asValue. |
|
783 |
m2 := true asValue. |
|
784 |
m3 := true asValue. |
|
785 |
m4 := 'hello' asValue. |
|
786 |
||
787 |
vPanel1 add:(Label label:'check1'). |
|
788 |
vPanel1 add:(Label label:'m2'). |
|
789 |
vPanel1 add:(Label label:'m3'). |
|
790 |
vPanel1 add:(Label label:'enter'). |
|
791 |
vPanel1 add:(Label label:'lbl1'). |
|
792 |
vPanel1 add:(Label label:'lbl2'). |
|
793 |
||
794 |
vPanel2 add:(chk := CheckToggle on:m1). |
|
795 |
box makeTabable:chk. |
|
796 |
||
797 |
vPanel2 add:(chk := CheckToggle on:m2). |
|
798 |
box makeTabable:chk. |
|
799 |
||
800 |
vPanel2 add:(chk := CheckToggle on:m3). |
|
801 |
box makeTabable:chk. |
|
802 |
||
803 |
vPanel2 add:(chk := CheckToggle on:m3). |
|
804 |
box makeTabable:chk. |
|
805 |
||
806 |
vPanel2 add:(chk := CheckToggle on:m3). |
|
807 |
box makeTabable:chk. |
|
808 |
||
809 |
vPanel2 add:(ef := EditField on:m4). |
|
810 |
ef immediateAccept:true. |
|
811 |
box makeTabable:ef. |
|
812 |
||
813 |
box addComponent:frame. |
|
814 |
||
815 |
box addAbortButton; addOkButton. |
|
816 |
box openModal. |
|
817 |
box accepted ifTrue:[ |
|
818 |
Transcript showCR:'accepted with:'. |
|
819 |
Transcript showCR:' m1: ' , m1 value printString. |
|
820 |
Transcript showCR:' m2: ' , m2 value printString. |
|
821 |
Transcript showCR:' m3: ' , m3 value printString. |
|
822 |
Transcript showCR:' m4: ' , m4 value printString. |
|
823 |
] |
|
824 |
[exEnd] |
|
593 | 825 |
|
826 |
||
827 |
||
828 |
a full example (combined settings dialog - as in launcher): |
|
1401 | 829 |
[exBegin] |
830 |
|box warnSTX allowUnderscore immutableArrays logDoits |
|
831 |
listOfLanguages listOfStyles styleNames |
|
832 |
frame panel c resourceDir dir | |
|
833 |
||
834 |
warnSTX := Compiler warnSTXSpecials asValue. |
|
835 |
allowUnderscore := Compiler allowUnderscoreInIdentifier asValue. |
|
836 |
immutableArrays := Compiler arraysAreImmutable asValue. |
|
837 |
||
838 |
logDoits := Smalltalk logDoits asValue. |
|
839 |
||
840 |
listOfLanguages := SelectionInList with:#('english' |
|
841 |
'french' |
|
842 |
'german' |
|
843 |
'italian' |
|
844 |
'spanish' |
|
845 |
). |
|
846 |
listOfLanguages selection:(Language asString). |
|
847 |
||
848 |
||
849 |
resourceDir := Smalltalk getSystemFileName:'resources'. |
|
850 |
dir := FileDirectory directoryNamed:resourceDir. |
|
851 |
||
852 |
styleNames := dir select:[:aFileName | aFileName endsWith:'.style']. |
|
853 |
styleNames := styleNames collect:[:aFileName | aFileName copyWithoutLast:6]. |
|
854 |
listOfStyles := SelectionInList with:styleNames sort. |
|
855 |
listOfStyles selection:(View defaultStyle asString). |
|
856 |
||
857 |
box := Dialog new. |
|
858 |
box label:'Settings'. |
|
859 |
||
860 |
frame := FramedBox label:'Compiler'. |
|
861 |
panel := VerticalPanelView origin:0.0@0.0 corner:1.0@1.0 in:frame. |
|
862 |
panel horizontalLayout:#leftSpace. |
|
863 |
||
864 |
panel add:((CheckBox on:warnSTX) label:'warn about ST/X language extensions'; resize). |
|
865 |
panel add:((CheckBox on:allowUnderscore) label:'allow underscore in identifiers'; resize). |
|
866 |
panel add:((CheckBox on:immutableArrays) label:'literal arrays are immutable'; resize). |
|
867 |
box addComponent:frame. |
|
868 |
||
869 |
frame := FramedBox label:'Misc'. |
|
870 |
panel := VerticalPanelView origin:0.0@0.0 corner:1.0@1.0 in:frame. |
|
871 |
panel horizontalLayout:#leftSpace. |
|
872 |
||
873 |
panel add:((CheckBox on:logDoits) label:'log doIts in changes file'; resize). |
|
874 |
box addComponent:frame. |
|
875 |
||
876 |
frame := FramedBox label:'Language'. |
|
877 |
panel := VerticalPanelView origin:0.0@0.0 corner:1.0@1.0 in:frame. |
|
878 |
panel horizontalLayout:#leftSpace. |
|
879 |
||
880 |
panel add:((PopUpList on:listOfLanguages) width:0.5). |
|
881 |
box addComponent:frame. |
|
882 |
||
883 |
frame := FramedBox label:'Style'. |
|
884 |
panel := VerticalPanelView origin:0.0@0.0 corner:1.0@1.0 in:frame. |
|
885 |
panel horizontalLayout:#leftSpace. |
|
886 |
||
887 |
panel add:((PopUpList on:listOfStyles) width:0.5). |
|
888 |
box addComponent:frame. |
|
889 |
||
890 |
box addAbortButton; addOkButton. |
|
891 |
box showAtPointer. |
|
892 |
||
893 |
box accepted ifTrue:[ |
|
894 |
Transcript topView withCursor:Cursor wait do:[ |
|
895 |
Compiler warnSTXSpecials:warnSTX value. |
|
896 |
Compiler allowUnderscoreInIdentifier:allowUnderscore value. |
|
897 |
Compiler arraysAreImmutable:immutableArrays value. |
|
898 |
||
899 |
Smalltalk logDoits:logDoits value. |
|
900 |
||
901 |
Transcript showCR:'change language to ' , listOfLanguages selection , ' ...'. |
|
902 |
Smalltalk at:#Language put:listOfLanguages selection asSymbol. |
|
903 |
Smalltalk changed:#Language. |
|
904 |
ResourcePack flushCachedResourcePacks. |
|
905 |
||
906 |
Transcript showCR:'change style to ' , listOfStyles selection , ' ...'. |
|
907 |
View defaultStyle:listOfStyles selection asSymbol. |
|
908 |
] |
|
909 |
] |
|
910 |
[exEnd] |
|
625 | 911 |
an example from Hopkins/Horan: |
1401 | 912 |
[exBegin] |
913 |
|aText index| |
|
914 |
||
915 |
aText := 'Smalltalk/X: An Introduction to Application Development' asText. |
|
916 |
index := aText findString:'Smalltalk/X' startingAt:1. |
|
917 |
aText emphasizeFrom:index |
|
918 |
to:'Smalltalk/X' size + index - 1 |
|
919 |
with:#bold. |
|
920 |
index := aText findString:'Introduction' startingAt:index. |
|
921 |
aText emphasizeFrom:index |
|
922 |
to:'Introduction' size + index - 1 |
|
923 |
with:#italic. |
|
924 |
Dialog warn:aText |
|
625 | 925 |
|
1401 | 926 |
[exEnd] |
625 | 927 |
the same, with colors: |
1401 | 928 |
[exBegin] |
929 |
|aText index| |
|
930 |
||
931 |
aText := 'Smalltalk/X: An Introduction to Application Development' asText. |
|
932 |
index := aText findString:'Smalltalk/X' startingAt:1. |
|
933 |
aText emphasizeFrom:index |
|
934 |
to:'Smalltalk/X' size + index - 1 |
|
935 |
with:(Array with:#bold with:#underline with:(#color->Color red)). |
|
936 |
index := aText findString:'Introduction' startingAt:index. |
|
937 |
aText emphasizeFrom:index |
|
938 |
to:'Introduction' size + index - 1 |
|
939 |
with:#italic. |
|
940 |
Dialog warn:aText |
|
941 |
[exEnd] |
|
76 | 942 |
" |
551
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
943 |
! |
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
944 |
|
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
945 |
inputFocus |
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
946 |
" |
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
947 |
a DialogBox with multiple input fields can be configured on how it |
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
948 |
shall behave if the RETURN key is pressed. |
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
949 |
|
600 | 950 |
The default is to shift the focus to the ok-button - thus, another return |
951 |
has to be entered (as confirmation) to close & accept the box. |
|
952 |
||
953 |
This can be changed to force an automatic OK with: |
|
1401 | 954 |
aBox focusToOKOnLeave:false |
551
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
955 |
|
600 | 956 |
Then, leaving the last field with return, automatically accepts the box, |
957 |
as if ok was pressed. (useful for simple - single entry dialogs). |
|
958 |
All simple dialogs (like 'enter a searchString') behave this way. |
|
551
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
959 |
|
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
960 |
|
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
961 |
With: |
1401 | 962 |
aBox acceptReturnAsOK:false |
551
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
963 |
|
600 | 964 |
any focusShift or automatic OK is turned off, and the input group |
551
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
965 |
switches its focus back to the topMost field. |
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
966 |
The default for this is true. |
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
967 |
(useful, if you want an explicit ok from the user, or need all fields |
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
968 |
to be handled somehow). |
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
969 |
|
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
970 |
|
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
971 |
Simply leaving the group with a cursor movement may also be either |
600 | 972 |
interpreted as a return (the default), or again wrap back to the top |
973 |
of the group. |
|
974 |
||
975 |
With: |
|
1401 | 976 |
aBox acceptOnLeave:false |
600 | 977 |
this is turned off, so that with cursor-down, the focus is moved back |
978 |
to the first entry field. The default is true. |
|
551
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
979 |
" |
76 | 980 |
! ! |
981 |
||
1371 | 982 |
!DialogBox class methodsFor:'Compatibility - VW'! |
983 |
||
984 |
choose:aString fromList:list values:listValues lines:maxLines cancel:cancelBlock for:aView |
|
985 |
"launch a Dialog showing the message and list. |
|
986 |
The user can select an item and click ok; in this case, the corresponding value |
|
987 |
from listValues is returned (doubleclick works as well). |
|
988 |
If cancel is pressed, the value of cancelBlock is returned. |
|
989 |
Pressing ok without a selection is treated like cancel. |
|
990 |
This is a new VW2.5 interface - passing an addtional argument. |
|
991 |
In ST/X, this is not needed and ignored" |
|
992 |
||
993 |
^ self |
|
1401 | 994 |
choose:aString |
995 |
fromList:list |
|
996 |
values:listValues |
|
997 |
lines:maxLines |
|
998 |
cancel:cancelBlock |
|
1371 | 999 |
|
1000 |
" |
|
1001 |
Transcript showCR:( |
|
1401 | 1002 |
Dialog |
1003 |
choose:'choose any' |
|
1004 |
fromList:#('one' 'two' 'three' 'four') |
|
1005 |
values:#(1 2 3 4) |
|
1006 |
lines:4 |
|
1007 |
cancel:nil |
|
1371 | 1008 |
) |
1009 |
||
1010 |
Transcript showCR:( |
|
1401 | 1011 |
Dialog |
1012 |
choose:'choose example' |
|
1013 |
fromList:#('one' 'two' 'three' 'four') |
|
1014 |
values:#(1 2 3 4) |
|
1015 |
lines:4 |
|
1016 |
cancel:[Transcript flash. #aborted] |
|
1371 | 1017 |
) |
1018 |
" |
|
1019 |
||
1020 |
"Created: / 1.11.1997 / 13:21:32 / cg" |
|
1021 |
"Modified: / 1.11.1997 / 13:21:54 / cg" |
|
1022 |
! |
|
1102 | 1023 |
|
1024 |
confirm:aMessageString for:ignoredView |
|
1371 | 1025 |
"VW compatibility - confirm using the same viewStyle as in the view |
1102 | 1026 |
argument; not supported in ST/X (who mixes styles ?)" |
1027 |
||
1028 |
^ self confirm:aMessageString |
|
1029 |
||
1371 | 1030 |
"Created: / 6.3.1997 / 15:45:54 / cg" |
1031 |
"Modified: / 31.10.1997 / 11:54:59 / cg" |
|
1032 |
! |
|
1033 |
||
1034 |
request:aString for:aView |
|
1035 |
"launch a Dialog, which allows user to enter something. |
|
1036 |
Return the entered string (may be empty string) |
|
1037 |
or the empty string (if cancel was pressed), |
|
1038 |
This is a new VW2.5 interface - passing an addtional argument. |
|
1039 |
In ST/X, this is not needed and ignored" |
|
1040 |
||
1041 |
^ self |
|
1401 | 1042 |
request:aString |
1371 | 1043 |
|
1044 |
"Created: / 31.10.1997 / 03:26:32 / cg" |
|
1045 |
"Modified: / 31.10.1997 / 11:53:50 / cg" |
|
1046 |
! |
|
1047 |
||
1048 |
request:aString initialAnswer:initial for:aView |
|
1049 |
"launch a Dialog, which allows user to enter something. |
|
1050 |
Return the entered string (may be empty string) or nil (if cancel was pressed). |
|
1051 |
This is a new VW2.5 interface - passing an addtional argument. |
|
1052 |
In ST/X, this is not needed and ignored" |
|
1053 |
||
1054 |
^ self |
|
1401 | 1055 |
request:aString |
1056 |
initialAnswer:initial |
|
1371 | 1057 |
|
1058 |
"Modified: / 29.5.1996 / 14:30:05 / cg" |
|
1059 |
"Created: / 1.11.1997 / 13:18:29 / cg" |
|
1060 |
! |
|
1061 |
||
1062 |
requestFileName:title default:default version:versionSym ifFail:failBlock for:aViewOrNil |
|
1063 |
"new VW2.5 interface - passing an addtional argument. |
|
1064 |
In ST/X, this is not needed and ignored" |
|
1065 |
||
1066 |
^ self |
|
1401 | 1067 |
requestFileName:title default:default version:versionSym ifFail:failBlock |
1371 | 1068 |
|
1069 |
"Created: / 31.10.1997 / 02:00:42 / cg" |
|
1070 |
"Modified: / 31.10.1997 / 11:52:53 / cg" |
|
1102 | 1071 |
! |
1072 |
||
1073 |
warn:aMessageString for:ignoredView |
|
1371 | 1074 |
"VW compatibility - warn using the same viewStyle as in the view |
1102 | 1075 |
argument; not supported in ST/X (who mixes styles ?)" |
1076 |
||
1077 |
^ self warn:aMessageString |
|
1078 |
||
1371 | 1079 |
"Created: / 6.3.1997 / 15:46:02 / cg" |
1080 |
"Modified: / 31.10.1997 / 11:54:35 / cg" |
|
1102 | 1081 |
! ! |
1082 |
||
846
75c5dc601522
added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents:
831
diff
changeset
|
1083 |
!DialogBox class methodsFor:'class initialization'! |
498 | 1084 |
|
1085 |
initialize |
|
528
3ed1f0b5a0bb
oops - dont clobber Dialog global if subclasses #initialize
Claus Gittinger <cg@exept.de>
parents:
498
diff
changeset
|
1086 |
self == DialogBox ifTrue:[ |
1757 | 1087 |
Dialog := self |
1088 |
]. |
|
1089 |
||
1090 |
DefaultFocusToOKOnLeave := false. |
|
498 | 1091 |
|
1092 |
"Created: 8.3.1996 / 21:18:54 / cg" |
|
528
3ed1f0b5a0bb
oops - dont clobber Dialog global if subclasses #initialize
Claus Gittinger <cg@exept.de>
parents:
498
diff
changeset
|
1093 |
"Modified: 10.4.1996 / 08:16:18 / cg" |
498 | 1094 |
! ! |
1095 |
||
846
75c5dc601522
added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents:
831
diff
changeset
|
1096 |
!DialogBox class methodsFor:'common dialogs'! |
100 | 1097 |
|
1703
8881861270f1
added #informUser:during: utility.
Claus Gittinger <cg@exept.de>
parents:
1702
diff
changeset
|
1098 |
informUser:aString during:aBlock |
8881861270f1
added #informUser:during: utility.
Claus Gittinger <cg@exept.de>
parents:
1702
diff
changeset
|
1099 |
"show a message-box while executing aBlock" |
8881861270f1
added #informUser:during: utility.
Claus Gittinger <cg@exept.de>
parents:
1702
diff
changeset
|
1100 |
|
8881861270f1
added #informUser:during: utility.
Claus Gittinger <cg@exept.de>
parents:
1702
diff
changeset
|
1101 |
|box| |
8881861270f1
added #informUser:during: utility.
Claus Gittinger <cg@exept.de>
parents:
1702
diff
changeset
|
1102 |
|
8881861270f1
added #informUser:during: utility.
Claus Gittinger <cg@exept.de>
parents:
1702
diff
changeset
|
1103 |
[ |
8881861270f1
added #informUser:during: utility.
Claus Gittinger <cg@exept.de>
parents:
1702
diff
changeset
|
1104 |
box := InfoBox title:aString. |
8881861270f1
added #informUser:during: utility.
Claus Gittinger <cg@exept.de>
parents:
1702
diff
changeset
|
1105 |
box hideButtons. |
8881861270f1
added #informUser:during: utility.
Claus Gittinger <cg@exept.de>
parents:
1702
diff
changeset
|
1106 |
box showAtPointer. |
1704
304ccbc56ec4
fixed #informUser:during: in case of timeSlicer not running.
Claus Gittinger <cg@exept.de>
parents:
1703
diff
changeset
|
1107 |
] forkAt:(Processor activePriority + 1). |
1703
8881861270f1
added #informUser:during: utility.
Claus Gittinger <cg@exept.de>
parents:
1702
diff
changeset
|
1108 |
aBlock valueNowOrOnUnwindDo:[box destroy] |
8881861270f1
added #informUser:during: utility.
Claus Gittinger <cg@exept.de>
parents:
1702
diff
changeset
|
1109 |
|
8881861270f1
added #informUser:during: utility.
Claus Gittinger <cg@exept.de>
parents:
1702
diff
changeset
|
1110 |
" |
8881861270f1
added #informUser:during: utility.
Claus Gittinger <cg@exept.de>
parents:
1702
diff
changeset
|
1111 |
Dialog informUser:'wait a second...' during:[Delay waitForSeconds:1] |
8881861270f1
added #informUser:during: utility.
Claus Gittinger <cg@exept.de>
parents:
1702
diff
changeset
|
1112 |
Dialog informUser:'wait a few seconds...' during:[10000 factorial] |
8881861270f1
added #informUser:during: utility.
Claus Gittinger <cg@exept.de>
parents:
1702
diff
changeset
|
1113 |
" |
8881861270f1
added #informUser:during: utility.
Claus Gittinger <cg@exept.de>
parents:
1702
diff
changeset
|
1114 |
|
8881861270f1
added #informUser:during: utility.
Claus Gittinger <cg@exept.de>
parents:
1702
diff
changeset
|
1115 |
|
8881861270f1
added #informUser:during: utility.
Claus Gittinger <cg@exept.de>
parents:
1702
diff
changeset
|
1116 |
! |
8881861270f1
added #informUser:during: utility.
Claus Gittinger <cg@exept.de>
parents:
1702
diff
changeset
|
1117 |
|
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
1118 |
information:aString |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
1119 |
"launch a Dialog to tell user something" |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
1120 |
|
719
574be1981be0
destroy boxes from standard dialogs
Claus Gittinger <cg@exept.de>
parents:
718
diff
changeset
|
1121 |
(InfoBox title:aString) showAtPointer; destroy |
197 | 1122 |
|
1123 |
" |
|
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
1124 |
Dialog information:'help' |
197 | 1125 |
" |
719
574be1981be0
destroy boxes from standard dialogs
Claus Gittinger <cg@exept.de>
parents:
718
diff
changeset
|
1126 |
|
574be1981be0
destroy boxes from standard dialogs
Claus Gittinger <cg@exept.de>
parents:
718
diff
changeset
|
1127 |
"Modified: 29.5.1996 / 15:23:03 / cg" |
197 | 1128 |
! |
1129 |
||
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
1130 |
warn:aString |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
1131 |
"launch a Dialog to warn user" |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
1132 |
|
719
574be1981be0
destroy boxes from standard dialogs
Claus Gittinger <cg@exept.de>
parents:
718
diff
changeset
|
1133 |
(WarningBox title:aString) showAtPointer; destroy |
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
1134 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
1135 |
" |
625 | 1136 |
Dialog warn:'some warning message' |
1137 |
||
1138 |
Dialog warn:('some text with italic emphasis' asText |
|
1401 | 1139 |
emphasizeFrom:16 to:22 with:#italic) |
625 | 1140 |
|
1141 |
Dialog warn:('some warning message' asText |
|
1401 | 1142 |
emphasizeAllWith:(#color->Color red)) |
625 | 1143 |
|
1144 |
Dialog warn:('some text with color emphasis' asText |
|
1401 | 1145 |
emphasizeFrom:6 to:10 with:(#color->Color blue); |
1146 |
emphasizeFrom:16 to:20 with:(#color->Color red)) |
|
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
1147 |
" |
625 | 1148 |
|
719
574be1981be0
destroy boxes from standard dialogs
Claus Gittinger <cg@exept.de>
parents:
718
diff
changeset
|
1149 |
"Modified: 29.5.1996 / 15:23:14 / cg" |
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
1150 |
! ! |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
1151 |
|
846
75c5dc601522
added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents:
831
diff
changeset
|
1152 |
!DialogBox class methodsFor:'confirmation dialogs'! |
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
1153 |
|
197 | 1154 |
confirm:aString |
1155 |
"launch a Dialog, which allows user to enter yes or no. |
|
1156 |
return true for yes, false for no" |
|
1157 |
||
498 | 1158 |
^ self |
1401 | 1159 |
confirm:aString |
1160 |
title:(self classResources string:'confirm') |
|
1161 |
yesLabel:nil |
|
1162 |
noLabel:nil |
|
498 | 1163 |
|
1164 |
"/ |box answer| |
|
1165 |
"/ |
|
1166 |
"/ box := YesNoBox title:aString. |
|
1167 |
"/ box label:(self classResources string:'Confirm'). |
|
1168 |
"/ box yesAction:[answer := true] noAction:[answer := false]. |
|
1169 |
"/ box showAtPointer. |
|
1170 |
"/ box yesAction:nil noAction:nil. |
|
1171 |
"/ ^ answer |
|
197 | 1172 |
|
1173 |
" |
|
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
1174 |
Dialog confirm:'really ?' |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
1175 |
|
655 | 1176 |
Transcript showCR:( |
1401 | 1177 |
Dialog confirm:'are you certain ?' |
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
1178 |
) |
197 | 1179 |
" |
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
1180 |
|
881 | 1181 |
"Modified: 14.11.1996 / 16:02:30 / cg" |
197 | 1182 |
! |
1183 |
||
1184 |
confirm:aString initialAnswer:what |
|
1185 |
"launch a Dialog, which allows user to enter yes or no. |
|
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
1186 |
return true for yes, false for no. |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
1187 |
InitialAnswer must be true or false and defines which button is to be |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
1188 |
the default (i.e. return-) button" |
197 | 1189 |
|
1190 |
|box answer| |
|
1191 |
||
1192 |
box := YesNoBox title:aString. |
|
1193 |
box yesAction:[answer := true] noAction:[answer := false]. |
|
1194 |
what == false ifTrue:[ |
|
1401 | 1195 |
box okButton isReturnButton:false. |
1196 |
box acceptReturnAsOK:false. |
|
1197 |
box noButton beReturnButton. |
|
197 | 1198 |
]. |
884 | 1199 |
box label:(self classResources string:'confirm'). |
197 | 1200 |
box showAtPointer. |
1201 |
box yesAction:nil noAction:nil. |
|
719
574be1981be0
destroy boxes from standard dialogs
Claus Gittinger <cg@exept.de>
parents:
718
diff
changeset
|
1202 |
box destroy. |
197 | 1203 |
^ answer |
1204 |
||
1205 |
" |
|
1206 |
Dialog confirm:'really ?' initialAnswer:false |
|
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
1207 |
|
655 | 1208 |
Transcript showCR:( |
1401 | 1209 |
Dialog confirm:'are you certain ?' initialAnswer:false |
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
1210 |
) |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
1211 |
|
655 | 1212 |
Transcript showCR:( |
1401 | 1213 |
Dialog confirm:'are you certain ?' initialAnswer:true |
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
1214 |
) |
197 | 1215 |
" |
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
1216 |
|
881 | 1217 |
"Modified: 14.11.1996 / 16:04:13 / cg" |
197 | 1218 |
! |
1219 |
||
2079 | 1220 |
confirm:aString noLabel:noText |
1221 |
"launch a Dialog, which allows user to enter yes or no. |
|
1222 |
return true for yes, false for no. |
|
1223 |
The no-button is labeled noText (for example, if you need a 'cancel' there)" |
|
1224 |
||
1225 |
^ self |
|
1226 |
confirm:aString |
|
1227 |
title:(self classResources string:'confirm') |
|
1228 |
yesLabel:nil |
|
1229 |
noLabel:noText |
|
1230 |
||
1231 |
" |
|
1232 |
Dialog confirm:'really ?' |
|
1233 |
||
1234 |
Dialog confirm:'really ?' noLabel:'cancel' |
|
1235 |
" |
|
1236 |
! |
|
1237 |
||
1238 |
confirm:aString title:title noLabel:noText |
|
1239 |
"launch a Dialog, which allows user to enter yes or no. |
|
1240 |
return true for yes, false for no. |
|
1241 |
The no buttons label is defined by noText (for example, to make it 'cancel')." |
|
1242 |
||
1243 |
^ self |
|
1244 |
confirm:aString title:title yesLabel:nil noLabel:noText |
|
1245 |
||
1246 |
" |
|
1247 |
Dialog |
|
1248 |
confirm:'really ?' |
|
1249 |
title:'fooBar' |
|
1250 |
noLabel:'nope' |
|
1251 |
" |
|
1252 |
||
1253 |
" |
|
1254 |
Dialog |
|
1255 |
confirm:'really ?' |
|
1256 |
title:nil |
|
1257 |
noLabel:'cancel' |
|
1258 |
" |
|
1259 |
! |
|
1260 |
||
498 | 1261 |
confirm:aString title:title yesLabel:yesText noLabel:noText |
253
f071ff350cd5
added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents:
241
diff
changeset
|
1262 |
"launch a Dialog, which allows user to enter yes or no. |
f071ff350cd5
added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents:
241
diff
changeset
|
1263 |
return true for yes, false for no. |
f071ff350cd5
added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents:
241
diff
changeset
|
1264 |
The yes/no buttons labels are defined by yesText/noText." |
f071ff350cd5
added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents:
241
diff
changeset
|
1265 |
|
881 | 1266 |
|box answer t| |
253
f071ff350cd5
added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents:
241
diff
changeset
|
1267 |
|
f071ff350cd5
added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents:
241
diff
changeset
|
1268 |
box := YesNoBox title:aString. |
498 | 1269 |
yesText notNil ifTrue:[ |
1488
630b308c4295
ESC returns false in #confirm-dialog
Claus Gittinger <cg@exept.de>
parents:
1401
diff
changeset
|
1270 |
box yesLabel:yesText. |
498 | 1271 |
]. |
1272 |
noText notNil ifTrue:[ |
|
1488
630b308c4295
ESC returns false in #confirm-dialog
Claus Gittinger <cg@exept.de>
parents:
1401
diff
changeset
|
1273 |
box noLabel:noText. |
498 | 1274 |
]. |
1488
630b308c4295
ESC returns false in #confirm-dialog
Claus Gittinger <cg@exept.de>
parents:
1401
diff
changeset
|
1275 |
answer := false. |
630b308c4295
ESC returns false in #confirm-dialog
Claus Gittinger <cg@exept.de>
parents:
1401
diff
changeset
|
1276 |
box yesAction:[answer := true]. |
498 | 1277 |
title notNil ifTrue:[ |
1488
630b308c4295
ESC returns false in #confirm-dialog
Claus Gittinger <cg@exept.de>
parents:
1401
diff
changeset
|
1278 |
t := title |
881 | 1279 |
] ifFalse:[ |
1488
630b308c4295
ESC returns false in #confirm-dialog
Claus Gittinger <cg@exept.de>
parents:
1401
diff
changeset
|
1280 |
t := self classResources string:'confirm' |
498 | 1281 |
]. |
1488
630b308c4295
ESC returns false in #confirm-dialog
Claus Gittinger <cg@exept.de>
parents:
1401
diff
changeset
|
1282 |
|
881 | 1283 |
box label:t. |
253
f071ff350cd5
added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents:
241
diff
changeset
|
1284 |
box showAtPointer. |
f071ff350cd5
added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents:
241
diff
changeset
|
1285 |
box yesAction:nil noAction:nil. |
719
574be1981be0
destroy boxes from standard dialogs
Claus Gittinger <cg@exept.de>
parents:
718
diff
changeset
|
1286 |
box destroy. |
253
f071ff350cd5
added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents:
241
diff
changeset
|
1287 |
^ answer |
f071ff350cd5
added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents:
241
diff
changeset
|
1288 |
|
f071ff350cd5
added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents:
241
diff
changeset
|
1289 |
" |
498 | 1290 |
Dialog |
1488
630b308c4295
ESC returns false in #confirm-dialog
Claus Gittinger <cg@exept.de>
parents:
1401
diff
changeset
|
1291 |
confirm:'really ?' |
630b308c4295
ESC returns false in #confirm-dialog
Claus Gittinger <cg@exept.de>
parents:
1401
diff
changeset
|
1292 |
title:'fooBar' |
630b308c4295
ESC returns false in #confirm-dialog
Claus Gittinger <cg@exept.de>
parents:
1401
diff
changeset
|
1293 |
yesLabel:'oh well' |
630b308c4295
ESC returns false in #confirm-dialog
Claus Gittinger <cg@exept.de>
parents:
1401
diff
changeset
|
1294 |
noLabel:'nope' |
498 | 1295 |
" |
1296 |
||
881 | 1297 |
" |
1298 |
Dialog |
|
1488
630b308c4295
ESC returns false in #confirm-dialog
Claus Gittinger <cg@exept.de>
parents:
1401
diff
changeset
|
1299 |
confirm:'really ?' |
630b308c4295
ESC returns false in #confirm-dialog
Claus Gittinger <cg@exept.de>
parents:
1401
diff
changeset
|
1300 |
title:nil |
630b308c4295
ESC returns false in #confirm-dialog
Claus Gittinger <cg@exept.de>
parents:
1401
diff
changeset
|
1301 |
yesLabel:'oh well' |
630b308c4295
ESC returns false in #confirm-dialog
Claus Gittinger <cg@exept.de>
parents:
1401
diff
changeset
|
1302 |
noLabel:'nope' |
881 | 1303 |
" |
1304 |
||
1305 |
" |
|
1306 |
Dialog |
|
1488
630b308c4295
ESC returns false in #confirm-dialog
Claus Gittinger <cg@exept.de>
parents:
1401
diff
changeset
|
1307 |
confirm:'really ?' |
630b308c4295
ESC returns false in #confirm-dialog
Claus Gittinger <cg@exept.de>
parents:
1401
diff
changeset
|
1308 |
title:'' |
630b308c4295
ESC returns false in #confirm-dialog
Claus Gittinger <cg@exept.de>
parents:
1401
diff
changeset
|
1309 |
yesLabel:'oh well' |
630b308c4295
ESC returns false in #confirm-dialog
Claus Gittinger <cg@exept.de>
parents:
1401
diff
changeset
|
1310 |
noLabel:'nope' |
630b308c4295
ESC returns false in #confirm-dialog
Claus Gittinger <cg@exept.de>
parents:
1401
diff
changeset
|
1311 |
" |
630b308c4295
ESC returns false in #confirm-dialog
Claus Gittinger <cg@exept.de>
parents:
1401
diff
changeset
|
1312 |
|
630b308c4295
ESC returns false in #confirm-dialog
Claus Gittinger <cg@exept.de>
parents:
1401
diff
changeset
|
1313 |
"Created: / 21.2.1996 / 01:10:14 / cg" |
630b308c4295
ESC returns false in #confirm-dialog
Claus Gittinger <cg@exept.de>
parents:
1401
diff
changeset
|
1314 |
"Modified: / 18.4.1998 / 19:25:21 / cg" |
498 | 1315 |
! |
1316 |
||
1317 |
confirm:aString yesLabel:yesText noLabel:noText |
|
1318 |
"launch a Dialog, which allows user to enter yes or no. |
|
1319 |
return true for yes, false for no. |
|
1320 |
The yes/no buttons labels are defined by yesText/noText." |
|
1321 |
||
1322 |
^ self confirm:aString title:nil yesLabel:yesText noLabel:noText |
|
1323 |
||
1324 |
" |
|
253
f071ff350cd5
added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents:
241
diff
changeset
|
1325 |
Dialog confirm:'really ?' yesLabel:'oh well' noLabel:'nope' |
f071ff350cd5
added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents:
241
diff
changeset
|
1326 |
" |
f071ff350cd5
added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents:
241
diff
changeset
|
1327 |
|
374 | 1328 |
"Created: 21.2.1996 / 01:10:14 / cg" |
498 | 1329 |
"Modified: 8.3.1996 / 21:15:06 / cg" |
253
f071ff350cd5
added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents:
241
diff
changeset
|
1330 |
! |
f071ff350cd5
added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents:
241
diff
changeset
|
1331 |
|
197 | 1332 |
confirmWithCancel:aString |
1333 |
"launch a Dialog, which allows user to enter yes, no and cancel. |
|
1334 |
return true for 'yes', false for 'no', nil for 'cancel'" |
|
1335 |
||
1004 | 1336 |
^ self confirmWithCancel:aString default:nil |
1337 |
||
846
75c5dc601522
added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents:
831
diff
changeset
|
1338 |
" |
75c5dc601522
added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents:
831
diff
changeset
|
1339 |
Dialog confirmWithCancel:'really ?' |
75c5dc601522
added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents:
831
diff
changeset
|
1340 |
" |
75c5dc601522
added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents:
831
diff
changeset
|
1341 |
|
75c5dc601522
added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents:
831
diff
changeset
|
1342 |
" |
75c5dc601522
added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents:
831
diff
changeset
|
1343 |
Transcript showCR:( |
1401 | 1344 |
Dialog confirmWithCancel:'really ?' |
846
75c5dc601522
added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents:
831
diff
changeset
|
1345 |
) |
75c5dc601522
added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents:
831
diff
changeset
|
1346 |
" |
75c5dc601522
added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents:
831
diff
changeset
|
1347 |
|
75c5dc601522
added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents:
831
diff
changeset
|
1348 |
"Modified: 18.10.1996 / 14:51:51 / cg" |
75c5dc601522
added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents:
831
diff
changeset
|
1349 |
! |
75c5dc601522
added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents:
831
diff
changeset
|
1350 |
|
1004 | 1351 |
confirmWithCancel:aString default:default |
1352 |
"launch a Dialog, which allows user to enter yes, no and cancel. |
|
1353 |
return true for 'yes', false for 'no', nil for 'cancel'. |
|
1354 |
The default argument marks the return-button; it may be one of nil, false or true" |
|
1355 |
||
1356 |
^ self |
|
1401 | 1357 |
confirmWithCancel:aString |
1358 |
labels:(self |
|
1359 |
classResources |
|
1360 |
array: |
|
1361 |
#('cancel' |
|
1362 |
'no' |
|
1363 |
'yes') |
|
1364 |
) |
|
1365 |
default:(#(nil false true) indexOf:default ifAbsent:nil) |
|
1004 | 1366 |
" |
1367 |
Dialog confirmWithCancel:'really ?' default:false |
|
1368 |
" |
|
1369 |
! |
|
1370 |
||
1624
bc716c00b226
added #confirmWithCancel:labels:
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
1371 |
confirmWithCancel:aString labels:labelArray |
bc716c00b226
added #confirmWithCancel:labels:
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
1372 |
"launch a Dialog, which allows user to enter cancel, no or yes. |
bc716c00b226
added #confirmWithCancel:labels:
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
1373 |
Return true for 'yes', false for 'no', nil for 'cancel'. |
bc716c00b226
added #confirmWithCancel:labels:
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
1374 |
The default is yes. |
bc716c00b226
added #confirmWithCancel:labels:
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
1375 |
The buttons labels are given in labelArray" |
bc716c00b226
added #confirmWithCancel:labels:
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
1376 |
|
bc716c00b226
added #confirmWithCancel:labels:
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
1377 |
^ self |
bc716c00b226
added #confirmWithCancel:labels:
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
1378 |
confirmWithCancel:aString |
bc716c00b226
added #confirmWithCancel:labels:
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
1379 |
labels:(self |
bc716c00b226
added #confirmWithCancel:labels:
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
1380 |
classResources |
bc716c00b226
added #confirmWithCancel:labels:
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
1381 |
array:labelArray |
bc716c00b226
added #confirmWithCancel:labels:
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
1382 |
) |
bc716c00b226
added #confirmWithCancel:labels:
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
1383 |
default:3 |
bc716c00b226
added #confirmWithCancel:labels:
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
1384 |
" |
bc716c00b226
added #confirmWithCancel:labels:
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
1385 |
Dialog confirmWithCancel:'really ?' labels:#( 'oops' 'nope' 'yea') |
bc716c00b226
added #confirmWithCancel:labels:
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
1386 |
" |
bc716c00b226
added #confirmWithCancel:labels:
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
1387 |
|
bc716c00b226
added #confirmWithCancel:labels:
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
1388 |
"Modified: / 28.7.1998 / 21:40:40 / cg" |
bc716c00b226
added #confirmWithCancel:labels:
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
1389 |
! |
bc716c00b226
added #confirmWithCancel:labels:
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
1390 |
|
846
75c5dc601522
added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents:
831
diff
changeset
|
1391 |
confirmWithCancel:aString labels:buttonLabels default:default |
75c5dc601522
added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents:
831
diff
changeset
|
1392 |
"launch a Dialog, which allows user to enter yes, no and cancel. |
75c5dc601522
added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents:
831
diff
changeset
|
1393 |
Return true for 'yes', false for 'no', nil for 'cancel'. |
75c5dc601522
added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents:
831
diff
changeset
|
1394 |
The strings for cancel, no and yes are to be passed in |
1004 | 1395 |
buttonLabels; |
1396 |
The default argument (if non-nil) defines the index of the |
|
846
75c5dc601522
added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents:
831
diff
changeset
|
1397 |
return button (1 to 3)" |
75c5dc601522
added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents:
831
diff
changeset
|
1398 |
|
1707 | 1399 |
^ self |
1400 |
confirmWithCancel:aString |
|
1401 |
labels:buttonLabels |
|
1402 |
values:#(nil false true) |
|
1403 |
default:default |
|
1404 |
||
1405 |
" |
|
1406 |
Transcript showCR:( |
|
1407 |
Dialog |
|
1408 |
confirmWithCancel:'really ?' |
|
1409 |
labels:#('mhmh' 'maybe' 'definitely') |
|
1410 |
default:3 |
|
1411 |
) |
|
1412 |
" |
|
1413 |
||
1414 |
"Created: / 18.10.1996 / 14:50:51 / cg" |
|
1415 |
"Modified: / 21.10.1998 / 15:49:16 / cg" |
|
1416 |
! |
|
1417 |
||
1418 |
confirmWithCancel:aString labels:buttonLabels values:buttonValues default:default |
|
1419 |
"launch a Dialog, which allows user to click on any button. |
|
1420 |
Return the corresponding value from the values array. |
|
1421 |
The labels for for the buttons are to be passed in |
|
1422 |
buttonLabels; |
|
1423 |
The default argument (if non-nil) defines the index of the |
|
1424 |
return button (1 to n)" |
|
1425 |
||
1748
88215be18503
+ confirmWithCancel:labels:values:default:boxLabel:
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
1426 |
^ self |
88215be18503
+ confirmWithCancel:labels:values:default:boxLabel:
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
1427 |
confirmWithCancel:aString |
88215be18503
+ confirmWithCancel:labels:values:default:boxLabel:
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
1428 |
labels:buttonLabels |
88215be18503
+ confirmWithCancel:labels:values:default:boxLabel:
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
1429 |
values:buttonValues |
88215be18503
+ confirmWithCancel:labels:values:default:boxLabel:
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
1430 |
default:default |
88215be18503
+ confirmWithCancel:labels:values:default:boxLabel:
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
1431 |
boxLabel:nil |
88215be18503
+ confirmWithCancel:labels:values:default:boxLabel:
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
1432 |
|
88215be18503
+ confirmWithCancel:labels:values:default:boxLabel:
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
1433 |
" |
88215be18503
+ confirmWithCancel:labels:values:default:boxLabel:
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
1434 |
Transcript showCR:( |
88215be18503
+ confirmWithCancel:labels:values:default:boxLabel:
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
1435 |
Dialog |
88215be18503
+ confirmWithCancel:labels:values:default:boxLabel:
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
1436 |
confirmWithCancel:'really ?' |
88215be18503
+ confirmWithCancel:labels:values:default:boxLabel:
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
1437 |
labels:#('mhmh' 'maybe' 'definitely') |
88215be18503
+ confirmWithCancel:labels:values:default:boxLabel:
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
1438 |
values:#(1 2 3) |
88215be18503
+ confirmWithCancel:labels:values:default:boxLabel:
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
1439 |
default:3 |
88215be18503
+ confirmWithCancel:labels:values:default:boxLabel:
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
1440 |
) |
88215be18503
+ confirmWithCancel:labels:values:default:boxLabel:
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
1441 |
" |
88215be18503
+ confirmWithCancel:labels:values:default:boxLabel:
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
1442 |
|
88215be18503
+ confirmWithCancel:labels:values:default:boxLabel:
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
1443 |
"Created: / 18.10.1996 / 14:50:51 / cg" |
88215be18503
+ confirmWithCancel:labels:values:default:boxLabel:
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
1444 |
"Modified: / 21.10.1998 / 17:14:14 / cg" |
88215be18503
+ confirmWithCancel:labels:values:default:boxLabel:
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
1445 |
! |
88215be18503
+ confirmWithCancel:labels:values:default:boxLabel:
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
1446 |
|
88215be18503
+ confirmWithCancel:labels:values:default:boxLabel:
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
1447 |
confirmWithCancel:aString labels:buttonLabels values:buttonValues default:default boxLabel:boxLabelOrNil |
88215be18503
+ confirmWithCancel:labels:values:default:boxLabel:
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
1448 |
"launch a Dialog, which allows user to click on any button. |
88215be18503
+ confirmWithCancel:labels:values:default:boxLabel:
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
1449 |
Return the corresponding value from the values array. |
88215be18503
+ confirmWithCancel:labels:values:default:boxLabel:
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
1450 |
The labels for for the buttons are to be passed in |
88215be18503
+ confirmWithCancel:labels:values:default:boxLabel:
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
1451 |
buttonLabels; |
88215be18503
+ confirmWithCancel:labels:values:default:boxLabel:
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
1452 |
The default argument (if non-nil) defines the index of the |
88215be18503
+ confirmWithCancel:labels:values:default:boxLabel:
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
1453 |
return button (1 to n)" |
88215be18503
+ confirmWithCancel:labels:values:default:boxLabel:
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
1454 |
|
197 | 1455 |
|box answer| |
1456 |
||
1708
dc23c5ca439e
fixed button-creation in confirmWithCancel.
Claus Gittinger <cg@exept.de>
parents:
1707
diff
changeset
|
1457 |
box := OptionBox title:aString numberOfOptions:buttonLabels size. |
846
75c5dc601522
added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents:
831
diff
changeset
|
1458 |
box buttonTitles:buttonLabels |
1707 | 1459 |
actions:(buttonValues collect:[:v | [answer := v]]). |
1460 |
||
846
75c5dc601522
added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents:
831
diff
changeset
|
1461 |
default notNil ifTrue:[box defaultButtonIndex:default]. |
1748
88215be18503
+ confirmWithCancel:labels:values:default:boxLabel:
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
1462 |
box label:(boxLabelOrNil ? (self classResources string:'confirm')). |
197 | 1463 |
box showAtPointer. |
1464 |
box actions:nil. |
|
719
574be1981be0
destroy boxes from standard dialogs
Claus Gittinger <cg@exept.de>
parents:
718
diff
changeset
|
1465 |
box destroy. |
197 | 1466 |
^ answer |
1467 |
||
1468 |
" |
|
1707 | 1469 |
Transcript showCR:( |
1470 |
Dialog |
|
1471 |
confirmWithCancel:'really ?' |
|
1748
88215be18503
+ confirmWithCancel:labels:values:default:boxLabel:
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
1472 |
labels:#('mhmh' 'maybe' 'definitely') |
88215be18503
+ confirmWithCancel:labels:values:default:boxLabel:
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
1473 |
values:#(1 2 3) |
88215be18503
+ confirmWithCancel:labels:values:default:boxLabel:
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
1474 |
default:3 |
88215be18503
+ confirmWithCancel:labels:values:default:boxLabel:
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
1475 |
boxLabel:'hello there' |
1707 | 1476 |
) |
1477 |
" |
|
1478 |
||
1479 |
"Created: / 18.10.1996 / 14:50:51 / cg" |
|
1708
dc23c5ca439e
fixed button-creation in confirmWithCancel.
Claus Gittinger <cg@exept.de>
parents:
1707
diff
changeset
|
1480 |
"Modified: / 21.10.1998 / 17:14:14 / cg" |
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
1481 |
! ! |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
1482 |
|
846
75c5dc601522
added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents:
831
diff
changeset
|
1483 |
!DialogBox class methodsFor:'defaults'! |
573 | 1484 |
|
1485 |
defaultLabel |
|
1486 |
"return the boxes default window title." |
|
1487 |
||
1488 |
^ 'Dialog' |
|
1489 |
||
1490 |
"Created: 23.4.1996 / 17:13:10 / cg" |
|
1757 | 1491 |
! |
1492 |
||
1493 |
updateStyleCache |
|
1494 |
"extract values from the styleSheet and cache them in class variables" |
|
1495 |
||
1496 |
<resource: #style (#'dialogBox.returnShiftsFocusToOK')> |
|
1497 |
||
1498 |
DefaultFocusToOKOnLeave := StyleSheet at:'dialogBox.returnShiftsFocusToOK' default:false. |
|
1499 |
||
573 | 1500 |
! ! |
1501 |
||
846
75c5dc601522
added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents:
831
diff
changeset
|
1502 |
!DialogBox class methodsFor:'file name dialogs'! |
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
1503 |
|
549
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1504 |
requestDirectoryName |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1505 |
"same as requestFileName, but only show directories." |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1506 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1507 |
^ self |
1401 | 1508 |
requestDirectoryName:'directory ?' |
549
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1509 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1510 |
" |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1511 |
Dialog requestDirectoryName |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1512 |
" |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1513 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1514 |
"Created: 19.4.1996 / 14:29:48 / cg" |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1515 |
"Modified: 19.4.1996 / 14:32:42 / cg" |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1516 |
! |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1517 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1518 |
requestDirectoryName:title |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1519 |
"same as requestFileName, but only show directories." |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1520 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1521 |
^ self |
1401 | 1522 |
requestDirectoryName:title |
1523 |
default:nil |
|
1524 |
ifFail:'' |
|
549
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1525 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1526 |
" |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1527 |
Dialog |
1401 | 1528 |
requestDirectoryName:'which directory ?' |
549
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1529 |
" |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1530 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1531 |
"Created: 19.4.1996 / 14:29:48 / cg" |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1532 |
"Modified: 19.4.1996 / 14:32:02 / cg" |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1533 |
! |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1534 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1535 |
requestDirectoryName:title default:aFileName |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1536 |
"same as requestFileName, but only show directories" |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1537 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1538 |
^ self |
1740
0160c5afae9c
care for default-dir in #requestDirectoryName:..
Claus Gittinger <cg@exept.de>
parents:
1736
diff
changeset
|
1539 |
requestDirectoryName:title |
0160c5afae9c
care for default-dir in #requestDirectoryName:..
Claus Gittinger <cg@exept.de>
parents:
1736
diff
changeset
|
1540 |
default:aFileName |
0160c5afae9c
care for default-dir in #requestDirectoryName:..
Claus Gittinger <cg@exept.de>
parents:
1736
diff
changeset
|
1541 |
ifFail:'' |
549
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1542 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1543 |
" |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1544 |
Dialog |
1740
0160c5afae9c
care for default-dir in #requestDirectoryName:..
Claus Gittinger <cg@exept.de>
parents:
1736
diff
changeset
|
1545 |
requestDirectoryName:'which directory ?' |
0160c5afae9c
care for default-dir in #requestDirectoryName:..
Claus Gittinger <cg@exept.de>
parents:
1736
diff
changeset
|
1546 |
default:'/etc' |
549
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1547 |
" |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1548 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1549 |
"Created: 19.4.1996 / 14:29:10 / cg" |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1550 |
"Modified: 19.4.1996 / 14:31:52 / cg" |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1551 |
! |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1552 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1553 |
requestDirectoryName:title default:aFileName ifFail:failBlock |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1554 |
"same as requestFileName, but only show directories" |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1555 |
|
1740
0160c5afae9c
care for default-dir in #requestDirectoryName:..
Claus Gittinger <cg@exept.de>
parents:
1736
diff
changeset
|
1556 |
|dir dirF fN fileBox enteredName| |
549
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1557 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1558 |
fileBox := FileSelectionBox |
1740
0160c5afae9c
care for default-dir in #requestDirectoryName:..
Claus Gittinger <cg@exept.de>
parents:
1736
diff
changeset
|
1559 |
title:title |
0160c5afae9c
care for default-dir in #requestDirectoryName:..
Claus Gittinger <cg@exept.de>
parents:
1736
diff
changeset
|
1560 |
okText:'ok' |
0160c5afae9c
care for default-dir in #requestDirectoryName:..
Claus Gittinger <cg@exept.de>
parents:
1736
diff
changeset
|
1561 |
abortText:'cancel' |
0160c5afae9c
care for default-dir in #requestDirectoryName:..
Claus Gittinger <cg@exept.de>
parents:
1736
diff
changeset
|
1562 |
action:[:fileName | enteredName := fileName]. |
0160c5afae9c
care for default-dir in #requestDirectoryName:..
Claus Gittinger <cg@exept.de>
parents:
1736
diff
changeset
|
1563 |
|
0160c5afae9c
care for default-dir in #requestDirectoryName:..
Claus Gittinger <cg@exept.de>
parents:
1736
diff
changeset
|
1564 |
fN := aFileName. |
1780
bfc30a82aae3
dont get confused with a nil default
Claus Gittinger <cg@exept.de>
parents:
1764
diff
changeset
|
1565 |
dirF := (aFileName ? '.') asFilename. |
1740
0160c5afae9c
care for default-dir in #requestDirectoryName:..
Claus Gittinger <cg@exept.de>
parents:
1736
diff
changeset
|
1566 |
dirF name = dirF baseName ifFalse:[ |
0160c5afae9c
care for default-dir in #requestDirectoryName:..
Claus Gittinger <cg@exept.de>
parents:
1736
diff
changeset
|
1567 |
dir := dirF directoryName. |
0160c5afae9c
care for default-dir in #requestDirectoryName:..
Claus Gittinger <cg@exept.de>
parents:
1736
diff
changeset
|
1568 |
fN := dirF baseName. |
0160c5afae9c
care for default-dir in #requestDirectoryName:..
Claus Gittinger <cg@exept.de>
parents:
1736
diff
changeset
|
1569 |
] ifTrue:[ |
0160c5afae9c
care for default-dir in #requestDirectoryName:..
Claus Gittinger <cg@exept.de>
parents:
1736
diff
changeset
|
1570 |
dir := FileSelectionBox lastFileSelectionDirectory. |
0160c5afae9c
care for default-dir in #requestDirectoryName:..
Claus Gittinger <cg@exept.de>
parents:
1736
diff
changeset
|
1571 |
]. |
1360
ede30cea2827
also remember last directory in requestFileName dialogs
Claus Gittinger <cg@exept.de>
parents:
1355
diff
changeset
|
1572 |
dir notNil ifTrue:[ |
1740
0160c5afae9c
care for default-dir in #requestDirectoryName:..
Claus Gittinger <cg@exept.de>
parents:
1736
diff
changeset
|
1573 |
fileBox directory:dir. |
1360
ede30cea2827
also remember last directory in requestFileName dialogs
Claus Gittinger <cg@exept.de>
parents:
1355
diff
changeset
|
1574 |
]. |
549
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1575 |
|
1740
0160c5afae9c
care for default-dir in #requestDirectoryName:..
Claus Gittinger <cg@exept.de>
parents:
1736
diff
changeset
|
1576 |
fileBox initialText:fN. |
549
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1577 |
fileBox selectingDirectory:true. |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1578 |
fileBox showAtPointer. |
719
574be1981be0
destroy boxes from standard dialogs
Claus Gittinger <cg@exept.de>
parents:
718
diff
changeset
|
1579 |
fileBox destroy. |
1360
ede30cea2827
also remember last directory in requestFileName dialogs
Claus Gittinger <cg@exept.de>
parents:
1355
diff
changeset
|
1580 |
|
ede30cea2827
also remember last directory in requestFileName dialogs
Claus Gittinger <cg@exept.de>
parents:
1355
diff
changeset
|
1581 |
(enteredName isNil |
ede30cea2827
also remember last directory in requestFileName dialogs
Claus Gittinger <cg@exept.de>
parents:
1355
diff
changeset
|
1582 |
or:[enteredName isEmpty]) ifTrue:[ |
1740
0160c5afae9c
care for default-dir in #requestDirectoryName:..
Claus Gittinger <cg@exept.de>
parents:
1736
diff
changeset
|
1583 |
^ failBlock value |
1360
ede30cea2827
also remember last directory in requestFileName dialogs
Claus Gittinger <cg@exept.de>
parents:
1355
diff
changeset
|
1584 |
]. |
ede30cea2827
also remember last directory in requestFileName dialogs
Claus Gittinger <cg@exept.de>
parents:
1355
diff
changeset
|
1585 |
|
ede30cea2827
also remember last directory in requestFileName dialogs
Claus Gittinger <cg@exept.de>
parents:
1355
diff
changeset
|
1586 |
FileSelectionBox lastFileSelectionDirectory:(enteredName asFilename directoryName). |
ede30cea2827
also remember last directory in requestFileName dialogs
Claus Gittinger <cg@exept.de>
parents:
1355
diff
changeset
|
1587 |
|
ede30cea2827
also remember last directory in requestFileName dialogs
Claus Gittinger <cg@exept.de>
parents:
1355
diff
changeset
|
1588 |
^ enteredName |
549
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1589 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1590 |
" |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1591 |
Dialog |
1740
0160c5afae9c
care for default-dir in #requestDirectoryName:..
Claus Gittinger <cg@exept.de>
parents:
1736
diff
changeset
|
1592 |
requestDirectoryName:'which directory ?' |
0160c5afae9c
care for default-dir in #requestDirectoryName:..
Claus Gittinger <cg@exept.de>
parents:
1736
diff
changeset
|
1593 |
default:'/etc' |
0160c5afae9c
care for default-dir in #requestDirectoryName:..
Claus Gittinger <cg@exept.de>
parents:
1736
diff
changeset
|
1594 |
ifFail:'none' |
549
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1595 |
" |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1596 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1597 |
"Created: 19.4.1996 / 14:31:04 / cg" |
1360
ede30cea2827
also remember last directory in requestFileName dialogs
Claus Gittinger <cg@exept.de>
parents:
1355
diff
changeset
|
1598 |
"Modified: 23.10.1997 / 19:24:41 / cg" |
549
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1599 |
! |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1600 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1601 |
requestFileName |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1602 |
"launch a Dialog, which allows the user to enter a filename. |
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
1603 |
Return the pathname string consisting of the full pathname of the filename, |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
1604 |
or an empty string (if cancel was pressed)." |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
1605 |
|
549
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1606 |
^ self |
1401 | 1607 |
requestFileName:'filename:' |
549
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1608 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1609 |
" |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1610 |
Dialog requestFileName |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1611 |
" |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1612 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1613 |
"Created: 27.1.1996 / 13:24:35 / cg" |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1614 |
"Modified: 19.4.1996 / 13:49:28 / cg" |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1615 |
! |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1616 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1617 |
requestFileName:titleString |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1618 |
"launch a Dialog, which allows user to enter a filename. |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1619 |
Return the pathname string consisting of the full pathname of the filename, |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1620 |
or an empty string (if cancel was pressed)." |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1621 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1622 |
^ self |
1401 | 1623 |
requestFileName:titleString |
1624 |
default:'file.ext' |
|
183 | 1625 |
|
197 | 1626 |
" |
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
1627 |
Dialog requestFileName:'enter a fileName:' |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
1628 |
Dialog requestFileName:'enter a fileName:' |
183 | 1629 |
" |
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
1630 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
1631 |
"Created: 27.1.1996 / 13:24:35 / cg" |
549
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1632 |
"Modified: 19.4.1996 / 13:53:17 / cg" |
118 | 1633 |
! |
1634 |
||
100 | 1635 |
requestFileName:titleString default:defaultName |
1636 |
"launch a Dialog, which allows user to enter a filename. |
|
1637 |
The box will not allow pressing 'ok' without an entered string. |
|
1638 |
Return the pathname string consisting of the full pathname of the filename, |
|
1639 |
or an empty string (if cancel was pressed)." |
|
1640 |
||
549
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1641 |
^ self |
1401 | 1642 |
requestFileName:titleString |
1643 |
default:defaultName |
|
1644 |
version:nil |
|
1645 |
ifFail:'' |
|
100 | 1646 |
|
1647 |
" |
|
1648 |
Dialog requestFileName:'enter a fileName:' default:'' |
|
1649 |
Dialog requestFileName:'enter a fileName:' default:'Makefile.bak' |
|
1650 |
" |
|
549
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1651 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1652 |
"Modified: 19.4.1996 / 13:47:44 / cg" |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1653 |
! |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1654 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1655 |
requestFileName:titleString default:defaultName fromDirectory:aDirectoryPath |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1656 |
"launch a Dialog, which allows user to enter a filename. |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1657 |
The box will not allow pressing 'ok' without an entered string. |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1658 |
Return the pathname string consisting of the full pathname of the filename, |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1659 |
or an empty string (if cancel was pressed)." |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1660 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1661 |
^ self |
1401 | 1662 |
requestFileName:titleString |
1663 |
default:defaultName |
|
1664 |
version:nil |
|
1665 |
ifFail:'' |
|
1666 |
fromDirectory:aDirectoryPath |
|
549
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1667 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1668 |
" |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1669 |
Dialog |
1401 | 1670 |
requestFileName:'enter a fileName:' |
1671 |
default:'Makefile.bak' |
|
1672 |
fromDirectory:'..' |
|
549
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1673 |
" |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1674 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1675 |
"Modified: 19.4.1996 / 14:27:31 / cg" |
100 | 1676 |
! |
1677 |
||
1736 | 1678 |
requestFileName:titleString default:defaultName ifFail:failReturn pattern:pattern fromDirectory:dir |
1679 |
"launch a Dialog, which allows user to enter a filename. |
|
1680 |
The files presented initially are those from dir. |
|
1681 |
The box will show ok/cancel in its buttons. |
|
1682 |
The matchPattern is set to pattern initially. |
|
1683 |
Return the string or failReturn if cancel was pressed." |
|
1684 |
||
1685 |
^ self |
|
1686 |
requestFileName:titleString |
|
1687 |
default:defaultName |
|
1688 |
version:nil |
|
1689 |
ifFail:failReturn |
|
1690 |
pattern:pattern |
|
1691 |
fromDirectory:dir |
|
1692 |
||
1693 |
! |
|
1694 |
||
197 | 1695 |
requestFileName:titleString default:defaultName ok:okText abort:abortText pattern:pattern |
1696 |
"launch a Dialog, which allows user to enter a filename. |
|
549
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1697 |
The files presented initially are those from the current directory. |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1698 |
The box will show okText in its okButton, abortText in the abortButton. |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1699 |
The matchPattern is set to pattern initially. |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1700 |
Return the string or nil if cancel was pressed." |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1701 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1702 |
^ self |
1401 | 1703 |
requestFileName:titleString |
1704 |
default:defaultName |
|
1705 |
ok:okText |
|
1706 |
abort:abortText |
|
1707 |
pattern:pattern |
|
1708 |
fromDirectory:nil |
|
549
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1709 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1710 |
" |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1711 |
Dialog |
1401 | 1712 |
requestFileName:'enter a fileName:' |
1713 |
default:'' |
|
1714 |
ok:'yeah' |
|
1715 |
abort:'oh, no' |
|
1716 |
pattern:'*.st' |
|
549
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1717 |
" |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1718 |
|
1029
ddc27f751b3d
allow path as default in requestFileName;
Claus Gittinger <cg@exept.de>
parents:
1004
diff
changeset
|
1719 |
"Modified: 20.2.1997 / 18:13:13 / cg" |
549
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1720 |
! |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1721 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1722 |
requestFileName:titleString default:defaultName ok:okText abort:abortText pattern:pattern fromDirectory:aDirectoryPath |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1723 |
"launch a Dialog, which allows user to enter a filename. |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1724 |
The files presented initially are those in aDirectoryPath, or the |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1725 |
current directory (if a nil path is given). |
197 | 1726 |
The box will show okText in its okButton, abortText in the abortButton. |
1727 |
The matchPattern is set to pattern initially. |
|
719
574be1981be0
destroy boxes from standard dialogs
Claus Gittinger <cg@exept.de>
parents:
718
diff
changeset
|
1728 |
Return the string, or nil if cancel was pressed." |
197 | 1729 |
|
1360
ede30cea2827
also remember last directory in requestFileName dialogs
Claus Gittinger <cg@exept.de>
parents:
1355
diff
changeset
|
1730 |
|box defaultDir defaultNm dir enteredName| |
1029
ddc27f751b3d
allow path as default in requestFileName;
Claus Gittinger <cg@exept.de>
parents:
1004
diff
changeset
|
1731 |
|
ddc27f751b3d
allow path as default in requestFileName;
Claus Gittinger <cg@exept.de>
parents:
1004
diff
changeset
|
1732 |
defaultNm := defaultName. |
ddc27f751b3d
allow path as default in requestFileName;
Claus Gittinger <cg@exept.de>
parents:
1004
diff
changeset
|
1733 |
defaultDir := aDirectoryPath. |
ddc27f751b3d
allow path as default in requestFileName;
Claus Gittinger <cg@exept.de>
parents:
1004
diff
changeset
|
1734 |
defaultDir isNil ifTrue:[ |
1401 | 1735 |
defaultNm notNil ifTrue:[ |
1736 |
defaultDir := defaultName asFilename directoryName. |
|
1737 |
defaultNm := defaultNm asFilename baseName. |
|
1738 |
defaultDir = Filename currentDirectory name ifTrue:[ |
|
1739 |
defaultName asFilename isExplicitRelative ifFalse:[ |
|
1740 |
defaultDir := nil |
|
1741 |
] |
|
1742 |
] |
|
1743 |
]. |
|
1029
ddc27f751b3d
allow path as default in requestFileName;
Claus Gittinger <cg@exept.de>
parents:
1004
diff
changeset
|
1744 |
]. |
197 | 1745 |
|
1746 |
box := FileSelectionBox |
|
1401 | 1747 |
title:titleString |
1748 |
okText:okText |
|
1749 |
abortText:abortText |
|
1750 |
action:[:fileName | enteredName := fileName]. |
|
1360
ede30cea2827
also remember last directory in requestFileName dialogs
Claus Gittinger <cg@exept.de>
parents:
1355
diff
changeset
|
1751 |
|
ede30cea2827
also remember last directory in requestFileName dialogs
Claus Gittinger <cg@exept.de>
parents:
1355
diff
changeset
|
1752 |
defaultDir notNil ifTrue:[ |
1401 | 1753 |
box directory:defaultDir |
1360
ede30cea2827
also remember last directory in requestFileName dialogs
Claus Gittinger <cg@exept.de>
parents:
1355
diff
changeset
|
1754 |
] ifFalse:[ |
1401 | 1755 |
dir := FileSelectionBox lastFileSelectionDirectory. |
1756 |
dir notNil ifTrue:[ |
|
1757 |
box directory:dir. |
|
1758 |
]. |
|
1360
ede30cea2827
also remember last directory in requestFileName dialogs
Claus Gittinger <cg@exept.de>
parents:
1355
diff
changeset
|
1759 |
]. |
197 | 1760 |
box pattern:pattern. |
1029
ddc27f751b3d
allow path as default in requestFileName;
Claus Gittinger <cg@exept.de>
parents:
1004
diff
changeset
|
1761 |
box initialText:defaultNm. |
197 | 1762 |
box showAtPointer. |
1763 |
box action:nil. |
|
719
574be1981be0
destroy boxes from standard dialogs
Claus Gittinger <cg@exept.de>
parents:
718
diff
changeset
|
1764 |
box destroy. |
1360
ede30cea2827
also remember last directory in requestFileName dialogs
Claus Gittinger <cg@exept.de>
parents:
1355
diff
changeset
|
1765 |
|
ede30cea2827
also remember last directory in requestFileName dialogs
Claus Gittinger <cg@exept.de>
parents:
1355
diff
changeset
|
1766 |
(enteredName notNil |
ede30cea2827
also remember last directory in requestFileName dialogs
Claus Gittinger <cg@exept.de>
parents:
1355
diff
changeset
|
1767 |
and:[enteredName notEmpty]) ifTrue:[ |
1401 | 1768 |
FileSelectionBox lastFileSelectionDirectory:(enteredName asFilename directoryName). |
1360
ede30cea2827
also remember last directory in requestFileName dialogs
Claus Gittinger <cg@exept.de>
parents:
1355
diff
changeset
|
1769 |
]. |
ede30cea2827
also remember last directory in requestFileName dialogs
Claus Gittinger <cg@exept.de>
parents:
1355
diff
changeset
|
1770 |
|
ede30cea2827
also remember last directory in requestFileName dialogs
Claus Gittinger <cg@exept.de>
parents:
1355
diff
changeset
|
1771 |
^ enteredName |
197 | 1772 |
|
1773 |
" |
|
549
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1774 |
Dialog |
1401 | 1775 |
requestFileName:'enter a fileName:' |
1776 |
default:'' |
|
1777 |
ok:'yeah' |
|
1778 |
abort:'oh, no' |
|
1779 |
pattern:'rc*' |
|
1780 |
fromDirectory:'/etc' |
|
197 | 1781 |
" |
549
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1782 |
|
1360
ede30cea2827
also remember last directory in requestFileName dialogs
Claus Gittinger <cg@exept.de>
parents:
1355
diff
changeset
|
1783 |
"Modified: 23.10.1997 / 19:59:01 / cg" |
197 | 1784 |
! |
1785 |
||
1030 | 1786 |
requestFileName:titleString default:defaultName pattern:pattern |
1787 |
"launch a Dialog, which allows user to enter a filename. |
|
1788 |
The files presented initially are those from the current directory. |
|
1789 |
The box will show ok/cancel in its buttons. |
|
1790 |
The matchPattern is set to pattern initially. |
|
1791 |
Return the string or nil if cancel was pressed." |
|
1792 |
||
1793 |
^ self |
|
1401 | 1794 |
requestFileName:titleString |
1795 |
default:defaultName |
|
1796 |
ok:(self classResources string:'ok') |
|
1797 |
abort:(self classResources string:'cancel') |
|
1798 |
pattern:pattern |
|
1799 |
fromDirectory:nil |
|
1030 | 1800 |
|
1801 |
" |
|
1802 |
Dialog |
|
1401 | 1803 |
requestFileName:'enter a fileName:' |
1804 |
default:'' |
|
1805 |
pattern:'*.st' |
|
1030 | 1806 |
" |
1807 |
" |
|
1808 |
Dialog |
|
1401 | 1809 |
requestFileName:'enter a fileName:' |
1810 |
default:'' |
|
1811 |
pattern:'*.st;*.h' |
|
1030 | 1812 |
" |
1813 |
||
1814 |
"Created: 21.2.1997 / 11:16:52 / cg" |
|
1815 |
"Modified: 21.2.1997 / 11:18:40 / cg" |
|
1816 |
! |
|
1817 |
||
100 | 1818 |
requestFileName:titleString default:defaultName version:versionSymbol |
1819 |
"launch a Dialog, which allows user to enter a filename. |
|
1820 |
The box will not allow pressing 'ok' without an entered string. |
|
1821 |
Return the pathname string or the empty string if cancel was pressed. |
|
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
1822 |
The version argument allows validation of the files existance; |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
1823 |
it may be any of: |
1401 | 1824 |
#mustBeNew - fail (return empty string) if the file exists |
1825 |
#new - confirm if the file exists |
|
1826 |
#mustBeOld - fail if the file does not exist |
|
1827 |
#old - confirm if the file does not exist |
|
1828 |
#any (other) - no validation |
|
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
1829 |
" |
100 | 1830 |
|
549
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1831 |
^ self |
1401 | 1832 |
requestFileName:titleString |
1833 |
default:defaultName |
|
1834 |
version:versionSymbol |
|
1835 |
ifFail:'' |
|
100 | 1836 |
|
1837 |
" |
|
1838 |
Dialog requestFileName:'enter a fileName:' |
|
1401 | 1839 |
default:'' |
1840 |
version:nil |
|
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
1841 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
1842 |
Dialog requestFileName:'enter a fileName:' |
1401 | 1843 |
default:'' |
1844 |
version:#mustBeNew |
|
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
1845 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
1846 |
Dialog requestFileName:'enter a fileName:' |
1401 | 1847 |
default:'' |
1848 |
version:#new |
|
100 | 1849 |
" |
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
1850 |
|
549
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1851 |
"Modified: 19.4.1996 / 13:53:58 / cg" |
100 | 1852 |
! |
1853 |
||
1854 |
requestFileName:titleString default:defaultName version:versionSymbol ifFail:failBlock |
|
1855 |
"launch a Dialog, which allows user to enter a filename. |
|
1856 |
The box will not allow pressing 'ok' without an entered string. |
|
1857 |
Return the string or the value of failBlock if cancel was pressed. |
|
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
1858 |
The version argument allows validation of the files existance; |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
1859 |
it may be any of: |
1401 | 1860 |
#mustBeNew - fail (return empty string) if the file exists |
1861 |
#new - confirm if the file exists |
|
1862 |
#mustBeOld - fail if the file does not exist |
|
1863 |
#old - confirm if the file does not exist |
|
1864 |
#any (other) - no validation |
|
549
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1865 |
" |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1866 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1867 |
^ self |
1401 | 1868 |
requestFileName:titleString |
1869 |
default:defaultName |
|
1870 |
version:versionSymbol |
|
1871 |
ifFail:failBlock |
|
1872 |
fromDirectory:nil |
|
549
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1873 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1874 |
" |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1875 |
Dialog |
1401 | 1876 |
requestFileName:'enter a fileName:' |
1877 |
default:'' |
|
1878 |
version:nil |
|
1879 |
ifFail:['none'] |
|
549
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1880 |
" |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1881 |
" |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1882 |
Dialog |
1401 | 1883 |
requestFileName:'enter a fileName:' |
1884 |
default:'' |
|
1885 |
version:#old |
|
1886 |
ifFail:['none'] |
|
549
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1887 |
" |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1888 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1889 |
"Modified: 19.4.1996 / 14:26:36 / cg" |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1890 |
! |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1891 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1892 |
requestFileName:titleString default:defaultName version:versionSymbol ifFail:failBlock fromDirectory:aDirectoryPath |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1893 |
"launch a Dialog, which allows user to enter a filename. |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1894 |
Return the string or the value of failBlock if cancel was pressed. |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1895 |
The version argument allows validation of the files existance; |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1896 |
it may be any of: |
1736 | 1897 |
#mustBeNew - fail (return empty string) if the file exists |
1898 |
#new - confirm if the file exists |
|
1899 |
#mustBeOld - fail if the file does not exist |
|
1900 |
#old - confirm if the file does not exist |
|
1901 |
#any (other) - no validation |
|
1902 |
" |
|
1903 |
||
1904 |
^ self |
|
1905 |
requestFileName:titleString |
|
1906 |
default:defaultName |
|
1907 |
version:versionSymbol |
|
1908 |
ifFail:failBlock |
|
1909 |
pattern:nil |
|
1910 |
fromDirectory:aDirectoryPath |
|
1031 | 1911 |
|
1912 |
" |
|
1913 |
Dialog |
|
1736 | 1914 |
requestFileName:'enter a fileName:' |
1915 |
default:'' |
|
1916 |
version:nil |
|
1917 |
ifFail:['none'] |
|
1918 |
fromDirectory:'/etc' |
|
1031 | 1919 |
" |
1920 |
" |
|
1921 |
Dialog |
|
1736 | 1922 |
requestFileName:'enter a fileName:' |
1923 |
default:'' |
|
1924 |
version:#old |
|
1925 |
ifFail:['none'] |
|
1926 |
fromDirectory:'/etc' |
|
1031 | 1927 |
" |
1928 |
" |
|
1929 |
Dialog |
|
1736 | 1930 |
requestFileName:'enter a fileName:' |
1931 |
default:'' |
|
1932 |
version:#mustBeNew |
|
1933 |
ifFail:['none'] |
|
1934 |
fromDirectory:'/etc' |
|
1031 | 1935 |
" |
1936 |
||
1937 |
"Modified: 20.2.1997 / 18:12:28 / cg" |
|
1938 |
"Modified: 21.2.1997 / 14:27:27 / stefan" |
|
1939 |
! |
|
1940 |
||
1941 |
requestFileName:titleString default:defaultName version:versionSymbol ifFail:failBlock pattern:pattern fromDirectory:aDirectoryPath |
|
1942 |
"launch a Dialog, which allows user to enter a filename. |
|
1943 |
Return the string or the value of failBlock if cancel was pressed. |
|
1944 |
The version argument allows validation of the files existance; |
|
1945 |
it may be any of: |
|
1575
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
1946 |
#mustBeNew - fail (return empty string) if the file exists |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
1947 |
#new - confirm if the file exists |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
1948 |
#mustBeOld - fail if the file does not exist |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
1949 |
#old - confirm if the file does not exist |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
1950 |
#any (other) - no validation |
1031 | 1951 |
" |
1952 |
||
1029
ddc27f751b3d
allow path as default in requestFileName;
Claus Gittinger <cg@exept.de>
parents:
1004
diff
changeset
|
1953 |
|box defaultDir defaultNm| |
ddc27f751b3d
allow path as default in requestFileName;
Claus Gittinger <cg@exept.de>
parents:
1004
diff
changeset
|
1954 |
|
ddc27f751b3d
allow path as default in requestFileName;
Claus Gittinger <cg@exept.de>
parents:
1004
diff
changeset
|
1955 |
defaultNm := defaultName. |
ddc27f751b3d
allow path as default in requestFileName;
Claus Gittinger <cg@exept.de>
parents:
1004
diff
changeset
|
1956 |
defaultDir := aDirectoryPath. |
ddc27f751b3d
allow path as default in requestFileName;
Claus Gittinger <cg@exept.de>
parents:
1004
diff
changeset
|
1957 |
defaultDir isNil ifTrue:[ |
1575
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
1958 |
defaultNm notNil ifTrue:[ |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
1959 |
defaultName asFilename withoutSuffix baseName = '*' ifTrue:[ |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
1960 |
defaultDir := FileSelectionBox lastFileSelectionDirectory. |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
1961 |
defaultNm := ''. |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
1962 |
] ifFalse:[ |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
1963 |
defaultDir := defaultName asFilename directoryName. |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
1964 |
defaultNm := defaultNm asFilename baseName. |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
1965 |
] |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
1966 |
]. |
1029
ddc27f751b3d
allow path as default in requestFileName;
Claus Gittinger <cg@exept.de>
parents:
1004
diff
changeset
|
1967 |
]. |
100 | 1968 |
|
1969 |
box := FileSelectionBox title:titleString. |
|
1029
ddc27f751b3d
allow path as default in requestFileName;
Claus Gittinger <cg@exept.de>
parents:
1004
diff
changeset
|
1970 |
defaultDir notNil ifTrue:[box directory:defaultDir]. |
1031 | 1971 |
pattern notNil ifTrue:[box pattern:pattern]. |
1029
ddc27f751b3d
allow path as default in requestFileName;
Claus Gittinger <cg@exept.de>
parents:
1004
diff
changeset
|
1972 |
box initialText:defaultNm. |
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
1973 |
box action:[:name | |
1575
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
1974 |
versionSymbol == #mustBeNew ifTrue:[ |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
1975 |
"/ file may not exist |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
1976 |
name asFilename exists ifTrue:[^ '']. |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
1977 |
]. |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
1978 |
versionSymbol == #new ifTrue:[ |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
1979 |
"/ file may not exist |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
1980 |
name asFilename exists ifTrue:[ |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
1981 |
(self confirm:(self classResources string:'''%1'' exists.\\Continue anyway ?' with:box fileName) withCRs) |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
1982 |
ifFalse:[^ '']. |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
1983 |
]. |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
1984 |
]. |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
1985 |
versionSymbol == #mustBeOld ifTrue:[ |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
1986 |
name asFilename exists ifFalse:[^ '']. |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
1987 |
]. |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
1988 |
versionSymbol == #old ifTrue:[ |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
1989 |
"/ file may not exist |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
1990 |
name asFilename exists ifFalse:[ |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
1991 |
(self confirm:(self classResources string:'''%1'' does not exist yet.\\Continue anyway ?' with:box fileName) withCRs) |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
1992 |
ifFalse:[^ '']. |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
1993 |
]. |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
1994 |
]. |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
1995 |
FileSelectionBox lastFileSelectionDirectory:box directory. |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
1996 |
box destroy. |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
1997 |
^ name |
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
1998 |
]. |
100 | 1999 |
box showAtPointer. |
2000 |
box action:nil. |
|
719
574be1981be0
destroy boxes from standard dialogs
Claus Gittinger <cg@exept.de>
parents:
718
diff
changeset
|
2001 |
box destroy. |
100 | 2002 |
^ failBlock value |
2003 |
||
2004 |
" |
|
549
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2005 |
Dialog |
1575
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2006 |
requestFileName:'enter a fileName:' |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2007 |
default:'' |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2008 |
version:nil |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2009 |
ifFail:['none'] |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2010 |
pattern:'*.conf' |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2011 |
fromDirectory:'/etc' |
549
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2012 |
" |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2013 |
" |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2014 |
Dialog |
1575
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2015 |
requestFileName:'enter a fileName:' |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2016 |
default:'' |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2017 |
version:#old |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2018 |
ifFail:['none'] |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2019 |
pattern:'*.conf' |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2020 |
fromDirectory:'/etc' |
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2021 |
" |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2022 |
" |
549
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2023 |
Dialog |
1575
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2024 |
requestFileName:'enter a fileName:' |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2025 |
default:'' |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2026 |
version:#mustBeNew |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2027 |
ifFail:['none'] |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2028 |
pattern:'*.conf' |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2029 |
fromDirectory:'/etc' |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2030 |
" |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2031 |
|
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2032 |
"Created: / 21.2.1997 / 14:23:44 / stefan" |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2033 |
"Modified: / 21.2.1997 / 14:38:04 / stefan" |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2034 |
"Modified: / 16.6.1998 / 13:34:23 / cg" |
549
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2035 |
! |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2036 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2037 |
requestFileName:titleString ifFail:cancelBlock |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2038 |
"launch a Dialog, which allows user to enter a filename. |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2039 |
Return the pathname string consisting of the full pathname of the filename, |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2040 |
or the value from evaluating cancelBlock (if cancel was pressed)." |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2041 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2042 |
^ self |
1401 | 2043 |
requestFileName:titleString |
2044 |
default:'file.ext' |
|
2045 |
version:nil |
|
2046 |
ifFail:cancelBlock |
|
549
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2047 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2048 |
" |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2049 |
Dialog requestFileName:'enter a fileName:' ifFail:['foo'] |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2050 |
Dialog requestFileName:'enter a fileName:' ifFail:[nil] |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2051 |
" |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2052 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2053 |
"Modified: 19.4.1996 / 13:53:17 / cg" |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2054 |
"Created: 19.4.1996 / 13:56:28 / cg" |
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2055 |
! |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2056 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2057 |
requestNewFileName:titleString default:defaultName |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2058 |
"launch a Dialog, which allows user to enter a filename. |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2059 |
We expect a new files (i.e. nonexisting) name to be enterred, |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2060 |
and confirm if it already exists. |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2061 |
The box will not allow pressing 'ok' without an entered string. |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2062 |
Return the pathname string consisting of the full pathname of the filename, |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2063 |
or an empty string (if cancel was pressed)." |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2064 |
|
1736 | 2065 |
^ self |
2066 |
requestFileName:titleString |
|
2067 |
default:defaultName |
|
2068 |
version:#new |
|
2069 |
ifFail:'' |
|
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2070 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2071 |
" |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2072 |
Dialog requestNewFileName:'enter a fileName:' default:'' |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2073 |
" |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2074 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2075 |
"Modified: 27.1.1996 / 13:44:13 / cg" |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2076 |
! ! |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2077 |
|
846
75c5dc601522
added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents:
831
diff
changeset
|
2078 |
!DialogBox class methodsFor:'fill in the blank dialogs'! |
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2079 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2080 |
request:aString |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2081 |
"launch a Dialog, which allows user to enter something. |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2082 |
Return the entered string (may be empty string) |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2083 |
or the empty string (if cancel was pressed)" |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2084 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2085 |
^ self |
1401 | 2086 |
request:aString |
2087 |
displayAt:nil |
|
2088 |
centered:false |
|
2089 |
action:nil |
|
2090 |
initialAnswer:'' |
|
2091 |
onCancel:'' |
|
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2092 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2093 |
" |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2094 |
Dialog |
1401 | 2095 |
request:'enter a string:' |
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2096 |
" |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2097 |
|
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2098 |
"Modified: 29.5.1996 / 14:26:25 / cg" |
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2099 |
! |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2100 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2101 |
request:aString displayAt:aPoint centered:centered action:resultAction initialAnswer:initial |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2102 |
"launch a Dialog, which allows user to enter a string. |
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2103 |
If aPoint is nonNil, the box is shown there, optionally centered around |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2104 |
that point. |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2105 |
If it is nil, it is shown at the current pointer position or at the |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2106 |
screen center. |
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2107 |
Return the string or an empty string (if cancel was pressed)" |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2108 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2109 |
^ self |
1401 | 2110 |
request:aString |
2111 |
displayAt:aPoint |
|
2112 |
centered:centered |
|
2113 |
action:resultAction |
|
2114 |
initialAnswer:initial |
|
2115 |
onCancel:'' |
|
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2116 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2117 |
" |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2118 |
centered around 200@200: |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2119 |
|
1401 | 2120 |
Dialog |
2121 |
request:'enter a string:' |
|
2122 |
displayAt:200@200 |
|
2123 |
centered:true |
|
2124 |
action:[:result | result printNewline] |
|
2125 |
initialAnswer:'the default' |
|
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2126 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2127 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2128 |
origin at 200@200: |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2129 |
|
1401 | 2130 |
Dialog |
2131 |
request:'enter a string:' |
|
2132 |
displayAt:200@200 |
|
2133 |
centered:false |
|
2134 |
action:[:result | result printNewline] |
|
2135 |
initialAnswer:'the default' |
|
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2136 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2137 |
under mouse pointer: |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2138 |
|
1401 | 2139 |
Dialog |
2140 |
request:'enter a string:' |
|
2141 |
displayAt:nil |
|
2142 |
centered:false |
|
2143 |
action:[:result | result printNewline] |
|
2144 |
initialAnswer:'the default' |
|
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2145 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2146 |
centered on the screen: |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2147 |
|
1401 | 2148 |
Dialog |
2149 |
request:'enter a string:' |
|
2150 |
displayAt:nil |
|
2151 |
centered:true |
|
2152 |
action:[:result | result printNewline] |
|
2153 |
initialAnswer:'the default' |
|
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2154 |
" |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2155 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2156 |
"Created: 7.12.1995 / 23:14:10 / cg" |
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2157 |
"Modified: 29.5.1996 / 14:19:36 / cg" |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2158 |
! |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2159 |
|
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2160 |
request:aString displayAt:aPoint centered:centered action:resultAction initialAnswer:initial okLabel:okLabel cancelLabel:cancelLabel onCancel:cancelValue |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2161 |
"launch a Dialog, which allows user to enter a string. |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2162 |
If aPoint is nonNil, the box is shown there, optionally centered around it. |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2163 |
If it is nil, it is shown at the current pointer position or at the |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2164 |
screen center (if centered is true). |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2165 |
The ok-button is labelled okLabel (or the default, ifNil), |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2166 |
the cancel-button is labelled cancelLabel (or the default, ifNil). |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2167 |
Return the string or the value of cancelValue (if cancel was pressed)" |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2168 |
|
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2169 |
^ self |
1401 | 2170 |
request:aString |
2171 |
displayAt:aPoint |
|
2172 |
centered:centered |
|
2173 |
action:resultAction |
|
2174 |
initialAnswer:initial |
|
2175 |
okLabel:okLabel |
|
2176 |
cancelLabel:cancelLabel |
|
2177 |
title:nil |
|
2178 |
onCancel:cancelValue |
|
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2179 |
|
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2180 |
" |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2181 |
at topLeft (centering is suppressed, to make the box fully visible) |
1401 | 2182 |
Dialog |
2183 |
request:'enter a string:' |
|
2184 |
displayAt:0@0 |
|
2185 |
centered:true |
|
2186 |
action:[:result | result printNewline] |
|
2187 |
initialAnswer:'the default' |
|
2188 |
okLabel:'yes' |
|
2189 |
cancelLabel:'no' |
|
2190 |
onCancel:#foo |
|
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2191 |
|
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2192 |
centered around 200@200: |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2193 |
|
1401 | 2194 |
Dialog |
2195 |
request:'enter a string:' |
|
2196 |
displayAt:200@200 |
|
2197 |
centered:true |
|
2198 |
action:[:result | result printNewline] |
|
2199 |
initialAnswer:'the default' |
|
2200 |
okLabel:'yes' |
|
2201 |
cancelLabel:'no' |
|
2202 |
onCancel:#foo |
|
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2203 |
|
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2204 |
topLeft of box at 200@200: |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2205 |
|
1401 | 2206 |
Dialog |
2207 |
request:'enter a string:' |
|
2208 |
displayAt:200@200 |
|
2209 |
centered:false |
|
2210 |
action:[:result | result printNewline] |
|
2211 |
initialAnswer:'the default' |
|
2212 |
okLabel:'yes' |
|
2213 |
cancelLabel:'no' |
|
2214 |
onCancel:#foo |
|
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2215 |
|
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2216 |
under mouse pointer: |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2217 |
|
1401 | 2218 |
Dialog |
2219 |
request:'enter a string:' |
|
2220 |
displayAt:nil |
|
2221 |
centered:false |
|
2222 |
action:[:result | result printNewline] |
|
2223 |
initialAnswer:'the default' |
|
2224 |
okLabel:'yes' |
|
2225 |
cancelLabel:'no' |
|
2226 |
onCancel:#foo |
|
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2227 |
|
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2228 |
centered on the screen: |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2229 |
|
1401 | 2230 |
Dialog |
2231 |
request:'enter a string:' |
|
2232 |
displayAt:nil |
|
2233 |
centered:true |
|
2234 |
action:[:result | result printNewline] |
|
2235 |
initialAnswer:'the default' |
|
2236 |
okLabel:'yes' |
|
2237 |
cancelLabel:'no' |
|
2238 |
onCancel:#foo |
|
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2239 |
" |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2240 |
|
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2241 |
"Created: 7.12.1995 / 23:14:10 / cg" |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2242 |
"Modified: 29.5.1996 / 14:35:45 / cg" |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2243 |
! |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2244 |
|
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2245 |
request:aString displayAt:aPoint centered:centered action:resultAction initialAnswer:initial okLabel:okLabel cancelLabel:cancelLabel title:titleString onCancel:cancelValue |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2246 |
"launch a Dialog, which allows user to enter a string. |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2247 |
The dialogs window is titled titleString, or the default (if nil). |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2248 |
If aPoint is nonNil, the box is shown there, optionally centered around it. |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2249 |
If it is nil, it is shown at the current pointer position or at the |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2250 |
screen center (if centered is true). |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2251 |
The ok-button is labelled okLabel (or the default, ifNil), |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2252 |
the cancel-button is labelled cancelLabel (or the default, ifNil). |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2253 |
Return the string or the value of cancelValue (if cancel was pressed)" |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2254 |
|
1705
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2255 |
^ self |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2256 |
request:aString |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2257 |
displayAt:aPoint |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2258 |
centered:centered |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2259 |
action:resultAction |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2260 |
initialAnswer:initial |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2261 |
okLabel:okLabel |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2262 |
cancelLabel:cancelLabel |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2263 |
title:titleString |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2264 |
onCancel:cancelValue |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2265 |
list:nil |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2266 |
|
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2267 |
! |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2268 |
|
2080
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
2269 |
request:aString displayAt:aPoint centered:centered action:resultAction |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
2270 |
initialAnswer:initial okLabel:okLabel cancelLabel:cancelLabel title:titleString |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
2271 |
onCancel:cancelValue list:listToSelectFrom |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
2272 |
"launch a Dialog, which allows user to enter a string. |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
2273 |
The dialogs window is titled titleString, or the default (if nil). |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
2274 |
If aPoint is nonNil, the box is shown there, optionally centered around it. |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
2275 |
If it is nil, it is shown at the current pointer position or at the |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
2276 |
screen center (if centered is true). |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
2277 |
The ok-button is labelled okLabel (or the default, ifNil), |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
2278 |
the cancel-button is labelled cancelLabel (or the default, ifNil). |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
2279 |
Return the string or the value of cancelValue (if cancel was pressed)" |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
2280 |
|
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
2281 |
^ self |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
2282 |
request:aString |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
2283 |
displayAt:aPoint |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
2284 |
centered:centered |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
2285 |
action:resultAction |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
2286 |
initialAnswer:initial |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
2287 |
okLabel:okLabel |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
2288 |
cancelLabel:cancelLabel |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
2289 |
title:titleString |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
2290 |
onCancel:cancelValue |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
2291 |
list:listToSelectFrom |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
2292 |
initialSelection:nil |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
2293 |
|
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
2294 |
" |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
2295 |
centered around 200@200: |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
2296 |
|
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
2297 |
Dialog |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
2298 |
request:'enter a string:' |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
2299 |
displayAt:200@200 |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
2300 |
centered:true |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
2301 |
action:[:result | result printNewline] |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
2302 |
initialAnswer:'the default' |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
2303 |
okLabel:'yes' |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
2304 |
cancelLabel:'no' |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
2305 |
title:'foo' |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
2306 |
onCancel:#foo |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
2307 |
|
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
2308 |
under mouse pointer: |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
2309 |
|
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
2310 |
Dialog |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
2311 |
request:'enter a string:' |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
2312 |
displayAt:nil |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
2313 |
centered:false |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
2314 |
action:[:result | result printNewline] |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
2315 |
initialAnswer:'the default' |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
2316 |
okLabel:'yes' |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
2317 |
cancelLabel:'no' |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
2318 |
title:'foo' |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
2319 |
onCancel:#foo |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
2320 |
|
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
2321 |
centered on the screen: |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
2322 |
|
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
2323 |
Dialog |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
2324 |
request:'enter a string:' |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
2325 |
displayAt:nil |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
2326 |
centered:true |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
2327 |
action:[:result | result printNewline] |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
2328 |
initialAnswer:'the default' |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
2329 |
okLabel:'yes' |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
2330 |
cancelLabel:'no' |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
2331 |
title:'foo' |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
2332 |
onCancel:#foo |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
2333 |
|
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
2334 |
with a list: |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
2335 |
|
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
2336 |
Dialog |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
2337 |
request:'enter a string:' |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
2338 |
displayAt:nil |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
2339 |
centered:true |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
2340 |
action:[:result | result printNewline] |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
2341 |
initialAnswer:'the default' |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
2342 |
okLabel:'yes' |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
2343 |
cancelLabel:'no' |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
2344 |
title:'foo' |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
2345 |
onCancel:#foo |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
2346 |
list:#(foo bar baz) |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
2347 |
" |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
2348 |
|
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
2349 |
"Created: / 29.5.1996 / 14:35:04 / cg" |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
2350 |
"Modified: / 5.5.1999 / 10:50:22 / cg" |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
2351 |
! |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
2352 |
|
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
2353 |
request:aString displayAt:aPoint centered:centered action:resultAction |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
2354 |
initialAnswer:initial okLabel:okLabel cancelLabel:cancelLabel title:titleString |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
2355 |
onCancel:cancelValue list:listToSelectFrom initialSelection:anInterval |
1705
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2356 |
"launch a Dialog, which allows user to enter a string. |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2357 |
The dialogs window is titled titleString, or the default (if nil). |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2358 |
If aPoint is nonNil, the box is shown there, optionally centered around it. |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2359 |
If it is nil, it is shown at the current pointer position or at the |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2360 |
screen center (if centered is true). |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2361 |
The ok-button is labelled okLabel (or the default, ifNil), |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2362 |
the cancel-button is labelled cancelLabel (or the default, ifNil). |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2363 |
Return the string or the value of cancelValue (if cancel was pressed)" |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2364 |
|
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2365 |
|box| |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2366 |
|
1705
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2367 |
listToSelectFrom isNil ifTrue:[ |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2368 |
box := EnterBox title:aString. |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2369 |
] ifFalse:[ |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2370 |
box := EnterBoxWithList title:aString. |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2371 |
box list:listToSelectFrom. |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2372 |
]. |
1401 | 2373 |
box initialText:initial printString. |
2080
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
2374 |
anInterval notNil ifTrue:[ |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
2375 |
box selectFrom:anInterval start to:anInterval stop. |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
2376 |
]. |
719
574be1981be0
destroy boxes from standard dialogs
Claus Gittinger <cg@exept.de>
parents:
718
diff
changeset
|
2377 |
box abortAction:[:val | box destroy. ^ cancelValue value]. |
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2378 |
okLabel notNil ifTrue:[ |
1705
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2379 |
box okText:okLabel. |
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2380 |
]. |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2381 |
cancelLabel notNil ifTrue:[ |
1705
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2382 |
box abortText:cancelLabel |
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2383 |
]. |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2384 |
resultAction isNil ifTrue:[ |
1705
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2385 |
box action:[:val | box destroy. ^ val] |
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2386 |
] ifFalse:[ |
1705
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2387 |
box action:[:val | box destroy. ^ resultAction value:val] |
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2388 |
]. |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2389 |
titleString notNil ifTrue:[ |
1705
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2390 |
box label:titleString |
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2391 |
]. |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2392 |
|
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2393 |
aPoint notNil ifTrue:[ |
1705
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2394 |
box showAt:aPoint center:centered |
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2395 |
] ifFalse:[ |
1705
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2396 |
centered ifTrue:[ |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2397 |
box showAtCenter |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2398 |
] ifFalse:[ |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2399 |
box showAtPointer |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2400 |
] |
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2401 |
]. |
719
574be1981be0
destroy boxes from standard dialogs
Claus Gittinger <cg@exept.de>
parents:
718
diff
changeset
|
2402 |
box destroy. |
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2403 |
^ cancelValue value. |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2404 |
|
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2405 |
" |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2406 |
centered around 200@200: |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2407 |
|
1705
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2408 |
Dialog |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2409 |
request:'enter a string:' |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2410 |
displayAt:200@200 |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2411 |
centered:true |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2412 |
action:[:result | result printNewline] |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2413 |
initialAnswer:'the default' |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2414 |
okLabel:'yes' |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2415 |
cancelLabel:'no' |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2416 |
title:'foo' |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2417 |
onCancel:#foo |
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2418 |
|
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2419 |
under mouse pointer: |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2420 |
|
1705
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2421 |
Dialog |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2422 |
request:'enter a string:' |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2423 |
displayAt:nil |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2424 |
centered:false |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2425 |
action:[:result | result printNewline] |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2426 |
initialAnswer:'the default' |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2427 |
okLabel:'yes' |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2428 |
cancelLabel:'no' |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2429 |
title:'foo' |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2430 |
onCancel:#foo |
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2431 |
|
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2432 |
centered on the screen: |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2433 |
|
1705
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2434 |
Dialog |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2435 |
request:'enter a string:' |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2436 |
displayAt:nil |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2437 |
centered:true |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2438 |
action:[:result | result printNewline] |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2439 |
initialAnswer:'the default' |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2440 |
okLabel:'yes' |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2441 |
cancelLabel:'no' |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2442 |
title:'foo' |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2443 |
onCancel:#foo |
1898
fe4300f57e1a
convenient entry: #request:initialAnswer:list
Claus Gittinger <cg@exept.de>
parents:
1877
diff
changeset
|
2444 |
|
fe4300f57e1a
convenient entry: #request:initialAnswer:list
Claus Gittinger <cg@exept.de>
parents:
1877
diff
changeset
|
2445 |
with a list: |
fe4300f57e1a
convenient entry: #request:initialAnswer:list
Claus Gittinger <cg@exept.de>
parents:
1877
diff
changeset
|
2446 |
|
fe4300f57e1a
convenient entry: #request:initialAnswer:list
Claus Gittinger <cg@exept.de>
parents:
1877
diff
changeset
|
2447 |
Dialog |
fe4300f57e1a
convenient entry: #request:initialAnswer:list
Claus Gittinger <cg@exept.de>
parents:
1877
diff
changeset
|
2448 |
request:'enter a string:' |
fe4300f57e1a
convenient entry: #request:initialAnswer:list
Claus Gittinger <cg@exept.de>
parents:
1877
diff
changeset
|
2449 |
displayAt:nil |
fe4300f57e1a
convenient entry: #request:initialAnswer:list
Claus Gittinger <cg@exept.de>
parents:
1877
diff
changeset
|
2450 |
centered:true |
fe4300f57e1a
convenient entry: #request:initialAnswer:list
Claus Gittinger <cg@exept.de>
parents:
1877
diff
changeset
|
2451 |
action:[:result | result printNewline] |
fe4300f57e1a
convenient entry: #request:initialAnswer:list
Claus Gittinger <cg@exept.de>
parents:
1877
diff
changeset
|
2452 |
initialAnswer:'the default' |
fe4300f57e1a
convenient entry: #request:initialAnswer:list
Claus Gittinger <cg@exept.de>
parents:
1877
diff
changeset
|
2453 |
okLabel:'yes' |
fe4300f57e1a
convenient entry: #request:initialAnswer:list
Claus Gittinger <cg@exept.de>
parents:
1877
diff
changeset
|
2454 |
cancelLabel:'no' |
fe4300f57e1a
convenient entry: #request:initialAnswer:list
Claus Gittinger <cg@exept.de>
parents:
1877
diff
changeset
|
2455 |
title:'foo' |
fe4300f57e1a
convenient entry: #request:initialAnswer:list
Claus Gittinger <cg@exept.de>
parents:
1877
diff
changeset
|
2456 |
onCancel:#foo |
fe4300f57e1a
convenient entry: #request:initialAnswer:list
Claus Gittinger <cg@exept.de>
parents:
1877
diff
changeset
|
2457 |
list:#(foo bar baz) |
fe4300f57e1a
convenient entry: #request:initialAnswer:list
Claus Gittinger <cg@exept.de>
parents:
1877
diff
changeset
|
2458 |
" |
fe4300f57e1a
convenient entry: #request:initialAnswer:list
Claus Gittinger <cg@exept.de>
parents:
1877
diff
changeset
|
2459 |
|
fe4300f57e1a
convenient entry: #request:initialAnswer:list
Claus Gittinger <cg@exept.de>
parents:
1877
diff
changeset
|
2460 |
"Created: / 29.5.1996 / 14:35:04 / cg" |
fe4300f57e1a
convenient entry: #request:initialAnswer:list
Claus Gittinger <cg@exept.de>
parents:
1877
diff
changeset
|
2461 |
"Modified: / 5.5.1999 / 10:50:22 / cg" |
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2462 |
! |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2463 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2464 |
request:aString displayAt:aPoint centered:centered action:resultAction initialAnswer:initial onCancel:cancelValue |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2465 |
"launch a Dialog, which allows user to enter a string. |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2466 |
If aPoint is nonNil, the box is shown there, optionally centered. |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2467 |
If it is nil, it is shown at the current pointer position or at the screen center. |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2468 |
Return the string or the value of cancelValue (if cancel was pressed)" |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2469 |
|
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2470 |
^ self |
1401 | 2471 |
request:aString |
2472 |
displayAt:aPoint |
|
2473 |
centered:centered |
|
2474 |
action:resultAction |
|
2475 |
initialAnswer:initial |
|
2476 |
okLabel:nil |
|
2477 |
cancelLabel:nil |
|
2478 |
onCancel:cancelValue |
|
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2479 |
|
100 | 2480 |
" |
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2481 |
at topLeft (centering is suppressed, to make the box fully visible) |
1401 | 2482 |
Dialog |
2483 |
request:'enter a string:' |
|
2484 |
displayAt:0@0 |
|
2485 |
centered:true |
|
2486 |
action:[:result | result printNewline] |
|
2487 |
initialAnswer:'the default' |
|
2488 |
onCancel:#foo |
|
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2489 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2490 |
centered around 200@200: |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2491 |
|
1401 | 2492 |
Dialog |
2493 |
request:'enter a string:' |
|
2494 |
displayAt:200@200 |
|
2495 |
centered:true |
|
2496 |
action:[:result | result printNewline] |
|
2497 |
initialAnswer:'the default' |
|
2498 |
onCancel:#foo |
|
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2499 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2500 |
topLeft of box at 200@200: |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2501 |
|
1401 | 2502 |
Dialog |
2503 |
request:'enter a string:' |
|
2504 |
displayAt:200@200 |
|
2505 |
centered:false |
|
2506 |
action:[:result | result printNewline] |
|
2507 |
initialAnswer:'the default' |
|
2508 |
onCancel:#foo |
|
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2509 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2510 |
under mouse pointer: |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2511 |
|
1401 | 2512 |
Dialog |
2513 |
request:'enter a string:' |
|
2514 |
displayAt:nil |
|
2515 |
centered:false |
|
2516 |
action:[:result | result printNewline] |
|
2517 |
initialAnswer:'the default' |
|
2518 |
onCancel:#foo |
|
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2519 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2520 |
centered on the screen: |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2521 |
|
1401 | 2522 |
Dialog |
2523 |
request:'enter a string:' |
|
2524 |
displayAt:nil |
|
2525 |
centered:true |
|
2526 |
action:[:result | result printNewline] |
|
2527 |
initialAnswer:'the default' |
|
2528 |
onCancel:#foo |
|
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2529 |
" |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2530 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2531 |
"Created: 7.12.1995 / 23:14:10 / cg" |
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2532 |
"Modified: 29.5.1996 / 14:24:39 / cg" |
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2533 |
! |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2534 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2535 |
request:aString displayAt:aPoint initialAnswer:initial |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2536 |
"launch a Dialog, which allows user to enter something. |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2537 |
The boxes topLeft is placed at aPoint, or under the mouse pointer (if aPoint is nil). |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2538 |
Return the entered string (may be empty string) or nil (if cancel was pressed)" |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2539 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2540 |
^ self |
1401 | 2541 |
request:aString |
2542 |
displayAt:aPoint |
|
2543 |
centered:false |
|
2544 |
action:nil |
|
2545 |
initialAnswer:initial |
|
2546 |
onCancel:'' |
|
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2547 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2548 |
" |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2549 |
Dialog |
1401 | 2550 |
request:'enter a string:' |
2551 |
displayAt:(250 @ 250) |
|
2552 |
initialAnswer:'the default' |
|
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2553 |
" |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2554 |
|
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2555 |
"Modified: 29.5.1996 / 14:29:51 / cg" |
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2556 |
! |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2557 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2558 |
request:aString initialAnswer:initial |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2559 |
"launch a Dialog, which allows user to enter something. |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2560 |
Return the entered string (may be empty string) or nil (if cancel was pressed)" |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2561 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2562 |
^ self |
1401 | 2563 |
request:aString |
2564 |
displayAt:nil |
|
2565 |
centered:false |
|
2566 |
action:nil |
|
2567 |
initialAnswer:initial |
|
2568 |
onCancel:'' |
|
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2569 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2570 |
" |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2571 |
Dialog |
1401 | 2572 |
request:'enter a string:' |
2573 |
initialAnswer:'the default' |
|
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2574 |
" |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2575 |
|
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2576 |
"Modified: 29.5.1996 / 14:30:05 / cg" |
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2577 |
! |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2578 |
|
2080
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
2579 |
request:aString initialAnswer:initial initialSelection:anInterval |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
2580 |
"launch a Dialog, which allows user to enter something. |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
2581 |
Return the entered string (may be empty string) or nil (if cancel was pressed)" |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
2582 |
|
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
2583 |
^ self |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
2584 |
request:aString |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
2585 |
displayAt:nil |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
2586 |
centered:false |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
2587 |
action:nil |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
2588 |
initialAnswer:initial |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
2589 |
okLabel:nil |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
2590 |
cancelLabel:nil |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
2591 |
title:nil |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
2592 |
onCancel:'' |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
2593 |
list:nil |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
2594 |
initialSelection:anInterval |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
2595 |
|
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
2596 |
" |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
2597 |
Dialog |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
2598 |
request:'enter a string:' |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
2599 |
initialAnswer:'the default' |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
2600 |
initialSelection:(1 to:3) |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
2601 |
" |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
2602 |
|
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
2603 |
"Modified: 29.5.1996 / 14:30:05 / cg" |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
2604 |
! |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
2605 |
|
1898
fe4300f57e1a
convenient entry: #request:initialAnswer:list
Claus Gittinger <cg@exept.de>
parents:
1877
diff
changeset
|
2606 |
request:aString initialAnswer:initial list:aList |
fe4300f57e1a
convenient entry: #request:initialAnswer:list
Claus Gittinger <cg@exept.de>
parents:
1877
diff
changeset
|
2607 |
"launch a Dialog, which allows user to enter something, |
fe4300f57e1a
convenient entry: #request:initialAnswer:list
Claus Gittinger <cg@exept.de>
parents:
1877
diff
changeset
|
2608 |
or select from a list of values. |
fe4300f57e1a
convenient entry: #request:initialAnswer:list
Claus Gittinger <cg@exept.de>
parents:
1877
diff
changeset
|
2609 |
Return the entered string (may be empty string) or nil (if cancel was pressed)" |
fe4300f57e1a
convenient entry: #request:initialAnswer:list
Claus Gittinger <cg@exept.de>
parents:
1877
diff
changeset
|
2610 |
|
fe4300f57e1a
convenient entry: #request:initialAnswer:list
Claus Gittinger <cg@exept.de>
parents:
1877
diff
changeset
|
2611 |
^ self |
fe4300f57e1a
convenient entry: #request:initialAnswer:list
Claus Gittinger <cg@exept.de>
parents:
1877
diff
changeset
|
2612 |
request:aString |
fe4300f57e1a
convenient entry: #request:initialAnswer:list
Claus Gittinger <cg@exept.de>
parents:
1877
diff
changeset
|
2613 |
displayAt:nil |
fe4300f57e1a
convenient entry: #request:initialAnswer:list
Claus Gittinger <cg@exept.de>
parents:
1877
diff
changeset
|
2614 |
centered:false |
fe4300f57e1a
convenient entry: #request:initialAnswer:list
Claus Gittinger <cg@exept.de>
parents:
1877
diff
changeset
|
2615 |
action:nil |
fe4300f57e1a
convenient entry: #request:initialAnswer:list
Claus Gittinger <cg@exept.de>
parents:
1877
diff
changeset
|
2616 |
initialAnswer:initial |
fe4300f57e1a
convenient entry: #request:initialAnswer:list
Claus Gittinger <cg@exept.de>
parents:
1877
diff
changeset
|
2617 |
okLabel:nil |
fe4300f57e1a
convenient entry: #request:initialAnswer:list
Claus Gittinger <cg@exept.de>
parents:
1877
diff
changeset
|
2618 |
cancelLabel:nil |
fe4300f57e1a
convenient entry: #request:initialAnswer:list
Claus Gittinger <cg@exept.de>
parents:
1877
diff
changeset
|
2619 |
title:nil |
fe4300f57e1a
convenient entry: #request:initialAnswer:list
Claus Gittinger <cg@exept.de>
parents:
1877
diff
changeset
|
2620 |
onCancel:'' |
fe4300f57e1a
convenient entry: #request:initialAnswer:list
Claus Gittinger <cg@exept.de>
parents:
1877
diff
changeset
|
2621 |
list:aList |
fe4300f57e1a
convenient entry: #request:initialAnswer:list
Claus Gittinger <cg@exept.de>
parents:
1877
diff
changeset
|
2622 |
|
fe4300f57e1a
convenient entry: #request:initialAnswer:list
Claus Gittinger <cg@exept.de>
parents:
1877
diff
changeset
|
2623 |
" |
fe4300f57e1a
convenient entry: #request:initialAnswer:list
Claus Gittinger <cg@exept.de>
parents:
1877
diff
changeset
|
2624 |
Dialog |
fe4300f57e1a
convenient entry: #request:initialAnswer:list
Claus Gittinger <cg@exept.de>
parents:
1877
diff
changeset
|
2625 |
request:'enter a string:' |
fe4300f57e1a
convenient entry: #request:initialAnswer:list
Claus Gittinger <cg@exept.de>
parents:
1877
diff
changeset
|
2626 |
initialAnswer:'the default' |
fe4300f57e1a
convenient entry: #request:initialAnswer:list
Claus Gittinger <cg@exept.de>
parents:
1877
diff
changeset
|
2627 |
list:#('foo' 'bar' 'baz') |
fe4300f57e1a
convenient entry: #request:initialAnswer:list
Claus Gittinger <cg@exept.de>
parents:
1877
diff
changeset
|
2628 |
" |
2110 | 2629 |
" |
2630 |
Dialog |
|
2631 |
request:'enter a string:' |
|
2632 |
initialAnswer:'the default' |
|
2633 |
list:((1 to:30) collect:[:i | i printString]) |
|
2634 |
" |
|
1898
fe4300f57e1a
convenient entry: #request:initialAnswer:list
Claus Gittinger <cg@exept.de>
parents:
1877
diff
changeset
|
2635 |
|
fe4300f57e1a
convenient entry: #request:initialAnswer:list
Claus Gittinger <cg@exept.de>
parents:
1877
diff
changeset
|
2636 |
"Modified: / 5.5.1999 / 10:53:45 / cg" |
fe4300f57e1a
convenient entry: #request:initialAnswer:list
Claus Gittinger <cg@exept.de>
parents:
1877
diff
changeset
|
2637 |
! |
fe4300f57e1a
convenient entry: #request:initialAnswer:list
Claus Gittinger <cg@exept.de>
parents:
1877
diff
changeset
|
2638 |
|
718
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
2639 |
request:aString initialAnswer:initial okLabel:okLabel title:titleString onCancel:cancelAction |
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
2640 |
"launch a Dialog, which allows user to enter something. |
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
2641 |
Return the entered string (may be empty string) |
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
2642 |
or cancelValue (if cancel was pressed)" |
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
2643 |
|
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
2644 |
^ self |
1401 | 2645 |
request:aString |
2646 |
displayAt:nil |
|
2647 |
centered:false |
|
2648 |
action:nil |
|
2649 |
initialAnswer:initial |
|
2650 |
okLabel:okLabel |
|
2651 |
cancelLabel:nil |
|
2652 |
title:titleString |
|
2653 |
onCancel:cancelAction |
|
718
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
2654 |
|
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
2655 |
" |
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
2656 |
Dialog |
1401 | 2657 |
request:'enter a string:' |
2658 |
initialAnswer:'the default' |
|
2659 |
onCancel:['foooo'] |
|
718
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
2660 |
" |
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
2661 |
|
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
2662 |
"Modified: 29.5.1996 / 14:28:24 / cg" |
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
2663 |
"Created: 29.5.1996 / 14:59:57 / cg" |
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
2664 |
! |
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
2665 |
|
1705
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2666 |
request:aString initialAnswer:initial okLabel:okLabel title:titleString onCancel:cancelAction list:listOfChoices |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2667 |
"launch a Dialog, which allows user to enter something. |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2668 |
Return the entered string (may be empty string) |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2669 |
or cancelValue (if cancel was pressed)" |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2670 |
|
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2671 |
^ self |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2672 |
request:aString |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2673 |
displayAt:nil |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2674 |
centered:false |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2675 |
action:nil |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2676 |
initialAnswer:initial |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2677 |
okLabel:okLabel |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2678 |
cancelLabel:nil |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2679 |
title:titleString |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2680 |
onCancel:cancelAction |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2681 |
list:listOfChoices |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2682 |
|
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2683 |
" |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2684 |
Dialog |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2685 |
request:'enter a string:' |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2686 |
initialAnswer:'the default' |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2687 |
okLabel:'ok' |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2688 |
title:'demo' |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2689 |
onCancel:nil |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2690 |
list:#('foo' 'bar' 'baz') |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2691 |
" |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2692 |
|
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2693 |
"Modified: 29.5.1996 / 14:28:24 / cg" |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2694 |
"Created: 29.5.1996 / 14:59:57 / cg" |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2695 |
! |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2696 |
|
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2697 |
request:aString initialAnswer:initial onCancel:cancelAction |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2698 |
"launch a Dialog, which allows user to enter something. |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2699 |
Return the entered string (may be empty string) |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2700 |
or cancelValue (if cancel was pressed)" |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2701 |
|
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2702 |
^ self |
1401 | 2703 |
request:aString |
2704 |
displayAt:nil |
|
2705 |
centered:false |
|
2706 |
action:nil |
|
2707 |
initialAnswer:initial |
|
2708 |
onCancel:cancelAction |
|
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2709 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2710 |
" |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2711 |
Dialog |
1401 | 2712 |
request:'enter a string:' |
2713 |
initialAnswer:'the default' |
|
2714 |
onCancel:['foooo'] |
|
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2715 |
" |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2716 |
|
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2717 |
"Modified: 29.5.1996 / 14:28:24 / cg" |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2718 |
! |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2719 |
|
1705
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2720 |
request:aString list:listOfChoices |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2721 |
"launch a Dialog, which allows user to enter something, |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2722 |
but adds a list of choices for fast input. |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2723 |
Return the entered string (may be empty string) |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2724 |
or the empty string (if cancel was pressed)" |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2725 |
|
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2726 |
^ self |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2727 |
request:aString |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2728 |
displayAt:nil |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2729 |
centered:false |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2730 |
action:nil |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2731 |
initialAnswer:'' |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2732 |
okLabel:nil |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2733 |
cancelLabel:nil |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2734 |
title:nil |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2735 |
onCancel:nil |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2736 |
list:listOfChoices |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2737 |
|
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2738 |
" |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2739 |
Dialog |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2740 |
request:'enter a string:' |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2741 |
list:#('foo' 'bar' 'baz') |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2742 |
" |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2743 |
|
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2744 |
"Modified: 29.5.1996 / 14:26:25 / cg" |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2745 |
! |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2746 |
|
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2747 |
request:aString okLabel:okLabel |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2748 |
"launch a Dialog, which allows user to enter something. |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2749 |
The okButton is labelled as okLabel. |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2750 |
Return the entered string (may be empty string) |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2751 |
or the empty string (if cancel was pressed)" |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2752 |
|
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2753 |
^ self |
1401 | 2754 |
request:aString |
2755 |
displayAt:nil |
|
2756 |
centered:false |
|
2757 |
action:nil |
|
2758 |
initialAnswer:'' |
|
2759 |
okLabel:okLabel |
|
2760 |
cancelLabel:nil |
|
2761 |
onCancel:'' |
|
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2762 |
|
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2763 |
" |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2764 |
Dialog |
1401 | 2765 |
request:'enter a string:' |
2766 |
okLabel:'yes' |
|
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2767 |
" |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2768 |
|
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2769 |
"Modified: 29.5.1996 / 14:26:25 / cg" |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2770 |
"Created: 29.5.1996 / 14:31:10 / cg" |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2771 |
! |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2772 |
|
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2773 |
request:aString okLabel:okLabel onCancel:cancelValue |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2774 |
"launch a Dialog, which allows user to enter something. |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2775 |
The okButton is labelled as okLabel. |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2776 |
Return the entered string (may be empty string) |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2777 |
or the value from evaluating cancelValue (if cancel was pressed)" |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2778 |
|
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2779 |
^ self |
1401 | 2780 |
request:aString |
2781 |
displayAt:nil |
|
2782 |
centered:false |
|
2783 |
action:nil |
|
2784 |
initialAnswer:'' |
|
2785 |
okLabel:okLabel |
|
2786 |
cancelLabel:nil |
|
2787 |
onCancel:cancelValue |
|
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2788 |
|
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2789 |
" |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2790 |
Dialog |
1401 | 2791 |
request:'enter a string:' |
2792 |
okLabel:'yes' |
|
2793 |
onCancel:nil |
|
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2794 |
" |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2795 |
|
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2796 |
"Modified: 29.5.1996 / 14:32:00 / cg" |
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2797 |
! |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2798 |
|
718
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
2799 |
request:aString okLabel:okLabel title:titleString onCancel:cancelValue |
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
2800 |
"launch a Dialog, which allows user to enter something. |
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
2801 |
The okButton is labelled as okLabel. |
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
2802 |
Return the entered string (may be empty string) |
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
2803 |
or the value from evaluating cancelValue (if cancel was pressed)" |
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
2804 |
|
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
2805 |
^ self |
1401 | 2806 |
request:aString |
2807 |
displayAt:nil |
|
2808 |
centered:false |
|
2809 |
action:nil |
|
2810 |
initialAnswer:'' |
|
2811 |
okLabel:okLabel |
|
2812 |
cancelLabel:nil |
|
2813 |
title:titleString |
|
2814 |
onCancel:cancelValue |
|
718
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
2815 |
|
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
2816 |
" |
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
2817 |
Dialog |
1401 | 2818 |
request:'enter a string:' |
2819 |
okLabel:'yes' |
|
2820 |
title:'foo' |
|
2821 |
onCancel:nil |
|
718
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
2822 |
" |
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
2823 |
|
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
2824 |
"Modified: 29.5.1996 / 14:32:00 / cg" |
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
2825 |
"Created: 29.5.1996 / 14:57:02 / cg" |
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
2826 |
! |
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
2827 |
|
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2828 |
request:aString onCancel:cancelAction |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2829 |
"launch a Dialog, which allows user to enter something. |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2830 |
Return the entered string (may be empty string) |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2831 |
or the value of cancelAction (if cancel was pressed)." |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2832 |
|
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2833 |
^ self |
1401 | 2834 |
request:aString |
2835 |
displayAt:nil |
|
2836 |
centered:false |
|
2837 |
action:nil |
|
2838 |
initialAnswer:'' |
|
2839 |
onCancel:cancelAction |
|
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2840 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2841 |
" |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2842 |
Dialog |
1401 | 2843 |
request:'enter a string:' |
2844 |
onCancel:nil |
|
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2845 |
" |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2846 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2847 |
"Created: 27.1.1996 / 14:31:45 / cg" |
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2848 |
"Modified: 29.5.1996 / 14:28:59 / cg" |
100 | 2849 |
! |
2850 |
||
197 | 2851 |
requestPassword:aString |
2852 |
"launch a Dialog, which allows user to enter something invisibly. |
|
2853 |
Return the entered string (may be empty string) |
|
2854 |
or nil (if cancel was pressed)" |
|
100 | 2855 |
|
197 | 2856 |
^ EnterBox requestPassword:aString |
133 | 2857 |
|
2858 |
" |
|
2859 |
Dialog |
|
197 | 2860 |
requestPassword:'enter secret:' |
133 | 2861 |
" |
197 | 2862 |
|
2863 |
"Created: 17.11.1995 / 09:45:21 / cg" |
|
2014 | 2864 |
! |
2865 |
||
2866 |
requestText:title lines:numLines columns:numCols initialAnswer:initialText |
|
2867 |
"open a dialog asking for multiline text. |
|
2868 |
Return a stringCollection or nil if cancelled." |
|
2869 |
||
2870 |
|dialog textView| |
|
2871 |
||
2872 |
dialog := self new. |
|
2873 |
(dialog addTextLabel:(self classResources string:title)) adjust:#left. |
|
2874 |
textView := dialog addTextBoxOn:nil |
|
2875 |
class:EditTextView |
|
2876 |
withNumberOfLines:numLines |
|
2877 |
hScrollable:true |
|
2878 |
vScrollable:true. |
|
2879 |
dialog width:(textView preferredExtentForLines:numLines cols:numCols) x. |
|
2880 |
textView contents:initialText. |
|
2881 |
dialog addAbortAndOkButtons. |
|
2882 |
dialog okButton isReturnButton:false. |
|
2883 |
dialog makeTabable:textView. |
|
2884 |
dialog open. |
|
2885 |
dialog accepted ifTrue:[ |
|
2886 |
^ textView contents |
|
2887 |
]. |
|
2888 |
^ nil |
|
2889 |
||
2890 |
||
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2891 |
! ! |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2892 |
|
846
75c5dc601522
added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents:
831
diff
changeset
|
2893 |
!DialogBox class methodsFor:'multiple choice dialogs'! |
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2894 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2895 |
choose:aString fromList:list values:listValues buttons:buttonLabels values:buttonValues lines:maxLines cancel:cancelBlock |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2896 |
"launch a Dialog showing the message and list. |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2897 |
The user can select an item and click ok; in this case, the corresponding value |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2898 |
from listValues is returned (doubleclick works as well). |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2899 |
The list may be suppressed (if the list arg is nil). |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2900 |
Below the list, an optional row of buttons is shown, which can also be |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2901 |
clicked upon, and a corresponding value from buttonValues is returned. |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2902 |
If cancel is pressed, the value of cancelBlock is returned. |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2903 |
Pressing ok without a selection is treated like cancel." |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2904 |
|
2111 | 2905 |
^ self |
2906 |
choose:aString |
|
2907 |
fromList:list |
|
2908 |
values:listValues |
|
2909 |
buttons:buttonLabels |
|
2910 |
values:buttonValues |
|
2911 |
lines:maxLines |
|
2912 |
cancel:cancelBlock |
|
2913 |
multiple:false |
|
2914 |
||
2915 |
" |
|
2916 |
full example: |
|
2917 |
||
2918 |
Transcript showCR:( |
|
2919 |
Dialog |
|
2920 |
choose:'choose any' |
|
2921 |
fromList:#('one' 'two' 'three' 'four') |
|
2922 |
values:#(1 2 3 4) |
|
2923 |
buttons:#('five' 'six' 'seven') |
|
2924 |
values:#(5 6 7) |
|
2925 |
lines:10 |
|
2926 |
cancel:nil |
|
2927 |
) |
|
2928 |
||
2929 |
||
2930 |
no buttons: |
|
2931 |
||
2932 |
Transcript showCR:( |
|
2933 |
Dialog |
|
2934 |
choose:'choose any' |
|
2935 |
fromList:#('one' 'two' 'three' 'four') |
|
2936 |
values:#(1 2 3 4) |
|
2937 |
buttons:nil |
|
2938 |
values:nil |
|
2939 |
lines:4 |
|
2940 |
cancel:nil |
|
2941 |
) |
|
2942 |
||
2943 |
||
2944 |
no list (lines argument is ignored): |
|
2945 |
||
2946 |
Transcript showCR:( |
|
2947 |
Dialog |
|
2948 |
choose:'choose any' |
|
2949 |
fromList:nil |
|
2950 |
values:nil |
|
2951 |
buttons:#('one' 'two' 'three' 'four') |
|
2952 |
values:#(1 2 3 4) |
|
2953 |
lines:nil |
|
2954 |
cancel:nil |
|
2955 |
) |
|
2956 |
||
2957 |
||
2958 |
full including cancel value: |
|
2959 |
||
2960 |
Transcript showCR:( |
|
2961 |
Dialog |
|
2962 |
choose:'choose example' |
|
2963 |
fromList:#('one' 'two' 'three' 'four') |
|
2964 |
values:#(1 2 3 4) |
|
2965 |
buttons:#('five' 'six' 'seven') |
|
2966 |
values:#(5 6 7) |
|
2967 |
lines:4 |
|
2968 |
cancel:[Transcript flash. #aborted] |
|
2969 |
) |
|
2970 |
||
2971 |
||
2972 |
degenerated: |
|
2973 |
||
2974 |
Transcript showCR:( |
|
2975 |
Dialog |
|
2976 |
choose:'choose any' |
|
2977 |
fromList:nil |
|
2978 |
values:nil |
|
2979 |
buttons:nil |
|
2980 |
values:nil |
|
2981 |
lines:nil |
|
2982 |
cancel:nil |
|
2983 |
) |
|
2984 |
||
2985 |
||
2986 |
" |
|
2987 |
||
2988 |
"Modified: 29.5.1996 / 15:27:22 / cg" |
|
2989 |
! |
|
2990 |
||
2991 |
choose:aString fromList:list values:listValues buttons:buttonLabels values:buttonValues lines:maxLines cancel:cancelBlock multiple:multiple |
|
2992 |
"launch a Dialog showing the message and list. |
|
2993 |
The user can select an item and click ok; in this case, the corresponding value |
|
2994 |
from listValues is returned (doubleclick works as well). |
|
2995 |
The list may be suppressed (if the list arg is nil). |
|
2996 |
If a list is present, multiple controls if multiple selections are allowed. |
|
2997 |
Below the list, an optional row of buttons is shown, which can also be |
|
2998 |
clicked upon, and a corresponding value from buttonValues is returned. |
|
2999 |
If cancel is pressed, the value of cancelBlock is returned. |
|
3000 |
Pressing ok without a selection is treated like cancel." |
|
3001 |
||
3002 |
|box listView panel sel| |
|
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3003 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3004 |
box := Dialog new. |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3005 |
(box addTextLabel:aString) adjust:#left. |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3006 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3007 |
list notNil ifTrue:[ |
2111 | 3008 |
maxLines > list size ifTrue:[ |
3009 |
listView := ScrollableView for:SelectionInListView. |
|
3010 |
] ifFalse:[ |
|
3011 |
listView := SelectionInListView new. |
|
3012 |
listView level:-1. |
|
3013 |
]. |
|
3014 |
listView list:list. |
|
2116 | 3015 |
listView doubleClickAction:[:selectionIndex | |
2111 | 3016 |
|val| |
3017 |
||
2116 | 3018 |
multiple ifTrue:[ |
3019 |
val := selectionIndex collect:[:idx | listValues at:idx]. |
|
3020 |
] ifFalse:[ |
|
3021 |
val := listValues at:selectionIndex. |
|
3022 |
]. |
|
2111 | 3023 |
box destroy. |
3024 |
^ val |
|
3025 |
]. |
|
3026 |
listView multipleSelectOk:multiple. |
|
3027 |
box addComponent:listView indent:(ViewSpacing // 2) withHeight:(listView heightForLines:maxLines). |
|
3028 |
box makeTabable:listView. |
|
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3029 |
]. |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3030 |
|
2112 | 3031 |
buttonLabels size > 0 ifTrue:[ |
2111 | 3032 |
panel := HorizontalPanelView new. |
3033 |
panel horizontalLayout:#fitSpace. |
|
3034 |
buttonLabels keysAndValuesDo:[:index :label | |
|
3035 |
|b| |
|
3036 |
||
3037 |
b := Button label:label. |
|
3038 |
b action:[ |
|
3039 |
|val| |
|
3040 |
val := buttonValues at:index. |
|
3041 |
box destroy. |
|
3042 |
multiple ifTrue:[ |
|
3043 |
^ Array with:val |
|
3044 |
]. |
|
3045 |
^ val |
|
3046 |
]. |
|
3047 |
panel add:b. |
|
3048 |
box makeTabable:b. |
|
3049 |
]. |
|
3050 |
box addComponent:panel indent:0. "/ panel has its own idea of indenting |
|
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3051 |
]. |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3052 |
box addAbortButton. |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3053 |
list notNil ifTrue:[box addOkButton]. |
310
4bbc8deffc8c
allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents:
307
diff
changeset
|
3054 |
|
4bbc8deffc8c
allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents:
307
diff
changeset
|
3055 |
listView notNil ifTrue:[box stickAtBottomWithVariableHeight:listView]. |
4bbc8deffc8c
allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents:
307
diff
changeset
|
3056 |
panel notNil ifTrue:[box stickAtBottomWithFixHeight:panel]. |
4bbc8deffc8c
allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents:
307
diff
changeset
|
3057 |
|
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3058 |
box showAtPointer. |
2111 | 3059 |
|
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3060 |
box accepted ifTrue:[ |
2111 | 3061 |
(sel := listView selection) notNil ifTrue:[ |
3062 |
box destroy. |
|
3063 |
sel isInteger ifTrue:[ |
|
3064 |
^ listValues at:sel |
|
3065 |
] ifFalse:[ |
|
3066 |
^ sel collect:[:idx | listValues at:idx] |
|
3067 |
] |
|
3068 |
] |
|
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3069 |
]. |
2111 | 3070 |
box destroy. |
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3071 |
^ cancelBlock value |
197 | 3072 |
|
3073 |
" |
|
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3074 |
full example: |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3075 |
|
2111 | 3076 |
Transcript showCR:( |
3077 |
Dialog |
|
3078 |
choose:'choose any' |
|
3079 |
fromList:#('one' 'two' 'three' 'four') |
|
3080 |
values:#(1 2 3 4) |
|
3081 |
buttons:#('five' 'six' 'seven') |
|
3082 |
values:#(5 6 7) |
|
3083 |
lines:10 |
|
3084 |
cancel:nil |
|
3085 |
multiple:true |
|
3086 |
) |
|
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3087 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3088 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3089 |
no buttons: |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3090 |
|
2111 | 3091 |
Transcript showCR:( |
3092 |
Dialog |
|
3093 |
choose:'choose any' |
|
3094 |
fromList:#('one' 'two' 'three' 'four') |
|
3095 |
values:#(1 2 3 4) |
|
3096 |
buttons:nil |
|
3097 |
values:nil |
|
3098 |
lines:4 |
|
3099 |
cancel:nil |
|
3100 |
multiple:true |
|
3101 |
) |
|
133 | 3102 |
" |
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3103 |
|
2116 | 3104 |
"Modified: / 3.2.2000 / 23:41:09 / cg" |
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3105 |
! |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3106 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3107 |
choose:aString fromList:list values:listValues lines:maxLines cancel:cancelBlock |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3108 |
"launch a Dialog showing the message and list. |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3109 |
The user can select an item and click ok; in this case, the corresponding value |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3110 |
from listValues is returned (doubleclick works as well). |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3111 |
If cancel is pressed, the value of cancelBlock is returned. |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3112 |
Pressing ok without a selection is treated like cancel." |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3113 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3114 |
^ self |
314
705185e7001d
no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents:
312
diff
changeset
|
3115 |
choose:aString |
705185e7001d
no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents:
312
diff
changeset
|
3116 |
fromList:list |
705185e7001d
no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents:
312
diff
changeset
|
3117 |
values:listValues |
705185e7001d
no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents:
312
diff
changeset
|
3118 |
buttons:nil |
705185e7001d
no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents:
312
diff
changeset
|
3119 |
values:nil |
705185e7001d
no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents:
312
diff
changeset
|
3120 |
lines:maxLines |
705185e7001d
no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents:
312
diff
changeset
|
3121 |
cancel:cancelBlock |
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3122 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3123 |
" |
655 | 3124 |
Transcript showCR:( |
314
705185e7001d
no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents:
312
diff
changeset
|
3125 |
Dialog |
705185e7001d
no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents:
312
diff
changeset
|
3126 |
choose:'choose any' |
705185e7001d
no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents:
312
diff
changeset
|
3127 |
fromList:#('one' 'two' 'three' 'four') |
705185e7001d
no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents:
312
diff
changeset
|
3128 |
values:#(1 2 3 4) |
705185e7001d
no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents:
312
diff
changeset
|
3129 |
lines:4 |
705185e7001d
no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents:
312
diff
changeset
|
3130 |
cancel:nil |
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3131 |
) |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3132 |
|
655 | 3133 |
Transcript showCR:( |
314
705185e7001d
no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents:
312
diff
changeset
|
3134 |
Dialog |
705185e7001d
no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents:
312
diff
changeset
|
3135 |
choose:'choose example' |
705185e7001d
no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents:
312
diff
changeset
|
3136 |
fromList:#('one' 'two' 'three' 'four') |
705185e7001d
no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents:
312
diff
changeset
|
3137 |
values:#(1 2 3 4) |
705185e7001d
no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents:
312
diff
changeset
|
3138 |
lines:4 |
705185e7001d
no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents:
312
diff
changeset
|
3139 |
cancel:[Transcript flash. #aborted] |
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3140 |
) |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3141 |
" |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3142 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3143 |
"Modified: 27.1.1996 / 14:17:07 / cg" |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3144 |
! |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3145 |
|
803 | 3146 |
choose:aString label:windowLabel labels:buttonLabels values:values default:default |
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3147 |
"launch a Dialog, which allows user to enter any of buttonLabels. |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3148 |
Returning a corresponding value from the values-array. |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3149 |
The default entries button is marked as a return button and entering |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3150 |
return will choose that value. |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3151 |
For a good userInterface style, we recommend this being the last |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3152 |
entry (to make the right-most button the default button)." |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3153 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3154 |
|box answer idx| |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3155 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3156 |
box := OptionBox title:aString numberOfOptions:buttonLabels size. |
803 | 3157 |
windowLabel notNil ifTrue:[ |
1401 | 3158 |
box label:windowLabel |
803 | 3159 |
]. |
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3160 |
box buttonTitles:(self classResources array:buttonLabels) |
1401 | 3161 |
actions:(values collect:[:val | [answer := val]]). |
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3162 |
answer := default. |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3163 |
box buttons last isReturnButton:false. |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3164 |
idx := values indexOf:default. |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3165 |
idx ~~ 0 ifTrue:[box defaultButtonIndex:idx]. |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3166 |
box showAtPointer. |
719
574be1981be0
destroy boxes from standard dialogs
Claus Gittinger <cg@exept.de>
parents:
718
diff
changeset
|
3167 |
box destroy. |
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3168 |
box actions:nil. |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3169 |
^ answer |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3170 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3171 |
"no good style (default button is not the rightmost one) |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3172 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3173 |
Dialog |
1401 | 3174 |
choose:'choose any' |
3175 |
labels:#('one' 'two' 'three' 'four') |
|
3176 |
values:#(1 2 3 4) |
|
3177 |
default:2 |
|
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3178 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3179 |
Dialog |
1401 | 3180 |
choose:'choose any' |
3181 |
labels:#('cancel' 'foo' 'bar' 'baz') |
|
3182 |
values:#(nil foo bar baz) |
|
3183 |
default:#baz |
|
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3184 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3185 |
Dialog |
1401 | 3186 |
choose:'choose any' |
3187 |
labels:#('one' 'two' 'three' 'four') |
|
3188 |
values:#(1 2 3 4) |
|
3189 |
default:nil |
|
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3190 |
" |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3191 |
|
719
574be1981be0
destroy boxes from standard dialogs
Claus Gittinger <cg@exept.de>
parents:
718
diff
changeset
|
3192 |
"Modified: 29.5.1996 / 15:27:32 / cg" |
803 | 3193 |
"Created: 22.7.1996 / 11:44:27 / cg" |
3194 |
! |
|
3195 |
||
3196 |
choose:aString labels:buttonLabels values:values default:default |
|
3197 |
"launch a Dialog, which allows user to enter any of buttonLabels. |
|
3198 |
Returning a corresponding value from the values-array. |
|
3199 |
The default entries button is marked as a return button and entering |
|
3200 |
return will choose that value. |
|
3201 |
For a good userInterface style, we recommend this being the last |
|
3202 |
entry (to make the right-most button the default button)." |
|
3203 |
||
3204 |
^ self |
|
1401 | 3205 |
choose:aString |
3206 |
label:nil |
|
3207 |
labels:buttonLabels |
|
3208 |
values:values |
|
3209 |
default:default |
|
803 | 3210 |
|
3211 |
||
3212 |
"no good style (default button is not the rightmost one) |
|
3213 |
||
3214 |
Dialog |
|
1401 | 3215 |
choose:'choose any' |
3216 |
labels:#('one' 'two' 'three' 'four') |
|
3217 |
values:#(1 2 3 4) |
|
3218 |
default:2 |
|
803 | 3219 |
|
3220 |
Dialog |
|
1401 | 3221 |
choose:'choose any' |
3222 |
labels:#('cancel' 'foo' 'bar' 'baz') |
|
3223 |
values:#(nil foo bar baz) |
|
3224 |
default:#baz |
|
803 | 3225 |
|
3226 |
Dialog |
|
1401 | 3227 |
choose:'choose any' |
3228 |
labels:#('one' 'two' 'three' 'four') |
|
3229 |
values:#(1 2 3 4) |
|
3230 |
default:nil |
|
803 | 3231 |
" |
3232 |
||
3233 |
"Modified: 22.7.1996 / 11:46:09 / cg" |
|
2111 | 3234 |
! |
3235 |
||
3236 |
chooseMultiple:aString fromList:list values:listValues buttons:buttonLabels values:buttonValues lines:maxLines cancel:cancelBlock |
|
3237 |
"launch a Dialog showing the message and list. |
|
3238 |
The user can select an item and click ok; in this case, the corresponding value |
|
3239 |
from listValues is returned (doubleclick works as well). |
|
3240 |
The list may be suppressed (if the list arg is nil). |
|
3241 |
Below the list, an optional row of buttons is shown, which can also be |
|
3242 |
clicked upon, and a corresponding value from buttonValues is returned. |
|
3243 |
If cancel is pressed, the value of cancelBlock is returned. |
|
3244 |
Pressing ok without a selection is treated like cancel." |
|
3245 |
||
3246 |
^ self |
|
3247 |
choose:aString |
|
3248 |
fromList:list |
|
3249 |
values:listValues |
|
3250 |
buttons:buttonLabels |
|
3251 |
values:buttonValues |
|
3252 |
lines:maxLines |
|
3253 |
cancel:cancelBlock |
|
3254 |
multiple:true |
|
3255 |
||
3256 |
" |
|
3257 |
full example: |
|
3258 |
||
3259 |
Transcript showCR:( |
|
3260 |
Dialog |
|
2112 | 3261 |
chooseMultiple:'choose selected' |
2111 | 3262 |
fromList:#('one' 'two' 'three' 'four') |
3263 |
values:#(1 2 3 4) |
|
3264 |
buttons:nil |
|
3265 |
values:nil |
|
3266 |
lines:10 |
|
3267 |
cancel:nil |
|
3268 |
) |
|
2112 | 3269 |
|
3270 |
Transcript showCR:( |
|
3271 |
Dialog |
|
3272 |
chooseMultiple:'choose selected' |
|
3273 |
fromList:#('one' 'two' 'three' 'four') |
|
3274 |
values:#(1 2 3 4) |
|
3275 |
buttons:#() |
|
3276 |
values:#() |
|
3277 |
lines:10 |
|
3278 |
cancel:nil |
|
3279 |
) |
|
2111 | 3280 |
" |
3281 |
||
3282 |
"Modified: 29.5.1996 / 15:27:22 / cg" |
|
100 | 3283 |
! ! |
3284 |
||
1573
63a7b74f45be
added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
1488
diff
changeset
|
3285 |
!DialogBox class methodsFor:'queries'! |
63a7b74f45be
added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
1488
diff
changeset
|
3286 |
|
63a7b74f45be
added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
1488
diff
changeset
|
3287 |
defaultParentWindow |
63a7b74f45be
added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
1488
diff
changeset
|
3288 |
"return a default parent (top-) window for the dialog. |
63a7b74f45be
added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
1488
diff
changeset
|
3289 |
Here, the currently active view is returned, if there |
63a7b74f45be
added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
1488
diff
changeset
|
3290 |
is one; otherwise, the first encountered topView is |
63a7b74f45be
added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
1488
diff
changeset
|
3291 |
returned." |
63a7b74f45be
added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
1488
diff
changeset
|
3292 |
|
63a7b74f45be
added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
1488
diff
changeset
|
3293 |
|activeGroup| |
63a7b74f45be
added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
1488
diff
changeset
|
3294 |
|
63a7b74f45be
added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
1488
diff
changeset
|
3295 |
activeGroup := WindowGroup activeGroup. |
63a7b74f45be
added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
1488
diff
changeset
|
3296 |
activeGroup isNil ifTrue:[ |
63a7b74f45be
added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
1488
diff
changeset
|
3297 |
"/ mhmh - looks like I am a background process ... |
63a7b74f45be
added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
1488
diff
changeset
|
3298 |
activeGroup := Transcript windowGroup. |
63a7b74f45be
added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
1488
diff
changeset
|
3299 |
activeGroup isNil ifTrue:[^ nil]. |
63a7b74f45be
added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
1488
diff
changeset
|
3300 |
]. |
63a7b74f45be
added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
1488
diff
changeset
|
3301 |
^ activeGroup topViews first. |
63a7b74f45be
added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
1488
diff
changeset
|
3302 |
|
63a7b74f45be
added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
1488
diff
changeset
|
3303 |
" |
63a7b74f45be
added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
1488
diff
changeset
|
3304 |
self defaultParentWindow |
63a7b74f45be
added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
1488
diff
changeset
|
3305 |
" |
63a7b74f45be
added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
1488
diff
changeset
|
3306 |
|
63a7b74f45be
added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
1488
diff
changeset
|
3307 |
"Modified: / 16.6.1998 / 12:36:15 / cg" |
63a7b74f45be
added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
1488
diff
changeset
|
3308 |
! ! |
63a7b74f45be
added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
1488
diff
changeset
|
3309 |
|
197 | 3310 |
!DialogBox methodsFor:'accessing-behavior'! |
3311 |
||
3312 |
abortAction:aBlock |
|
3313 |
"define the action to be performed when abort is pressed" |
|
3314 |
||
3315 |
abortAction := aBlock |
|
125 | 3316 |
! |
3317 |
||
280
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
3318 |
acceptCheck:aBlock |
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
3319 |
"if nonNil, the acceptCheck-block is evaluated when the dialog is |
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
3320 |
accepted (ok-button or Return-key). If it returns true, the box is closed, |
2106 | 3321 |
otherwise not. Of course, you may also use a valueHolder instead of a block |
3322 |
to provide the check value." |
|
280
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
3323 |
|
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
3324 |
acceptCheck := aBlock |
2106 | 3325 |
|
3326 |
"Modified: / 25.1.2000 / 20:56:04 / cg" |
|
280
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
3327 |
! |
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
3328 |
|
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
3329 |
acceptOnLeave:aBoolean |
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
3330 |
"define the behavior when the last input field is left via cursor keys. |
551
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
3331 |
The default is to accept & close the dialog (i.e. true)." |
280
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
3332 |
|
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
3333 |
acceptOnLeave := aBoolean. |
551
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
3334 |
|
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
3335 |
"Modified: 19.4.1996 / 17:05:12 / cg" |
280
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
3336 |
! |
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
3337 |
|
197 | 3338 |
acceptReturnAsOK:aBoolean |
3339 |
"turn on/off interpretation of return-key as ok. |
|
3340 |
Default is on" |
|
3341 |
||
3342 |
acceptReturnAsOK := aBoolean. |
|
3343 |
okButton notNil ifTrue:[ |
|
3344 |
okButton isReturnButton:aBoolean. |
|
3345 |
] |
|
3346 |
! |
|
3347 |
||
3348 |
action:aBlock |
|
3349 |
"set the action to be performed when user presses ok-button; |
|
3350 |
aBlock must be nil or a block. This method simply |
|
3351 |
reuses okAction: and has been added for a consistent action-setting |
|
3352 |
protocol." |
|
76 | 3353 |
|
197 | 3354 |
self okAction:aBlock |
3355 |
! |
|
3356 |
||
280
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
3357 |
focusOnField:anInputField |
1646 | 3358 |
"arrange for the argument to get the focus (initially)" |
3359 |
||
280
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
3360 |
inputFieldGroup makeActive:anInputField |
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
3361 |
|
1646 | 3362 |
"Modified: / 13.8.1998 / 21:23:17 / cg" |
280
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
3363 |
! |
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
3364 |
|
551
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
3365 |
focusToOKOnLeave:aBoolean |
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
3366 |
"define the behavior when the last input field is left via a return |
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
3367 |
or cursor key. |
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
3368 |
The default is to shift the focus to the OK button (i.e. true). |
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
3369 |
If turned off, the OK is immediately performed, i.e. |
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
3370 |
the dialog is accepted & closed." |
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
3371 |
|
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
3372 |
focusToOKOnLeave := aBoolean. |
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
3373 |
|
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
3374 |
"Modified: 19.4.1996 / 17:05:12 / cg" |
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
3375 |
"Created: 19.4.1996 / 17:13:36 / cg" |
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
3376 |
! |
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
3377 |
|
280
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
3378 |
hideOnAccept:aBoolean |
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
3379 |
"control if the dialog should close when accepted. |
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
3380 |
The default is true" |
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
3381 |
|
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
3382 |
hideOnAccept := aBoolean |
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
3383 |
! |
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
3384 |
|
593 | 3385 |
makeTabable:aComponentOrSubcomponent |
3386 |
"add a component (usually a subcomponent, of which the dialog |
|
3387 |
does not know) to the list of tabable ones (i.e. those, that can be |
|
3388 |
stepped through via FocusNext/FocusPrevious). |
|
3389 |
Toplevel tabable components are usually added with #addComponent:tabable:" |
|
3390 |
||
3391 |
tabableElements isNil ifTrue:[ |
|
1401 | 3392 |
tabableElements := OrderedCollection new |
593 | 3393 |
]. |
739
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
3394 |
(tabableElements includesIdentical:aComponentOrSubcomponent) ifFalse:[ |
1401 | 3395 |
tabableElements add:aComponentOrSubcomponent. |
3396 |
||
3397 |
(aComponentOrSubcomponent isInputField) ifTrue:[ |
|
3398 |
self addToInputFieldGroup:aComponentOrSubcomponent |
|
3399 |
]. |
|
593 | 3400 |
]. |
3401 |
||
739
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
3402 |
"Modified: 31.5.1996 / 21:22:13 / cg" |
593 | 3403 |
! |
3404 |
||
1843 | 3405 |
makeTabable:aComponentOrSubcomponent after:anotherComponent |
3406 |
"add a component (usually a subcomponent, of which the dialog |
|
3407 |
does not know) to the list of tabable ones (i.e. those, that can be |
|
3408 |
stepped through via FocusNext/FocusPrevious). |
|
3409 |
Toplevel tabable components are usually added with #addComponent:tabable:" |
|
3410 |
||
3411 |
tabableElements isNil ifTrue:[ |
|
3412 |
tabableElements := OrderedCollection new |
|
3413 |
]. |
|
3414 |
tabableElements removeIdentical:aComponentOrSubcomponent ifAbsent:nil. |
|
3415 |
||
3416 |
anotherComponent isNil ifTrue:[ |
|
3417 |
tabableElements addLast:aComponentOrSubcomponent |
|
3418 |
] ifFalse:[ |
|
3419 |
tabableElements add:aComponentOrSubcomponent after:anotherComponent. |
|
3420 |
]. |
|
3421 |
||
3422 |
(aComponentOrSubcomponent isInputField) ifTrue:[ |
|
3423 |
self addToInputFieldGroup:aComponentOrSubcomponent after:anotherComponent |
|
3424 |
]. |
|
3425 |
||
3426 |
"Modified: 18.10.1997 / 03:08:20 / cg" |
|
3427 |
! |
|
3428 |
||
593 | 3429 |
makeTabable:aComponentOrSubcomponent before:anotherComponent |
3430 |
"add a component (usually a subcomponent, of which the dialog |
|
3431 |
does not know) to the list of tabable ones (i.e. those, that can be |
|
3432 |
stepped through via FocusNext/FocusPrevious). |
|
3433 |
Toplevel tabable components are usually added with #addComponent:tabable:" |
|
3434 |
||
3435 |
tabableElements isNil ifTrue:[ |
|
1843 | 3436 |
tabableElements := OrderedCollection new |
593 | 3437 |
]. |
989
ca2cdf005359
use #removeIdentical: - its faster.
Claus Gittinger <cg@exept.de>
parents:
953
diff
changeset
|
3438 |
tabableElements removeIdentical:aComponentOrSubcomponent ifAbsent:nil. |
739
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
3439 |
|
593 | 3440 |
anotherComponent isNil ifTrue:[ |
1843 | 3441 |
tabableElements addFirst:aComponentOrSubcomponent |
593 | 3442 |
] ifFalse:[ |
1843 | 3443 |
tabableElements add:aComponentOrSubcomponent before:anotherComponent. |
593 | 3444 |
]. |
3445 |
||
3446 |
(aComponentOrSubcomponent isInputField) ifTrue:[ |
|
1843 | 3447 |
self addToInputFieldGroup:aComponentOrSubcomponent before:anotherComponent |
593 | 3448 |
]. |
3449 |
||
1355 | 3450 |
"Modified: 18.10.1997 / 03:08:20 / cg" |
3451 |
! |
|
3452 |
||
3453 |
makeUntabable:aComponentOrSubcomponent |
|
3454 |
(tabableElements includesIdentical:aComponentOrSubcomponent) ifFalse:[ |
|
1401 | 3455 |
tabableElements removeIdentical:aComponentOrSubcomponent. |
3456 |
||
3457 |
(aComponentOrSubcomponent isInputField) ifTrue:[ |
|
3458 |
self removeFromInputFieldGroup:aComponentOrSubcomponent |
|
3459 |
]. |
|
1355 | 3460 |
]. |
3461 |
||
3462 |
"Modified: 18.10.1997 / 02:50:05 / cg" |
|
593 | 3463 |
! |
3464 |
||
197 | 3465 |
okAction:aBlock |
3466 |
"define the action to be performed when ok is pressed" |
|
133 | 3467 |
|
197 | 3468 |
okAction := aBlock |
3469 |
! ! |
|
3470 |
||
3471 |
!DialogBox methodsFor:'accessing-components'! |
|
3472 |
||
3473 |
abortButton |
|
3474 |
"return the abortButton - this access is provided to allow |
|
3475 |
setting the buttons look (for example: colors or font)" |
|
3476 |
||
3477 |
^ abortButton |
|
76 | 3478 |
! |
3479 |
||
197 | 3480 |
okButton |
3481 |
"return the okButton - this access is provided to allow |
|
3482 |
setting the buttons look (for example: colors or font)" |
|
76 | 3483 |
|
197 | 3484 |
^ okButton |
3485 |
! ! |
|
155 | 3486 |
|
197 | 3487 |
!DialogBox methodsFor:'accessing-elements'! |
3488 |
||
3489 |
componentAt:name |
|
680 | 3490 |
"retrieve a component by name - to access it, it must have been |
950
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3491 |
named previously with #name:as:" |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3492 |
|
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3493 |
namedComponents isNil ifTrue:[^ nil]. |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3494 |
^ namedComponents at:name ifAbsent:nil |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3495 |
|
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3496 |
"Modified: 16.1.1997 / 11:40:50 / cg" |
76 | 3497 |
! |
3498 |
||
280
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
3499 |
inputFieldGroup |
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
3500 |
^ inputFieldGroup |
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
3501 |
! |
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
3502 |
|
197 | 3503 |
name:element as:name |
680 | 3504 |
"assign a name to a component. This can be done during construction, |
3505 |
to allow later access to the components (i.e. without a need to |
|
3506 |
remember them in some instVars)" |
|
3507 |
||
950
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3508 |
namedComponents isNil ifTrue:[ |
1401 | 3509 |
namedComponents := Dictionary new. |
197 | 3510 |
]. |
950
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3511 |
namedComponents at:name put:element |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3512 |
|
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3513 |
"Modified: 16.1.1997 / 11:41:03 / cg" |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3514 |
! ! |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3515 |
|
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3516 |
!DialogBox methodsFor:'accessing-look'! |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3517 |
|
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3518 |
abortText:aString |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3519 |
"define the label in the abort-button" |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3520 |
|
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3521 |
|oldSize| |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3522 |
|
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3523 |
aString ~= abortButton label ifTrue:[ |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3524 |
oldSize := abortButton extent. |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3525 |
abortButton label:aString. |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3526 |
abortButton resize. |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3527 |
abortButton extent ~= oldSize ifTrue:[ |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3528 |
shown ifTrue:[self resize] |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3529 |
] |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3530 |
] |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3531 |
! |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3532 |
|
1702 | 3533 |
hideButtons |
3534 |
"hides the buttonPanel (i.e. the ok and cancel buttons if any)" |
|
3535 |
||
3536 |
buttonPanel notNil ifTrue:[buttonPanel beInvisible] |
|
3537 |
! |
|
3538 |
||
950
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3539 |
okText:aString |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3540 |
"define the text in the ok-button" |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3541 |
|
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3542 |
|oldSize| |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3543 |
|
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3544 |
aString ~= okButton label ifTrue:[ |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3545 |
oldSize := okButton extent. |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3546 |
okButton label:aString. |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3547 |
okButton resize. |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3548 |
okButton extent ~= oldSize ifTrue:[ |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3549 |
shown ifTrue:[self resize] |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3550 |
] |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3551 |
] |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3552 |
! |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3553 |
|
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3554 |
okText:okString abortText:abortString |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3555 |
"set both texts displayed in the buttons" |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3556 |
|
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3557 |
(abortString ~= abortButton label |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3558 |
or:[okString ~= okButton label]) ifTrue:[ |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3559 |
okButton label:okString. |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3560 |
abortButton label:abortString. |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3561 |
okButton resize. |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3562 |
abortButton resize. |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3563 |
shown ifTrue:[self resize] |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3564 |
] |
197 | 3565 |
! ! |
3566 |
||
3567 |
!DialogBox methodsFor:'accessing-models'! |
|
76 | 3568 |
|
197 | 3569 |
accept |
3570 |
"return the valueHolder holding true when the box |
|
3571 |
is accepted, false if closed via the windowManager or |
|
3572 |
the cancel button. |
|
3573 |
This is confusing: this method was originally called #acceptValue, |
|
3574 |
but renamed for compatibility with ST-80. |
|
3575 |
This looks like a bad name to me, since in most other situations, #accept |
|
3576 |
is used to force an accept, not to return some valueHolder ...)." |
|
3577 |
||
3578 |
^ acceptValue |
|
280
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
3579 |
! |
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
3580 |
|
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
3581 |
acceptChannel:aValueHolder |
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
3582 |
"set the valueHolder which is set to true when the box |
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
3583 |
is accepted" |
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
3584 |
|
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
3585 |
acceptValue := aValueHolder |
950
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3586 |
! |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3587 |
|
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3588 |
aspectAt:anAspectSymbol put:aDataModel |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3589 |
"return the dataModel for some aspect, nil if no such dataModel was defined; |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3590 |
requires that a corresponding dataModel has been set (usually during |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3591 |
initialization) via the #aspectAt:put: message. |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3592 |
Allows users of boxes to access individual values - especially useful, |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3593 |
in multi-field dialogs." |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3594 |
|
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3595 |
bindings isNil ifTrue:[bindings := IdentityDictionary new]. |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3596 |
bindings at:anAspectSymbol put:aDataModel |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3597 |
|
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3598 |
"Created: 16.1.1997 / 11:38:46 / cg" |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3599 |
"Modified: 16.1.1997 / 11:41:28 / cg" |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3600 |
! |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3601 |
|
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3602 |
aspectFor:anAspectSymbol |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3603 |
"return the dataModel for some aspect, nil if no such dataModel was defined; |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3604 |
requires that a corresponding dataModel has been set (usually during |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3605 |
initialization) via the #aspectAt:put: message. |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3606 |
Allows users of boxes to access individual values - especially useful, |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3607 |
in multi-field dialogs." |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3608 |
|
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3609 |
bindings isNil ifTrue:[^ nil]. |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3610 |
^ bindings at:anAspectSymbol ifAbsent:nil |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3611 |
|
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3612 |
"Modified: 16.1.1997 / 11:41:34 / cg" |
76 | 3613 |
! ! |
3614 |
||
120 | 3615 |
!DialogBox methodsFor:'construction-adding'! |
3616 |
||
593 | 3617 |
addComponent:aComponent |
3618 |
"add any component with its preferred height and full width. |
|
3619 |
Returns the component." |
|
3620 |
||
3621 |
^ self addComponent:aComponent indent:nil tabable:false |
|
3622 |
||
3623 |
"Modified: 9.2.1996 / 22:22:41 / cg" |
|
3624 |
! |
|
3625 |
||
3626 |
addComponent:aComponent indent:indent |
|
3627 |
"add any component with its preferred height and full width. |
|
3628 |
The indent is temporarily changed to indent. |
|
3629 |
Returns the component." |
|
3630 |
||
3631 |
^ self addComponent:aComponent indent:indent tabable:false |
|
3632 |
||
3633 |
"Modified: 9.2.1996 / 22:22:44 / cg" |
|
3634 |
! |
|
3635 |
||
3636 |
addComponent:aComponent indent:indent tabable:tabable |
|
3637 |
"add any component with its preferred height and full width. |
|
3638 |
The indent is temporarily changed to indent. |
|
3639 |
Returns the component." |
|
3640 |
||
3641 |
|oldLeft oldRight result| |
|
3642 |
||
3643 |
oldLeft := leftIndent. |
|
3644 |
oldRight := rightIndent. |
|
3645 |
indent notNil ifTrue:[ |
|
1401 | 3646 |
leftIndent := rightIndent := indent. |
593 | 3647 |
]. |
3648 |
result := self addComponent:aComponent tabable:tabable tabbedComponent:aComponent. |
|
3649 |
leftIndent := oldLeft. |
|
3650 |
rightIndent := oldRight. |
|
3651 |
^ result |
|
3652 |
||
3653 |
"Modified: 9.2.1996 / 22:22:50 / cg" |
|
3654 |
! |
|
3655 |
||
3656 |
addComponent:aComponent indent:indent withExtent:ext |
|
3657 |
"add any component with some given extent. |
|
3658 |
Returns the component." |
|
3659 |
||
3660 |
|fullSize lI rI| |
|
3661 |
||
3662 |
indent isNil ifTrue:[ |
|
1401 | 3663 |
lI := leftIndent. |
3664 |
rI := rightIndent. |
|
593 | 3665 |
] ifFalse:[ |
1401 | 3666 |
lI := rI := indent |
593 | 3667 |
]. |
3668 |
||
3669 |
self basicAddComponent:aComponent. |
|
3670 |
fullSize := ext + (lI + rI @ 0). |
|
3671 |
aComponent extent:fullSize. |
|
3672 |
aComponent origin:0.0@yPosition; |
|
1401 | 3673 |
leftInset:lI; |
3674 |
rightInset:rI. |
|
593 | 3675 |
yPosition := yPosition + aComponent height + ViewSpacing. |
3676 |
width := fullSize x max:width. |
|
3677 |
needResize := true. |
|
3678 |
^ aComponent |
|
3679 |
||
3680 |
"Modified: 9.2.1996 / 22:22:54 / cg" |
|
3681 |
! |
|
3682 |
||
3683 |
addComponent:aComponent indent:indent withHeight:height |
|
3684 |
"add any component with some given height and full width. |
|
3685 |
Returns the component." |
|
3686 |
||
3687 |
|lI rI| |
|
3688 |
||
3689 |
indent isNil ifTrue:[ |
|
1401 | 3690 |
lI := leftIndent. |
3691 |
rI := rightIndent. |
|
593 | 3692 |
] ifFalse:[ |
1401 | 3693 |
lI := rI := indent |
593 | 3694 |
]. |
3695 |
self basicAddComponent:aComponent. |
|
3696 |
aComponent height:height. |
|
3697 |
aComponent origin:0.0@yPosition; |
|
1401 | 3698 |
width:1.0; |
3699 |
leftInset:lI; |
|
3700 |
rightInset:rI. |
|
593 | 3701 |
yPosition := yPosition + "aComponent" height + ViewSpacing. |
3702 |
needResize := true. |
|
3703 |
^ aComponent |
|
3704 |
||
3705 |
"Modified: 9.2.1996 / 22:22:58 / cg" |
|
3706 |
! |
|
3707 |
||
3708 |
addComponent:aComponent tabable:tabable |
|
3709 |
"add any component with its preferred height and full width. |
|
3710 |
Returns the component." |
|
3711 |
||
3712 |
^ self addComponent:aComponent tabable:tabable tabbedComponent:aComponent |
|
3713 |
||
3714 |
"Modified: 9.2.1996 / 22:23:04 / cg" |
|
3715 |
! |
|
3716 |
||
3717 |
addComponent:aComponent tabable:tabable tabbedComponent:subComponent |
|
3718 |
"add any component with its preferred height and full width. |
|
3719 |
Returns the component." |
|
3720 |
||
3721 |
tabable ifTrue:[ |
|
1401 | 3722 |
tabableElements isNil ifTrue:[ |
3723 |
tabableElements := OrderedCollection new |
|
3724 |
]. |
|
3725 |
tabableElements add:subComponent |
|
593 | 3726 |
]. |
3727 |
^ self addComponent:aComponent |
|
1401 | 3728 |
withHeight:(aComponent preferredExtent y). |
593 | 3729 |
|
3730 |
"Modified: 9.2.1996 / 22:23:07 / cg" |
|
3731 |
! |
|
3732 |
||
3733 |
addComponent:aComponent withExtent:ext |
|
3734 |
"add any component with some given extent. |
|
3735 |
Returns the component." |
|
3736 |
||
3737 |
^ self addComponent:aComponent indent:nil withExtent:ext |
|
3738 |
||
3739 |
"Modified: 9.2.1996 / 22:23:11 / cg" |
|
3740 |
! |
|
3741 |
||
3742 |
addComponent:aComponent withHeight:height |
|
3743 |
"add any component with some given height and full width. |
|
3744 |
Returns the component." |
|
3745 |
||
3746 |
^ self addComponent:aComponent indent:nil withHeight:height |
|
3747 |
||
3748 |
"Modified: 9.2.1996 / 22:23:15 / cg" |
|
3749 |
! |
|
3750 |
||
745
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3751 |
addLabelledField:aView label:labelString adjust:labelAdjust tabable:tabable from:leftX to:rightX separateAtX:relativeX |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3752 |
"add a label and some view side-by-side. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3753 |
The labels goes from 0.0 to relativeX; the inputField from relativeX to 1.0. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3754 |
The labels string is defined by labelString and adjusted according to labelAdjust. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3755 |
The inputField gets model as its model. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3756 |
Return the inputField." |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3757 |
|
795 | 3758 |
^ self |
1401 | 3759 |
addLabelledField:aView |
3760 |
label:labelString |
|
3761 |
adjust:labelAdjust |
|
3762 |
tabable:tabable |
|
3763 |
from:leftX to:rightX separateAtX:relativeX |
|
3764 |
nameAs:nil |
|
745
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3765 |
|
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3766 |
" |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3767 |
|dialog model field| |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3768 |
|
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3769 |
model := '' asValue. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3770 |
|
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3771 |
dialog := DialogBox new. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3772 |
|
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3773 |
field := dialog |
1401 | 3774 |
addLabelledField:(EditField on:model) label:'input here:' |
3775 |
adjust:#left |
|
3776 |
tabable:true |
|
3777 |
separateAtX:0.3. |
|
745
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3778 |
|
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3779 |
dialog addAbortButton; addOkButton. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3780 |
dialog open. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3781 |
dialog accepted ifTrue:[Transcript showCR:model value]. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3782 |
" |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3783 |
|
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3784 |
" |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3785 |
|dialog model field| |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3786 |
|
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3787 |
model := SelectionInList new. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3788 |
model list:#('foo' 'bar' 'baz'). |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3789 |
model selectionIndex:2. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3790 |
|
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3791 |
dialog := DialogBox new. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3792 |
|
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3793 |
field := dialog |
1401 | 3794 |
addLabelledField:(PopUpList on:model) label:'select here:' |
3795 |
adjust:#left |
|
3796 |
tabable:true |
|
3797 |
separateAtX:0.3. |
|
745
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3798 |
|
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3799 |
dialog addAbortButton; addOkButton. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3800 |
dialog open. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3801 |
dialog accepted ifTrue:[Transcript showCR:model value]. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3802 |
" |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3803 |
|
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3804 |
"Created: 3.6.1996 / 11:03:24 / cg" |
795 | 3805 |
"Modified: 17.7.1996 / 15:04:07 / cg" |
3806 |
! |
|
3807 |
||
3808 |
addLabelledField:aView label:labelString adjust:labelAdjust tabable:tabable from:leftX to:rightX separateAtX:relativeX nameAs:aName |
|
3809 |
"add a label and some view side-by-side. |
|
3810 |
The labels goes from 0.0 to relativeX; the inputField from relativeX to 1.0. |
|
3811 |
The labels string is defined by labelString and adjusted according to labelAdjust. |
|
3812 |
The inputField gets model as its model. |
|
3813 |
Return the inputField." |
|
3814 |
||
3815 |
|y lbl max relW| |
|
3816 |
||
3817 |
y := self yPosition. |
|
3818 |
lbl := Label label:labelString. |
|
3819 |
max := lbl preferredExtent y max:(aView preferredExtent y). |
|
3820 |
||
3821 |
relW := rightX - leftX. |
|
3822 |
||
3823 |
self addComponent:lbl indent:leftIndent withHeight:max. |
|
3824 |
lbl rightInset:0. |
|
3825 |
lbl |
|
1401 | 3826 |
width:(relW*relativeX); |
3827 |
left:leftX; |
|
3828 |
adjust:labelAdjust; borderWidth:0. |
|
795 | 3829 |
|
3830 |
self yPosition:y. |
|
3831 |
self addComponent:aView tabable:tabable. |
|
3832 |
aView |
|
1401 | 3833 |
leftInset:ViewSpacing; |
3834 |
rightInset:ViewSpacing. |
|
795 | 3835 |
|
3836 |
aView |
|
1401 | 3837 |
width:relW*(1.0 - relativeX); |
3838 |
left:leftX+(relW*relativeX). |
|
795 | 3839 |
|
3840 |
aView isInputField ifTrue:[ |
|
1401 | 3841 |
self addToInputFieldGroup:aView |
795 | 3842 |
]. |
3843 |
||
3844 |
aName notNil ifTrue:[ |
|
1401 | 3845 |
self name:lbl as:(aName , '.label'). |
3846 |
self name:aView as:aName |
|
795 | 3847 |
]. |
3848 |
^ aView |
|
3849 |
||
3850 |
" |
|
3851 |
|dialog model field| |
|
3852 |
||
3853 |
model := '' asValue. |
|
3854 |
||
3855 |
dialog := DialogBox new. |
|
3856 |
||
3857 |
field := dialog |
|
1401 | 3858 |
addLabelledField:(EditField on:model) |
3859 |
label:'input here:' |
|
3860 |
adjust:#left |
|
3861 |
tabable:true |
|
3862 |
separateAtX:0.3. |
|
807 | 3863 |
|
3864 |
dialog addAbortButton; addOkButton. |
|
3865 |
dialog open. |
|
3866 |
dialog accepted ifTrue:[Transcript showCR:model value]. |
|
3867 |
" |
|
3868 |
||
3869 |
" |
|
3870 |
|dialog model field| |
|
3871 |
||
3872 |
model := '' asValue. |
|
3873 |
||
3874 |
dialog := DialogBox new. |
|
3875 |
||
3876 |
field := dialog |
|
1401 | 3877 |
addLabelledField:((ComboListView on:model) list:#('foo' 'bar' 'baz')) |
3878 |
label:'select foo:' |
|
3879 |
adjust:#left |
|
3880 |
tabable:true |
|
3881 |
separateAtX:0.3. |
|
795 | 3882 |
|
3883 |
dialog addAbortButton; addOkButton. |
|
3884 |
dialog open. |
|
3885 |
dialog accepted ifTrue:[Transcript showCR:model value]. |
|
3886 |
" |
|
3887 |
||
3888 |
" |
|
3889 |
|dialog model field| |
|
3890 |
||
3891 |
model := SelectionInList new. |
|
3892 |
model list:#('foo' 'bar' 'baz'). |
|
3893 |
model selectionIndex:2. |
|
3894 |
||
3895 |
dialog := DialogBox new. |
|
3896 |
||
3897 |
field := dialog |
|
1401 | 3898 |
addLabelledField:(PopUpList on:model) |
3899 |
label:'select here:' |
|
3900 |
adjust:#left |
|
3901 |
tabable:true |
|
3902 |
separateAtX:0.3. |
|
795 | 3903 |
|
3904 |
dialog addAbortButton; addOkButton. |
|
3905 |
dialog open. |
|
3906 |
dialog accepted ifTrue:[Transcript showCR:model value]. |
|
3907 |
" |
|
3908 |
||
3909 |
"Created: 17.7.1996 / 15:03:32 / cg" |
|
807 | 3910 |
"Modified: 26.7.1996 / 18:11:12 / cg" |
745
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3911 |
! |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3912 |
|
593 | 3913 |
addLabelledField:aView label:labelString adjust:labelAdjust tabable:tabable separateAtX:relativeX |
3914 |
"add a label and some view side-by-side. |
|
3915 |
The labels goes from 0.0 to relativeX; the inputField from relativeX to 1.0. |
|
3916 |
The labels string is defined by labelString and adjusted according to labelAdjust. |
|
3917 |
The inputField gets model as its model. |
|
3918 |
Return the inputField." |
|
3919 |
||
745
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3920 |
^ self |
1401 | 3921 |
addLabelledField:aView |
3922 |
label:labelString |
|
3923 |
adjust:labelAdjust |
|
3924 |
tabable:tabable |
|
3925 |
from:0.0 to:1.0 |
|
3926 |
separateAtX:relativeX |
|
745
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3927 |
|
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3928 |
"/ |y lbl max| |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3929 |
"/ |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3930 |
"/ y := self yPosition. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3931 |
"/ lbl := Label label:labelString. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3932 |
"/ max := lbl preferredExtent y max:(aView preferredExtent y). |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3933 |
"/ |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3934 |
"/ self addComponent:lbl indent:leftIndent withHeight:max. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3935 |
"/ lbl rightInset:0. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3936 |
"/ lbl width:relativeX; adjust:labelAdjust; borderWidth:0. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3937 |
"/ |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3938 |
"/ self yPosition:y. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3939 |
"/ self addComponent:aView tabable:tabable. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3940 |
"/ aView leftInset:ViewSpacing; rightInset:ViewSpacing. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3941 |
"/ aView width:(1.0 - relativeX); left:relativeX. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3942 |
"/ |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3943 |
"/ aView isInputField ifTrue:[ |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3944 |
"/ self addToInputFieldGroup:aView |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3945 |
"/ ]. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3946 |
"/ |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3947 |
"/ ^ aView |
593 | 3948 |
|
3949 |
" |
|
3950 |
|dialog model field| |
|
3951 |
||
3952 |
model := '' asValue. |
|
3953 |
||
3954 |
dialog := DialogBox new. |
|
3955 |
||
3956 |
field := dialog |
|
1401 | 3957 |
addLabelledField:(EditField on:model) label:'input here:' |
3958 |
adjust:#left |
|
3959 |
tabable:true |
|
3960 |
separateAtX:0.3. |
|
593 | 3961 |
|
3962 |
dialog addAbortButton; addOkButton. |
|
3963 |
dialog open. |
|
655 | 3964 |
dialog accepted ifTrue:[Transcript showCR:model value]. |
593 | 3965 |
" |
3966 |
||
3967 |
" |
|
3968 |
|dialog model field| |
|
3969 |
||
3970 |
model := SelectionInList new. |
|
3971 |
model list:#('foo' 'bar' 'baz'). |
|
3972 |
model selectionIndex:2. |
|
3973 |
||
3974 |
dialog := DialogBox new. |
|
3975 |
||
3976 |
field := dialog |
|
1401 | 3977 |
addLabelledField:(PopUpList on:model) label:'select here:' |
3978 |
adjust:#left |
|
3979 |
tabable:true |
|
3980 |
separateAtX:0.3. |
|
593 | 3981 |
|
3982 |
dialog addAbortButton; addOkButton. |
|
3983 |
dialog open. |
|
655 | 3984 |
dialog accepted ifTrue:[Transcript showCR:model value]. |
593 | 3985 |
" |
3986 |
||
3987 |
"Created: 13.4.1996 / 13:41:31 / cg" |
|
745
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3988 |
"Modified: 3.6.1996 / 18:48:49 / cg" |
593 | 3989 |
! |
3990 |
||
2116 | 3991 |
addMessage:aString centered:centered |
3992 |
^ self addTextLabel:aString |
|
3993 |
||
3994 |
"Created: / 4.2.2000 / 00:03:24 / cg" |
|
3995 |
! |
|
3996 |
||
593 | 3997 |
addTextLabel:aString |
3998 |
"create a text label - the name has been choosen for ST-80 compatibility; |
|
3999 |
however, ST/X labels allow image labels too. |
|
4000 |
Returns the label." |
|
4001 |
||
4002 |
|l| |
|
4003 |
||
4004 |
l := Label new label:aString. |
|
4005 |
l borderWidth:0. |
|
4006 |
self addComponent:l. |
|
4007 |
^ l |
|
4008 |
||
4009 |
" |
|
4010 |
|b| |
|
4011 |
||
4012 |
b := DialogBox new. |
|
4013 |
b addTextLabel:'hello'. |
|
4014 |
b showAtPointer |
|
4015 |
" |
|
4016 |
" |
|
4017 |
|b| |
|
4018 |
||
4019 |
b := DialogBox new. |
|
4020 |
b leftIndent:100. |
|
4021 |
b addTextLabel:'hello'. |
|
4022 |
b leftIndent:0. |
|
4023 |
b addTextLabel:'world'. |
|
4024 |
b showAtPointer |
|
4025 |
" |
|
4026 |
" |
|
4027 |
|b| |
|
4028 |
||
4029 |
b := DialogBox new. |
|
4030 |
b addTextLabel:'hello'. |
|
4031 |
b addTextLabel:'world'. |
|
4032 |
b addOkButton. |
|
4033 |
b showAtPointer |
|
4034 |
" |
|
4035 |
" |
|
4036 |
|b| |
|
4037 |
||
4038 |
b := DialogBox new. |
|
4039 |
b addTextLabel:'hello'. |
|
4040 |
(b addTextLabel:'world') foregroundColor:Color red. |
|
4041 |
b addOkButton. |
|
4042 |
b showAtPointer |
|
4043 |
" |
|
4044 |
" |
|
4045 |
|b| |
|
4046 |
||
4047 |
b := DialogBox new. |
|
4048 |
b addTextLabel:'hello world\\How about this ?' withCRs. |
|
4049 |
b addOkButton. |
|
4050 |
b showAtPointer |
|
4051 |
" |
|
4052 |
" |
|
4053 |
|b| |
|
4054 |
||
4055 |
b := DialogBox new. |
|
4056 |
b addTextLabel:'hello world\\How about this ?' withCRs. |
|
4057 |
b addTextLabel:'not bad'. |
|
4058 |
b addAbortButton. |
|
4059 |
b addOkButton. |
|
4060 |
b showAtPointer |
|
4061 |
" |
|
4062 |
! |
|
4063 |
||
4064 |
addToInputFieldGroup:aComponentOrSubcomponent |
|
4065 |
"add a component to the input group. |
|
4066 |
The argument, aComponentOrSubcomponent may even be a nested subcomponent of |
|
4067 |
a topLevel component." |
|
4068 |
||
1355 | 4069 |
self |
1401 | 4070 |
addToInputFieldGroup:aComponentOrSubcomponent before:nil |
1355 | 4071 |
|
4072 |
"Modified: 18.10.1997 / 03:09:17 / cg" |
|
4073 |
! |
|
4074 |
||
4075 |
addToInputFieldGroup:aComponentOrSubcomponent before:anotherComponent |
|
4076 |
"add a component to the input group. |
|
4077 |
The argument, aComponentOrSubcomponent may even be a nested subcomponent of |
|
4078 |
a topLevel component." |
|
4079 |
||
593 | 4080 |
inputFieldGroup isNil ifTrue:[ |
1759 | 4081 |
inputFieldGroup := EnterFieldGroup new. |
4082 |
inputFieldGroup leaveAction:[self lastFieldLeft]. |
|
4083 |
"/ |
|
4084 |
"/ the first inputField gets the focus initially |
|
4085 |
"/ |
|
4086 |
aComponentOrSubcomponent hasKeyboardFocus:true. |
|
593 | 4087 |
]. |
1355 | 4088 |
inputFieldGroup add:aComponentOrSubcomponent before:anotherComponent. |
593 | 4089 |
self delegate:(KeyboardForwarder to:inputFieldGroup condition:#noFocus). |
4090 |
||
739
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
4091 |
"/ inputFields isNil ifTrue:[ |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
4092 |
"/ inputFields := OrderedCollection new. |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
4093 |
"/ |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
4094 |
"/ "/ the very first field gets the focus initially |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
4095 |
"/ |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
4096 |
"/ aComponentOrSubcomponent showCursor. |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
4097 |
"/ aComponentOrSubcomponent hasKeyboardFocus:true. |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
4098 |
"/ ] ifFalse:[ |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
4099 |
"/ aComponentOrSubcomponent hideCursor. |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
4100 |
"/ aComponentOrSubcomponent hasKeyboardFocus:false. |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
4101 |
"/ ]. |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
4102 |
"/ inputFields add:aComponentOrSubcomponent |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
4103 |
|
1355 | 4104 |
"Modified: 18.10.1997 / 02:47:20 / cg" |
4105 |
"Created: 18.10.1997 / 03:08:51 / cg" |
|
4106 |
! |
|
4107 |
||
4108 |
removeFromInputFieldGroup:aComponentOrSubcomponent |
|
4109 |
"remove a component from the input group. |
|
4110 |
The argument, aComponentOrSubcomponent may even be a nested subcomponent of |
|
4111 |
a topLevel component." |
|
4112 |
||
4113 |
inputFieldGroup isNil ifTrue:[^ self]. |
|
4114 |
inputFieldGroup remove:aComponentOrSubcomponent. |
|
4115 |
||
4116 |
"Created: 18.10.1997 / 02:51:30 / cg" |
|
593 | 4117 |
! ! |
4118 |
||
4119 |
!DialogBox methodsFor:'construction-buttons'! |
|
4120 |
||
1763 | 4121 |
addAbortAndOkButtons |
4122 |
"create both abort- and Ok Buttons" |
|
4123 |
||
4124 |
self addAbortButton; addOkButton |
|
4125 |
! |
|
4126 |
||
197 | 4127 |
addAbortButton |
4128 |
"create an abortButton - to be sent from redefined initialize |
|
162 | 4129 |
methods in subclasses or when creating a box programmatically. |
4130 |
Returns the button." |
|
4131 |
||
197 | 4132 |
^ self addAbortButtonLabelled:nil |
122 | 4133 |
! |
120 | 4134 |
|
162 | 4135 |
addAbortButton:aButton |
4136 |
"add an already created abortButton - to be sent from redefined initialize |
|
4137 |
methods in subclasses or when creating a box programmatically. |
|
4138 |
Returns the button." |
|
4139 |
||
1764 | 4140 |
<resource: #style (#'dialogBox.okAtLeft')> |
4141 |
||
162 | 4142 |
abortButton := aButton. |
4143 |
aButton model:self; change:#abortPressed. |
|
1764 | 4144 |
(styleSheet at:'dialogBox.okAtLeft' default:false) ifTrue:[ |
1763 | 4145 |
self addButton:aButton after:nil. |
4146 |
] ifFalse:[ |
|
4147 |
self addButton:aButton before:nil. |
|
4148 |
]. |
|
4149 |
^ aButton. |
|
162 | 4150 |
|
4151 |
"Created: 17.9.1995 / 20:17:26 / claus" |
|
4152 |
! |
|
4153 |
||
122 | 4154 |
addAbortButtonLabelled:buttonLabel |
4155 |
"create an abortButton with a label - to be sent from redefined initialize |
|
4156 |
methods in subclasses or when creating a box programmatically. |
|
4157 |
A nil argument creates one with the default label. |
|
4158 |
Returns the button." |
|
4159 |
||
162 | 4160 |
|aButton| |
4161 |
||
4162 |
aButton := Button abortButton. |
|
4163 |
buttonLabel notNil ifTrue:[aButton label:buttonLabel]. |
|
4164 |
^ self addAbortButton:aButton |
|
4165 |
||
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4166 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4167 |
|dialog| |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4168 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4169 |
dialog := DialogBox new. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4170 |
dialog addAbortButtonLabelled:'get out of here'. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4171 |
dialog addOkButtonLabelled:'yes thats ok'. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4172 |
dialog open. |
655 | 4173 |
dialog accepted ifTrue:[Transcript showCR:'yes']. |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4174 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4175 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4176 |
"Modified: 9.2.1996 / 22:09:40 / cg" |
120 | 4177 |
! |
76 | 4178 |
|
197 | 4179 |
addButton:aButton |
4180 |
"add a button into the buttonPanel. |
|
122 | 4181 |
Returns the button." |
120 | 4182 |
|
197 | 4183 |
^ self addButton:aButton after:nil |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4184 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4185 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4186 |
|dialog| |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4187 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4188 |
dialog := DialogBox new. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4189 |
dialog addAbortButton. |
655 | 4190 |
dialog addButton:(Button label:'foo' action:[Transcript showCR:'foo']). |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4191 |
dialog addOkButton. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4192 |
dialog open. |
655 | 4193 |
dialog accepted ifTrue:[Transcript showCR:'yes']. |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4194 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4195 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4196 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4197 |
|dialog| |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4198 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4199 |
dialog := DialogBox new. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4200 |
dialog addAbortButton. |
655 | 4201 |
dialog addButton:(Button label:'foo' action:[dialog hide. Transcript showCR:'foo']). |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4202 |
dialog addOkButton. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4203 |
dialog open. |
655 | 4204 |
dialog accepted ifTrue:[Transcript showCR:'yes']. |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4205 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4206 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4207 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4208 |
|dialog| |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4209 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4210 |
dialog := DialogBox new. |
655 | 4211 |
dialog addButton:(Button label:'foo' action:[dialog hide. Transcript showCR:'foo']). |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4212 |
dialog addAbortButton. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4213 |
dialog addOkButton. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4214 |
dialog open. |
655 | 4215 |
dialog accepted ifTrue:[Transcript showCR:'yes']. |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4216 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4217 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4218 |
"Modified: 9.2.1996 / 22:14:17 / cg" |
197 | 4219 |
! |
4220 |
||
4221 |
addButton:aButton after:someOtherButtonOrNil |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4222 |
"add a button into the buttonPanel. |
197 | 4223 |
If the argument someOtherButtonOrNil is nil, the button is |
4224 |
added at the end." |
|
4225 |
||
4226 |
|h| |
|
4227 |
||
4228 |
buttonPanel addSubView:aButton after:someOtherButtonOrNil. |
|
4229 |
buttonPanel subViews size > 1 ifTrue:[ |
|
1843 | 4230 |
buttonPanel horizontalLayout:#fitSpace. |
197 | 4231 |
]. |
4232 |
(h := (aButton heightIncludingBorder + (ViewSpacing * 2))) > buttonPanel topInset ifTrue:[ |
|
1843 | 4233 |
buttonPanel topInset:h negated |
197 | 4234 |
]. |
310
4bbc8deffc8c
allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents:
307
diff
changeset
|
4235 |
needResize := true. |
197 | 4236 |
^ aButton |
310
4bbc8deffc8c
allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents:
307
diff
changeset
|
4237 |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4238 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4239 |
|dialog| |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4240 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4241 |
dialog := DialogBox new. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4242 |
dialog addAbortButton. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4243 |
dialog addOkButton. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4244 |
dialog addButton:(Button |
1843 | 4245 |
label:'foo' |
4246 |
action:[dialog hide. Transcript showCR:'foo']) |
|
4247 |
after:(dialog okButton). |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4248 |
dialog open. |
655 | 4249 |
dialog accepted ifTrue:[Transcript showCR:'yes']. |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4250 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4251 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4252 |
|dialog| |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4253 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4254 |
dialog := DialogBox new. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4255 |
dialog addAbortButton. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4256 |
dialog addOkButton. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4257 |
dialog addButton:(Button |
1843 | 4258 |
label:'foo' |
4259 |
action:[dialog hide. Transcript showCR:'foo']) |
|
4260 |
after:(dialog abortButton). |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4261 |
dialog open. |
655 | 4262 |
dialog accepted ifTrue:[Transcript showCR:'yes']. |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4263 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4264 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4265 |
|dialog| |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4266 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4267 |
dialog := DialogBox new. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4268 |
dialog addAbortButton. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4269 |
dialog addOkButton. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4270 |
dialog addButton:(Button |
1843 | 4271 |
label:'foo' |
4272 |
action:[dialog hide. Transcript showCR:'foo']) |
|
4273 |
after:nil. |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4274 |
dialog open. |
655 | 4275 |
dialog accepted ifTrue:[Transcript showCR:'yes']. |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4276 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4277 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4278 |
"Modified: 9.2.1996 / 22:13:51 / cg" |
197 | 4279 |
! |
4280 |
||
353
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
4281 |
addButton:aButton before:someOtherButtonOrNil |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
4282 |
"add a button into the buttonPanel. |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
4283 |
If the argument someOtherButtonOrNil is nil, the button is |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
4284 |
added upFront." |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
4285 |
|
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
4286 |
|h| |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
4287 |
|
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
4288 |
buttonPanel addSubView:aButton before:someOtherButtonOrNil. |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
4289 |
buttonPanel subViews size > 1 ifTrue:[ |
1843 | 4290 |
buttonPanel horizontalLayout:#fitSpace. |
353
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
4291 |
]. |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
4292 |
(h := (aButton heightIncludingBorder + (ViewSpacing * 2))) > buttonPanel topInset ifTrue:[ |
1843 | 4293 |
buttonPanel topInset:h negated |
353
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
4294 |
]. |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
4295 |
needResize := true. |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
4296 |
^ aButton |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
4297 |
|
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
4298 |
" |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
4299 |
|dialog| |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
4300 |
|
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
4301 |
dialog := DialogBox new. |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
4302 |
dialog addAbortButton. |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
4303 |
dialog addOkButton. |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
4304 |
dialog addButton:(Button |
1843 | 4305 |
label:'foo' |
4306 |
action:[dialog hide. Transcript showCR:'foo']) |
|
4307 |
before:(dialog okButton). |
|
353
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
4308 |
dialog open. |
655 | 4309 |
dialog accepted ifTrue:[Transcript showCR:'yes']. |
353
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
4310 |
" |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
4311 |
" |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
4312 |
|dialog| |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
4313 |
|
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
4314 |
dialog := DialogBox new. |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
4315 |
dialog addAbortButton. |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
4316 |
dialog addOkButton. |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
4317 |
dialog addButton:(Button |
1843 | 4318 |
label:'foo' |
4319 |
action:[dialog hide. Transcript showCR:'foo']) |
|
4320 |
before:nil. |
|
353
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
4321 |
dialog open. |
655 | 4322 |
dialog accepted ifTrue:[Transcript showCR:'yes']. |
353
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
4323 |
" |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
4324 |
|
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
4325 |
"Modified: 9.2.1996 / 22:13:51 / cg" |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
4326 |
"Created: 10.2.1996 / 16:04:35 / cg" |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
4327 |
! |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
4328 |
|
593 | 4329 |
addHelpButtonFor:pathToHelpText |
4330 |
"add a help button to the buttonPanel. |
|
4331 |
The argument, pathToHelpText should specify the path to the help |
|
4332 |
text under either the doc/online/<language> or the help/<language> |
|
4333 |
directory." |
|
4334 |
||
1764 | 4335 |
<resource: #style (#'dialogBox.okAtLeft')> |
4336 |
||
593 | 4337 |
|helpButton| |
4338 |
||
4339 |
helpButton := Button label:(resources string:'help'). |
|
4340 |
helpButton action:[ |
|
1760
631f902aaabe
care for styleSheets right-to-left button order.
Claus Gittinger <cg@exept.de>
parents:
1759
diff
changeset
|
4341 |
self withWaitCursorDo:[HTMLDocumentView openFullOnHelpFile:pathToHelpText] |
631f902aaabe
care for styleSheets right-to-left button order.
Claus Gittinger <cg@exept.de>
parents:
1759
diff
changeset
|
4342 |
]. |
1764 | 4343 |
(styleSheet at:'dialogBox.okAtLeft' default:false) ifTrue:[ |
1760
631f902aaabe
care for styleSheets right-to-left button order.
Claus Gittinger <cg@exept.de>
parents:
1759
diff
changeset
|
4344 |
self addButton:helpButton after:nil. |
631f902aaabe
care for styleSheets right-to-left button order.
Claus Gittinger <cg@exept.de>
parents:
1759
diff
changeset
|
4345 |
] ifFalse:[ |
631f902aaabe
care for styleSheets right-to-left button order.
Claus Gittinger <cg@exept.de>
parents:
1759
diff
changeset
|
4346 |
self addButton:helpButton before:nil. |
631f902aaabe
care for styleSheets right-to-left button order.
Claus Gittinger <cg@exept.de>
parents:
1759
diff
changeset
|
4347 |
]. |
631f902aaabe
care for styleSheets right-to-left button order.
Claus Gittinger <cg@exept.de>
parents:
1759
diff
changeset
|
4348 |
^ helpButton |
593 | 4349 |
|
4350 |
" |
|
4351 |
|box| |
|
4352 |
||
4353 |
box := DialogBox new. |
|
4354 |
box |
|
1760
631f902aaabe
care for styleSheets right-to-left button order.
Claus Gittinger <cg@exept.de>
parents:
1759
diff
changeset
|
4355 |
addHelpButtonFor:'Launcher/compilerSettings.html'; |
631f902aaabe
care for styleSheets right-to-left button order.
Claus Gittinger <cg@exept.de>
parents:
1759
diff
changeset
|
4356 |
addAbortButton; |
631f902aaabe
care for styleSheets right-to-left button order.
Claus Gittinger <cg@exept.de>
parents:
1759
diff
changeset
|
4357 |
addOkButton. |
593 | 4358 |
|
4359 |
box open |
|
4360 |
" |
|
4361 |
||
659 | 4362 |
"Modified: 20.5.1996 / 20:30:55 / cg" |
831
8af010be0a02
Rename Launcher-->OldLauncher, NewLauncher-->Launcher.
Stefan Vogel <sv@exept.de>
parents:
807
diff
changeset
|
4363 |
"Modified: 9.9.1996 / 22:40:21 / stefan" |
593 | 4364 |
! |
4365 |
||
2116 | 4366 |
addOK:checkBlock |
4367 |
|butt| |
|
4368 |
||
4369 |
butt := self addOkButton. |
|
4370 |
"/ what is checkBlock ? |
|
4371 |
^ butt |
|
4372 |
||
4373 |
"Modified: / 4.2.2000 / 00:09:15 / cg" |
|
4374 |
! |
|
4375 |
||
593 | 4376 |
addOkButton |
4377 |
"create an okButton - to be sent from redefined initialize |
|
4378 |
methods in subclasses or when creating a box programmatically. |
|
4379 |
Returns the button." |
|
4380 |
||
4381 |
^ self addOkButtonLabelled:nil |
|
4382 |
||
4383 |
" |
|
4384 |
|dialog| |
|
4385 |
||
4386 |
dialog := DialogBox new. |
|
4387 |
dialog addOkButton. |
|
4388 |
dialog open. |
|
655 | 4389 |
dialog accepted ifTrue:[Transcript showCR:'yes']. |
593 | 4390 |
" |
4391 |
||
4392 |
"Modified: 9.2.1996 / 21:37:02 / cg" |
|
4393 |
! |
|
4394 |
||
4395 |
addOkButton:aButton |
|
4396 |
"add an already created okButton - to be sent from redefined initialize |
|
4397 |
methods in subclasses or when creating a box programmatically. |
|
4398 |
Returns the button." |
|
4399 |
||
1764 | 4400 |
<resource: #style (#'dialogBox.okAtLeft')> |
4401 |
||
4402 |
"/ okButton isNil ifTrue:[ |
|
4403 |
okButton := aButton. |
|
4404 |
"/ ]. |
|
593 | 4405 |
aButton model:self; change:#okPressed. |
1764 | 4406 |
(styleSheet at:'dialogBox.okAtLeft' default:false) ifTrue:[ |
1760
631f902aaabe
care for styleSheets right-to-left button order.
Claus Gittinger <cg@exept.de>
parents:
1759
diff
changeset
|
4407 |
self addButton:aButton before:nil. |
631f902aaabe
care for styleSheets right-to-left button order.
Claus Gittinger <cg@exept.de>
parents:
1759
diff
changeset
|
4408 |
] ifFalse:[ |
631f902aaabe
care for styleSheets right-to-left button order.
Claus Gittinger <cg@exept.de>
parents:
1759
diff
changeset
|
4409 |
self addButton:aButton after:nil. |
631f902aaabe
care for styleSheets right-to-left button order.
Claus Gittinger <cg@exept.de>
parents:
1759
diff
changeset
|
4410 |
]. |
631f902aaabe
care for styleSheets right-to-left button order.
Claus Gittinger <cg@exept.de>
parents:
1759
diff
changeset
|
4411 |
^ aButton. |
593 | 4412 |
|
4413 |
" |
|
4414 |
|dialog b| |
|
4415 |
||
4416 |
b := Button label:((Image fromFile:'garfield.gif') magnifiedBy:0.5). |
|
4417 |
||
4418 |
dialog := DialogBox new. |
|
4419 |
dialog addOkButton:b. |
|
4420 |
dialog open. |
|
655 | 4421 |
dialog accepted ifTrue:[Transcript showCR:'yes']. |
593 | 4422 |
" |
4423 |
||
4424 |
"Modified: 17.9.1995 / 20:20:41 / claus" |
|
4425 |
"Modified: 9.2.1996 / 21:38:48 / cg" |
|
4426 |
! |
|
4427 |
||
4428 |
addOkButtonLabelled:buttonLabel |
|
4429 |
"create an okButton with a label - to be sent from redefined initialize |
|
4430 |
methods in subclasses or when creating a box programmatically. |
|
4431 |
A nil argument creates one with the default text. |
|
4432 |
Returns the button." |
|
4433 |
||
4434 |
|aButton| |
|
4435 |
||
4436 |
aButton := Button okButton. |
|
4437 |
buttonLabel notNil ifTrue:[aButton label:buttonLabel]. |
|
4438 |
aButton isReturnButton:acceptReturnAsOK. |
|
4439 |
^ self addOkButton:aButton. |
|
4440 |
||
4441 |
" |
|
4442 |
|dialog| |
|
4443 |
||
4444 |
dialog := DialogBox new. |
|
4445 |
dialog addOkButtonLabelled:'get out of here'. |
|
4446 |
dialog open. |
|
655 | 4447 |
dialog accepted ifTrue:[Transcript showCR:'yes']. |
593 | 4448 |
" |
4449 |
||
4450 |
"Modified: 9.2.1996 / 21:39:34 / cg" |
|
4451 |
! ! |
|
4452 |
||
4453 |
!DialogBox methodsFor:'construction-check & comboboxes'! |
|
4454 |
||
197 | 4455 |
addCheckBox:label on:aModel |
4456 |
"create a checkBox with label on aModel and add it. |
|
4457 |
Returns the box." |
|
4458 |
||
4459 |
^ self addCheckBox:label on:aModel tabable:true |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4460 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4461 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4462 |
|dialog check| |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4463 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4464 |
check := true asValue. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4465 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4466 |
dialog := DialogBox new. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4467 |
dialog addCheckBox:'on or off' on:check. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4468 |
dialog addOkButton. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4469 |
dialog open. |
655 | 4470 |
dialog accepted ifTrue:[Transcript showCR:check value]. |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4471 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4472 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4473 |
"Modified: 9.2.1996 / 22:15:38 / cg" |
197 | 4474 |
! |
4475 |
||
600 | 4476 |
addCheckBox:label on:aModel tabable:tabable |
4477 |
"create a checkBox with label on aModel and add it. |
|
4478 |
Returns the box." |
|
4479 |
||
4480 |
|b| |
|
4481 |
||
4482 |
b := CheckBox on:aModel. |
|
4483 |
b label:label. |
|
4484 |
self addComponent:b tabable:tabable. |
|
4485 |
^ b |
|
4486 |
||
4487 |
" |
|
4488 |
|dialog check1 check2 check3| |
|
4489 |
||
4490 |
check1 := true asValue. |
|
4491 |
check2 := false asValue. |
|
4492 |
check3 := true asValue. |
|
4493 |
||
4494 |
dialog := DialogBox new. |
|
4495 |
dialog addCheckBox:'on or off' on:check1 tabable:false. |
|
4496 |
dialog addHorizontalLine. |
|
4497 |
||
4498 |
dialog addCheckBox:'on or off' on:check2 tabable:true. |
|
4499 |
dialog addCheckBox:'on or off' on:check3 tabable:true. |
|
4500 |
dialog addOkButton. |
|
4501 |
dialog open. |
|
4502 |
" |
|
4503 |
||
4504 |
"Modified: 9.2.1996 / 22:16:49 / cg" |
|
4505 |
! |
|
4506 |
||
593 | 4507 |
addComboBoxOn:aModel |
4508 |
"create a comboBoxView on aModel and add it. |
|
4509 |
Returns the comboBoxView." |
|
4510 |
||
4511 |
^ self addComboBoxOn:aModel tabable:true |
|
4512 |
||
4513 |
" |
|
4514 |
without a list, the comboBox is disabled: |
|
4515 |
||
4516 |
|box val| |
|
4517 |
||
4518 |
val := 'some input' asValue. |
|
4519 |
||
4520 |
box := Dialog new. |
|
4521 |
||
4522 |
(box addTextLabel:'combo box example') adjust:#left. |
|
4523 |
box addVerticalSpace. |
|
4524 |
(box addComboBoxOn:val). |
|
4525 |
box addOkButton. |
|
4526 |
box open. |
|
4527 |
box accepted ifTrue:[ |
|
1401 | 4528 |
Transcript showCR:val value |
593 | 4529 |
]. |
4530 |
" |
|
4531 |
||
4532 |
"with a list, it can be pulled: |
|
4533 |
||
4534 |
|box val| |
|
4535 |
||
4536 |
val := '' asValue. |
|
4537 |
||
4538 |
box := Dialog new. |
|
4539 |
||
4540 |
(box addTextLabel:'combo box example') adjust:#left. |
|
4541 |
box addVerticalSpace. |
|
4542 |
(box addComboBoxOn:val) list:#('one' 'two' 'three' 'four'). |
|
4543 |
box addOkButton. |
|
4544 |
box open. |
|
4545 |
box accepted ifTrue:[ |
|
1401 | 4546 |
Transcript showCR:val value |
593 | 4547 |
]. |
4548 |
" |
|
4549 |
||
4550 |
"Modified: 28.2.1996 / 15:17:39 / cg" |
|
4551 |
"Created: 4.3.1996 / 17:21:45 / cg" |
|
4552 |
! |
|
4553 |
||
4554 |
addComboBoxOn:aModel tabable:tabable |
|
4555 |
"create a comboBoxView on aModel and add it. |
|
4556 |
Returns the comboBoxView." |
|
4557 |
||
4558 |
|f| |
|
4559 |
||
4560 |
f := ComboBoxView new. |
|
4561 |
f model:aModel. |
|
4562 |
self addComponent:f tabable:tabable. |
|
4563 |
tabable ifTrue:[ |
|
1401 | 4564 |
self addToInputFieldGroup:f editor. |
593 | 4565 |
]. |
4566 |
^ f |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4567 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4568 |
" |
593 | 4569 |
without a list, the comboBox is disabled: |
4570 |
||
4571 |
|box val| |
|
4572 |
||
4573 |
val := 'some input' asValue. |
|
4574 |
||
4575 |
box := Dialog new. |
|
4576 |
||
4577 |
(box addTextLabel:'combo box example') adjust:#left. |
|
4578 |
box addVerticalSpace. |
|
4579 |
(box addComboBoxOn:val tabable:true). |
|
4580 |
box addOkButton. |
|
4581 |
box open. |
|
4582 |
box accepted ifTrue:[ |
|
1401 | 4583 |
Transcript showCR:val value |
593 | 4584 |
]. |
4585 |
" |
|
4586 |
||
4587 |
"with a list, it can be pulled: |
|
4588 |
||
4589 |
|box val| |
|
4590 |
||
4591 |
val := '' asValue. |
|
4592 |
||
4593 |
box := Dialog new. |
|
4594 |
||
4595 |
(box addTextLabel:'combo box example') adjust:#left. |
|
4596 |
box addVerticalSpace. |
|
4597 |
(box addComboBoxOn:val tabable:true) list:#('one' 'two' 'three' 'four'). |
|
4598 |
box addOkButton. |
|
4599 |
box open. |
|
4600 |
box accepted ifTrue:[ |
|
1401 | 4601 |
Transcript showCR:val value |
593 | 4602 |
]. |
4603 |
" |
|
4604 |
||
4605 |
"Modified: 4.3.1996 / 17:21:57 / cg" |
|
4606 |
! |
|
4607 |
||
4608 |
addComboListOn:aModel |
|
4609 |
"create a comboListView on aModel and add it. |
|
4610 |
Returns the comboListView." |
|
4611 |
||
4612 |
^ self addComboListOn:aModel tabable:true |
|
4613 |
||
4614 |
"without a list, the comboList is disabled: |
|
4615 |
||
4616 |
|box val| |
|
4617 |
||
4618 |
val := 'some input' asValue. |
|
4619 |
||
4620 |
box := Dialog new. |
|
4621 |
||
4622 |
(box addTextLabel:'combo list example') adjust:#left. |
|
4623 |
box addVerticalSpace. |
|
4624 |
(box addComboListOn:val). |
|
4625 |
box addOkButton. |
|
4626 |
box open. |
|
4627 |
box accepted ifTrue:[ |
|
1401 | 4628 |
Transcript showCR:val value |
593 | 4629 |
]. |
4630 |
" |
|
4631 |
||
4632 |
"with a list, it can be pulled: |
|
4633 |
||
4634 |
|box val| |
|
4635 |
||
4636 |
val := '' asValue. |
|
4637 |
||
4638 |
box := Dialog new. |
|
4639 |
||
4640 |
(box addTextLabel:'combo box example') adjust:#left. |
|
4641 |
box addVerticalSpace. |
|
4642 |
(box addComboListOn:val) list:#('one' 'two' 'three' 'four'). |
|
4643 |
box addOkButton. |
|
4644 |
box open. |
|
4645 |
box accepted ifTrue:[ |
|
1401 | 4646 |
Transcript showCR:val value |
593 | 4647 |
]. |
4648 |
" |
|
4649 |
||
4650 |
"Created: 28.2.1996 / 15:16:34 / cg" |
|
4651 |
"Modified: 4.3.1996 / 17:22:59 / cg" |
|
4652 |
! |
|
4653 |
||
4654 |
addComboListOn:aModel tabable:tabable |
|
4655 |
"create a comboListView on aModel and add it. |
|
4656 |
Returns the comboListView." |
|
4657 |
||
4658 |
|f| |
|
4659 |
||
4660 |
f := ComboListView new. |
|
4661 |
f model:aModel. |
|
4662 |
self addComponent:f tabable:tabable. |
|
4663 |
^ f |
|
4664 |
||
4665 |
"without a list, the comboList is disabled: |
|
4666 |
||
4667 |
|box val| |
|
4668 |
||
4669 |
val := 'some input' asValue. |
|
4670 |
||
4671 |
box := Dialog new. |
|
4672 |
||
4673 |
(box addTextLabel:'combo list example') adjust:#left. |
|
4674 |
box addVerticalSpace. |
|
4675 |
(box addComboListOn:val tabable:true). |
|
4676 |
box addOkButton. |
|
4677 |
box open. |
|
4678 |
box accepted ifTrue:[ |
|
1401 | 4679 |
Transcript showCR:val value |
593 | 4680 |
]. |
4681 |
" |
|
4682 |
||
4683 |
"with a list, it can be pulled: |
|
4684 |
||
4685 |
|box val| |
|
4686 |
||
4687 |
val := '' asValue. |
|
4688 |
||
4689 |
box := Dialog new. |
|
4690 |
||
4691 |
(box addTextLabel:'combo box example') adjust:#left. |
|
4692 |
box addVerticalSpace. |
|
4693 |
(box addComboListOn:val tabable:true) list:#('one' 'two' 'three' 'four'). |
|
4694 |
box addOkButton. |
|
4695 |
box open. |
|
4696 |
box accepted ifTrue:[ |
|
1401 | 4697 |
Transcript showCR:val value |
593 | 4698 |
]. |
4699 |
" |
|
4700 |
||
4701 |
"Created: 28.2.1996 / 15:16:34 / cg" |
|
4702 |
"Modified: 4.3.1996 / 17:23:38 / cg" |
|
4703 |
! ! |
|
4704 |
||
4705 |
!DialogBox methodsFor:'construction-inputfields'! |
|
4706 |
||
4707 |
addFilenameInputFieldOn:aModel in:aDirectory tabable:tabable |
|
4708 |
"create a fileName input field on aModel and add it. |
|
4709 |
Returns the field. This is much like a normal input field, |
|
4710 |
but supports filename completion." |
|
4711 |
||
4712 |
|f| |
|
4713 |
||
4714 |
f := FilenameEditField new. |
|
4715 |
aDirectory notNil ifTrue:[f directory:aDirectory]. |
|
4716 |
f model:aModel. |
|
4717 |
self addInputField:f tabable:tabable. |
|
4718 |
^ f |
|
4719 |
! |
|
4720 |
||
4721 |
addInputField:aField |
|
4722 |
"add an already created input field. |
|
4723 |
Returns the field." |
|
4724 |
||
4725 |
^ self addInputField:aField tabable:true |
|
4726 |
||
4727 |
"Modified: 9.2.1996 / 20:46:16 / cg" |
|
4728 |
! |
|
4729 |
||
4730 |
addInputField:aField tabable:tabable |
|
4731 |
"add an already created input field. |
|
4732 |
If tabable is true, the field is put into a group, to allow |
|
4733 |
stepping through the fields with #Cursor/#Return keys. |
|
4734 |
Returns the field." |
|
4735 |
||
4736 |
self addComponent:aField tabable:tabable. |
|
4737 |
tabable ifTrue:[ |
|
1401 | 4738 |
self addToInputFieldGroup:aField. |
593 | 4739 |
]. |
4740 |
^ aField |
|
4741 |
||
739
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
4742 |
"Modified: 31.5.1996 / 21:22:29 / cg" |
593 | 4743 |
! |
4744 |
||
4745 |
addInputFieldOn:aModel |
|
4746 |
"create an input field on aModel and add it. |
|
4747 |
Returns the field." |
|
4748 |
||
4749 |
^ self addInputFieldOn:aModel tabable:true |
|
4750 |
||
4751 |
" |
|
4752 |
|dialog model field| |
|
4753 |
||
4754 |
model := '' asValue. |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4755 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4756 |
dialog := DialogBox new. |
593 | 4757 |
(dialog addTextLabel:'enter a string') adjust:#left. |
4758 |
||
4759 |
field := dialog addInputFieldOn:model. |
|
4760 |
||
4761 |
dialog addAbortButton; addOkButton. |
|
4762 |
dialog open. |
|
655 | 4763 |
dialog accepted ifTrue:[Transcript showCR:model value]. |
593 | 4764 |
" |
4765 |
||
4766 |
"Modified: 9.2.1996 / 21:34:14 / cg" |
|
4767 |
! |
|
4768 |
||
4769 |
addInputFieldOn:aModel tabable:tabable |
|
4770 |
"create an input field on aModel and add it. |
|
4771 |
If tabable is false, the field cannot be tabbed into |
|
4772 |
and return does not close the box. |
|
4773 |
(pointer must be moved into it). |
|
4774 |
Returns the field." |
|
4775 |
||
4776 |
|f| |
|
4777 |
||
913 | 4778 |
f := EditField model:aModel. |
593 | 4779 |
self addInputField:f tabable:tabable. |
4780 |
^ f |
|
4781 |
||
4782 |
" a non-tabable field: |
|
4783 |
||
4784 |
|dialog model field| |
|
4785 |
||
4786 |
model := '' asValue. |
|
4787 |
||
4788 |
dialog := DialogBox new. |
|
4789 |
(dialog addTextLabel:'enter a string') adjust:#left. |
|
4790 |
||
4791 |
field := dialog addInputFieldOn:model tabable:false. |
|
4792 |
||
4793 |
dialog addAbortButton; addOkButton. |
|
4794 |
dialog open. |
|
655 | 4795 |
dialog accepted ifTrue:[Transcript showCR:model value]. |
593 | 4796 |
" |
4797 |
||
4798 |
"Modified: 9.2.1996 / 21:36:16 / cg" |
|
913 | 4799 |
"Modified: 3.1.1997 / 10:24:04 / stefan" |
593 | 4800 |
! |
4801 |
||
745
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
4802 |
addLabelledInputField:labelString adjust:labelAdjust on:model tabable:tabable from:leftX to:rightX separateAtX:relativeX |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
4803 |
"add a label and an inputField side-by-side. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
4804 |
The labels goes from 0.0 to relativeX; the inputField from relativeX to 1.0. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
4805 |
The labels string is defined by labelString and adjusted according to labelAdjust. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
4806 |
The inputField gets model as its model. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
4807 |
Return the inputField." |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
4808 |
|
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
4809 |
|
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
4810 |
^ self |
1401 | 4811 |
addLabelledField:(EditField on:model) label:labelString |
4812 |
adjust:labelAdjust |
|
4813 |
tabable:tabable |
|
4814 |
from:leftX to:rightX |
|
4815 |
separateAtX:relativeX. |
|
745
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
4816 |
|
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
4817 |
" |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
4818 |
|dialog model field| |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
4819 |
|
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
4820 |
model := '' asValue. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
4821 |
|
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
4822 |
dialog := DialogBox new. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
4823 |
|
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
4824 |
field := dialog |
1401 | 4825 |
addLabelledInputField:'enter a string' |
4826 |
adjust:#left |
|
4827 |
on:model |
|
4828 |
tabable:true |
|
4829 |
separateAtX:0.3. |
|
745
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
4830 |
|
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
4831 |
dialog addAbortButton; addOkButton. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
4832 |
dialog open. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
4833 |
dialog accepted ifTrue:[Transcript showCR:model value]. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
4834 |
" |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
4835 |
|
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
4836 |
" |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
4837 |
|dialog model1 model2 field| |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
4838 |
|
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
4839 |
model1 := '' asValue. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
4840 |
model2 := '' asValue. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
4841 |
|
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
4842 |
dialog := DialogBox new. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
4843 |
|
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
4844 |
dialog addTextLabel:'a two-input box'. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
4845 |
dialog addHorizontalLine. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
4846 |
|
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
4847 |
field := dialog |
1401 | 4848 |
addLabelledInputField:'string1:' |
4849 |
adjust:#right |
|
4850 |
on:model1 |
|
4851 |
tabable:true |
|
4852 |
separateAtX:0.4. |
|
745
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
4853 |
|
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
4854 |
field := dialog |
1401 | 4855 |
addLabelledInputField:'string2:' |
4856 |
adjust:#right |
|
4857 |
on:model2 |
|
4858 |
tabable:true |
|
4859 |
separateAtX:0.4. |
|
745
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
4860 |
|
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
4861 |
dialog addAbortButton; addOkButton. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
4862 |
dialog open. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
4863 |
dialog accepted ifTrue:[ |
1401 | 4864 |
Transcript showCR:model1 value. |
4865 |
Transcript showCR:model2 value. |
|
745
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
4866 |
]. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
4867 |
" |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
4868 |
|
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
4869 |
"Modified: 19.4.1996 / 17:39:46 / cg" |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
4870 |
"Created: 3.6.1996 / 11:04:23 / cg" |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
4871 |
! |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
4872 |
|
593 | 4873 |
addLabelledInputField:labelString adjust:labelAdjust on:model tabable:tabable separateAtX:relativeX |
4874 |
"add a label and an inputField side-by-side. |
|
4875 |
The labels goes from 0.0 to relativeX; the inputField from relativeX to 1.0. |
|
4876 |
The labels string is defined by labelString and adjusted according to labelAdjust. |
|
4877 |
The inputField gets model as its model. |
|
4878 |
Return the inputField." |
|
4879 |
||
4880 |
||
4881 |
^ self |
|
1401 | 4882 |
addLabelledField:(EditField on:model) label:labelString |
4883 |
adjust:labelAdjust |
|
4884 |
tabable:tabable |
|
4885 |
separateAtX:relativeX. |
|
593 | 4886 |
|
4887 |
" |
|
4888 |
|dialog model field| |
|
4889 |
||
4890 |
model := '' asValue. |
|
4891 |
||
4892 |
dialog := DialogBox new. |
|
4893 |
||
4894 |
field := dialog |
|
1401 | 4895 |
addLabelledInputField:'enter a string' |
4896 |
adjust:#left |
|
4897 |
on:model |
|
4898 |
tabable:true |
|
4899 |
separateAtX:0.3. |
|
593 | 4900 |
|
4901 |
dialog addAbortButton; addOkButton. |
|
4902 |
dialog open. |
|
655 | 4903 |
dialog accepted ifTrue:[Transcript showCR:model value]. |
593 | 4904 |
" |
4905 |
||
4906 |
" |
|
4907 |
|dialog model1 model2 field| |
|
4908 |
||
4909 |
model1 := '' asValue. |
|
4910 |
model2 := '' asValue. |
|
4911 |
||
4912 |
dialog := DialogBox new. |
|
4913 |
||
4914 |
dialog addTextLabel:'a two-input box'. |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4915 |
dialog addHorizontalLine. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4916 |
|
593 | 4917 |
field := dialog |
1401 | 4918 |
addLabelledInputField:'string1:' |
4919 |
adjust:#right |
|
4920 |
on:model1 |
|
4921 |
tabable:true |
|
4922 |
separateAtX:0.4. |
|
593 | 4923 |
|
4924 |
field := dialog |
|
1401 | 4925 |
addLabelledInputField:'string2:' |
4926 |
adjust:#right |
|
4927 |
on:model2 |
|
4928 |
tabable:true |
|
4929 |
separateAtX:0.4. |
|
593 | 4930 |
|
4931 |
dialog addAbortButton; addOkButton. |
|
4932 |
dialog open. |
|
4933 |
dialog accepted ifTrue:[ |
|
1401 | 4934 |
Transcript showCR:model1 value. |
4935 |
Transcript showCR:model2 value. |
|
593 | 4936 |
]. |
4937 |
" |
|
4938 |
||
4939 |
"Created: 13.4.1996 / 13:41:31 / cg" |
|
4940 |
"Modified: 19.4.1996 / 17:39:46 / cg" |
|
4941 |
! ! |
|
4942 |
||
4943 |
!DialogBox methodsFor:'construction-layout'! |
|
4944 |
||
2116 | 4945 |
addGap:pixels |
4946 |
"VW compatibility" |
|
4947 |
||
4948 |
self addVerticalSpace:pixels |
|
4949 |
||
4950 |
"Created: / 4.2.2000 / 00:03:58 / cg" |
|
4951 |
"Modified: / 5.2.2000 / 15:30:26 / cg" |
|
4952 |
! |
|
4953 |
||
593 | 4954 |
addHorizontalLine |
4955 |
"add a horizontal line as separator" |
|
4956 |
||
4957 |
^ self addComponent:(Separator new extent:1.0 @ 5). |
|
4958 |
||
4959 |
" |
|
4960 |
|dialog| |
|
4961 |
||
4962 |
dialog := DialogBox new. |
|
4963 |
dialog |
|
1401 | 4964 |
addTextLabel:'some title string'; |
4965 |
addHorizontalLine; |
|
4966 |
addTextLabel:'more text'; |
|
4967 |
addOkButton; |
|
4968 |
open. |
|
593 | 4969 |
" |
4970 |
||
4971 |
" |
|
4972 |
|dialog| |
|
4973 |
||
4974 |
dialog := DialogBox new. |
|
4975 |
dialog |
|
1401 | 4976 |
addTextLabel:'some title string'; |
4977 |
addHorizontalLine; |
|
4978 |
addTextLabel:'more text'. |
|
593 | 4979 |
(dialog addHorizontalLine) width:20. |
4980 |
dialog addTextLabel:'more text'. |
|
4981 |
(dialog addHorizontalLine) width:20. |
|
4982 |
dialog |
|
1401 | 4983 |
addTextLabel:'more text'; |
4984 |
addHorizontalLine; |
|
4985 |
addOkButton; |
|
4986 |
open. |
|
593 | 4987 |
" |
4988 |
||
4989 |
"Modified: 19.4.1996 / 15:11:30 / cg" |
|
4990 |
! |
|
4991 |
||
4992 |
addVerticalSpace |
|
4993 |
"add a default vertical space (1 mm)" |
|
4994 |
||
4995 |
self addVerticalSpace:(ViewSpacing). |
|
4996 |
||
4997 |
" |
|
4998 |
|dialog| |
|
4999 |
||
5000 |
dialog := DialogBox new. |
|
5001 |
dialog addTextLabel:'some title string'. |
|
5002 |
dialog addVerticalSpace. |
|
5003 |
dialog addTextLabel:'more text'. |
|
5004 |
||
5005 |
dialog addOkButton. |
|
5006 |
dialog open. |
|
5007 |
" |
|
5008 |
||
5009 |
"Modified: 9.2.1996 / 21:41:10 / cg" |
|
5010 |
! |
|
5011 |
||
5012 |
addVerticalSpace:nPixel |
|
5013 |
"add some pixels of space to the next component" |
|
5014 |
||
5015 |
yPosition := yPosition + nPixel. |
|
5016 |
needResize := true. |
|
5017 |
||
5018 |
" |
|
5019 |
|dialog| |
|
5020 |
||
5021 |
dialog := DialogBox new. |
|
5022 |
dialog addTextLabel:'some title string'. |
|
5023 |
dialog addVerticalSpace:50. |
|
5024 |
dialog addTextLabel:'more text'. |
|
5025 |
||
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5026 |
dialog addOkButton. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5027 |
dialog open. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5028 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5029 |
|
593 | 5030 |
"Modified: 9.2.1996 / 21:41:23 / cg" |
5031 |
! |
|
5032 |
||
2116 | 5033 |
bottomAlign:widgets |
5034 |
"mhmh - seems similar to out stickAtBottom functionality - to be checked" |
|
5035 |
||
5036 |
self halt:'unimplemented VW functionality'. |
|
5037 |
||
5038 |
"Created: / 4.2.2000 / 00:10:21 / cg" |
|
5039 |
"Modified: / 5.2.2000 / 15:31:23 / cg" |
|
5040 |
! |
|
5041 |
||
5042 |
bottomAlignLowerEdge:widget |
|
5043 |
"mhmh - seems similar to out stickAtBottom functionality - to be checked" |
|
5044 |
||
5045 |
self halt:'unimplemented VW functionality'. |
|
5046 |
||
5047 |
"Modified: / 5.2.2000 / 15:31:15 / cg" |
|
5048 |
! |
|
5049 |
||
593 | 5050 |
leftIndent |
5051 |
"return the current indent |
|
5052 |
(current x position - thats where the next component will be located)." |
|
5053 |
||
5054 |
^ leftIndent |
|
5055 |
||
5056 |
"Modified: 27.1.1996 / 18:21:31 / cg" |
|
5057 |
! |
|
5058 |
||
5059 |
leftIndent:aNumber |
|
5060 |
"set the left indent (current x position - thats where the next component |
|
5061 |
will be located)." |
|
5062 |
||
5063 |
leftIndent := aNumber. |
|
5064 |
needResize := true. |
|
5065 |
||
5066 |
" |
|
5067 |
|dialog| |
|
5068 |
||
5069 |
dialog := DialogBox new. |
|
5070 |
(dialog addTextLabel:'label1') adjust:#left. |
|
5071 |
dialog leftIndent:20. |
|
5072 |
(dialog addTextLabel:'label2') adjust:#left. |
|
5073 |
dialog leftIndent:40. |
|
5074 |
(dialog addTextLabel:'label3') adjust:#left. |
|
5075 |
dialog leftIndent:60. |
|
5076 |
(dialog addTextLabel:'label4') adjust:#left. |
|
5077 |
||
5078 |
dialog addOkButton. |
|
5079 |
dialog open. |
|
5080 |
" |
|
5081 |
||
5082 |
"Modified: 9.2.1996 / 21:42:20 / cg" |
|
5083 |
! |
|
5084 |
||
5085 |
rightIndent |
|
5086 |
"return the current right indent." |
|
5087 |
||
5088 |
^ rightIndent |
|
5089 |
||
5090 |
"Modified: 27.1.1996 / 18:21:31 / cg" |
|
5091 |
! |
|
5092 |
||
5093 |
rightIndent:aNumber |
|
5094 |
"set the right indent" |
|
5095 |
||
5096 |
rightIndent := aNumber. |
|
5097 |
needResize := true. |
|
5098 |
||
5099 |
" |
|
5100 |
|dialog| |
|
5101 |
||
5102 |
dialog := DialogBox new. |
|
5103 |
(dialog addTextLabel:'label1') adjust:#right. |
|
5104 |
dialog rightIndent:20. |
|
5105 |
(dialog addTextLabel:'label2') adjust:#right. |
|
5106 |
dialog rightIndent:40. |
|
5107 |
(dialog addTextLabel:'label3') adjust:#right. |
|
5108 |
dialog rightIndent:60. |
|
5109 |
(dialog addTextLabel:'label4') adjust:#right. |
|
5110 |
||
5111 |
dialog addOkButton. |
|
5112 |
dialog open. |
|
5113 |
" |
|
5114 |
||
5115 |
"Modified: 9.2.1996 / 21:42:46 / cg" |
|
5116 |
! |
|
5117 |
||
2116 | 5118 |
setInitialGap |
5119 |
||
5120 |
"Created: / 4.2.2000 / 00:01:44 / cg" |
|
5121 |
! |
|
5122 |
||
593 | 5123 |
stickAtBottomWithFixHeight:aComponent |
5124 |
"arrange for a component to be positioned at a constant offset |
|
5125 |
from the bottom of the box and its height to remain the same. |
|
5126 |
This will keep the component at a constant distance from the bottom |
|
5127 |
(without this setup, it would stay at a constant offset from the top)" |
|
5128 |
||
1949
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
5129 |
self stickAtBottomWithFixHeight:aComponent left:0.0 right:1.0 |
593 | 5130 |
|
5131 |
" |
|
5132 |
compare the resizing behavior of: |
|
5133 |
||
1949
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
5134 |
|box| |
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
5135 |
|
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
5136 |
box := Dialog new. |
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
5137 |
box addTextLabel:'hello'. |
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
5138 |
box addTextLabel:'hello2'. |
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
5139 |
box addOkButton. |
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
5140 |
box show |
593 | 5141 |
|
5142 |
with: |
|
5143 |
||
1949
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
5144 |
|box l2| |
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
5145 |
|
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
5146 |
box := Dialog new. |
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
5147 |
box addTextLabel:'hello'. |
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
5148 |
l2 := box addTextLabel:'hello2'. |
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
5149 |
box addOkButton. |
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
5150 |
box stickAtBottomWithFixHeight:l2. |
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
5151 |
box show |
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
5152 |
" |
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
5153 |
|
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
5154 |
"Created: 27.1.1996 / 17:17:41 / cg" |
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
5155 |
"Modified: 27.1.1996 / 18:29:03 / cg" |
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
5156 |
! |
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
5157 |
|
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
5158 |
stickAtBottomWithFixHeight:aComponent left:left right:right |
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
5159 |
"arrange for a component to be positioned at a constant offset |
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
5160 |
from the bottom of the box and its height to remain the same. |
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
5161 |
This will keep the component at a constant distance from the bottom |
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
5162 |
(without this setup, it would stay at a constant offset from the top)" |
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
5163 |
|
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
5164 |
self resize. |
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
5165 |
|
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
5166 |
aComponent |
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
5167 |
topInset:(self height - aComponent top) negated; |
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
5168 |
bottomInset:(self height - aComponent bottom); |
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
5169 |
origin:left @ 1.0; corner:right @ 1.0. |
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
5170 |
|
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
5171 |
" |
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
5172 |
compare the resizing behavior of: |
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
5173 |
|
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
5174 |
|box| |
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
5175 |
|
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
5176 |
box := Dialog new. |
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
5177 |
box addTextLabel:'hello'. |
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
5178 |
box addTextLabel:'hello2'. |
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
5179 |
box addOkButton. |
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
5180 |
box show |
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
5181 |
|
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
5182 |
with: |
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
5183 |
|
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
5184 |
|box l2| |
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
5185 |
|
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
5186 |
box := Dialog new. |
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
5187 |
box addTextLabel:'hello'. |
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
5188 |
l2 := box addTextLabel:'hello2'. |
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
5189 |
box addOkButton. |
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
5190 |
box stickAtBottomWithFixHeight:l2. |
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
5191 |
box show |
593 | 5192 |
" |
5193 |
||
5194 |
"Created: 27.1.1996 / 17:17:41 / cg" |
|
5195 |
"Modified: 27.1.1996 / 18:29:03 / cg" |
|
5196 |
! |
|
5197 |
||
5198 |
stickAtBottomWithVariableHeight:aComponent |
|
5199 |
"arrange for a component to be positioned at a constant offset |
|
5200 |
from the bottom of the box and its height to be adjusted. |
|
5201 |
This will resize the component for a constant distance from the top, |
|
5202 |
and the bottom. |
|
5203 |
(without this setup, its height would remain constant)" |
|
5204 |
||
5205 |
self resize. |
|
5206 |
||
5207 |
aComponent |
|
1401 | 5208 |
bottomInset:(self height - aComponent bottom); |
5209 |
corner:1.0@1.0. |
|
593 | 5210 |
|
5211 |
" |
|
5212 |
compare the resizing behavior of: |
|
5213 |
||
1401 | 5214 |
|box| |
5215 |
||
5216 |
box := Dialog new. |
|
5217 |
box addTextLabel:'hello'. |
|
5218 |
(box addComponent:(SelectionInListView new)) level:-1. |
|
5219 |
box addOkButton. |
|
5220 |
box show |
|
593 | 5221 |
|
5222 |
with: |
|
5223 |
||
1401 | 5224 |
|box list| |
5225 |
||
5226 |
box := Dialog new. |
|
5227 |
box addTextLabel:'hello'. |
|
5228 |
list := (box addComponent:(SelectionInListView new)) level:-1. |
|
5229 |
box addOkButton. |
|
5230 |
box stickAtBottomWithVariableHeight:list. |
|
5231 |
box show |
|
593 | 5232 |
" |
5233 |
||
5234 |
"Modified: 27.4.1996 / 18:34:20 / cg" |
|
5235 |
! |
|
5236 |
||
5237 |
yPosition |
|
5238 |
"return the current y position (thats where the next component |
|
5239 |
will be located)." |
|
5240 |
||
5241 |
^ yPosition |
|
120 | 5242 |
! |
5243 |
||
593 | 5244 |
yPosition:aNumber |
5245 |
"set the current y position (thats where the next component |
|
5246 |
will be located)." |
|
5247 |
||
5248 |
yPosition := aNumber. |
|
5249 |
needResize := true. |
|
5250 |
||
5251 |
" |
|
5252 |
|dialog pos| |
|
5253 |
||
5254 |
dialog := DialogBox new. |
|
5255 |
pos := dialog yPosition. |
|
5256 |
(dialog addTextLabel:'label1') width:0.5. |
|
5257 |
dialog yPosition:pos. |
|
5258 |
(dialog addTextLabel:'label2') width:0.5; left:0.5. |
|
5259 |
||
5260 |
dialog addOkButton. |
|
5261 |
dialog open. |
|
5262 |
" |
|
5263 |
||
5264 |
" |
|
5265 |
|dialog pos| |
|
5266 |
||
5267 |
dialog := DialogBox new. |
|
5268 |
pos := dialog yPosition. |
|
5269 |
#('one' 'two' 'three' 'four') |
|
5270 |
with:#(0.0 0.25 0.5 0.75) do:[:lbl :x | |
|
1401 | 5271 |
dialog yPosition:pos. |
5272 |
(dialog addComponent:(Button label:lbl) tabable:true) |
|
5273 |
width:0.25; left:x. |
|
593 | 5274 |
]. |
5275 |
||
5276 |
dialog addOkButton. |
|
5277 |
dialog open. |
|
5278 |
" |
|
5279 |
||
5280 |
"Modified: 9.2.1996 / 21:46:40 / cg" |
|
5281 |
! ! |
|
5282 |
||
5283 |
!DialogBox methodsFor:'construction-lists'! |
|
5284 |
||
2116 | 5285 |
addList:listHolder lines:nLines validation:validateionBlock |
5286 |
^ self |
|
5287 |
addListBoxOn:listHolder |
|
5288 |
withNumberOfLines:nLines |
|
5289 |
hScrollable:true |
|
5290 |
vScrollable:true |
|
5291 |
||
5292 |
"Created: / 4.2.2000 / 00:04:49 / cg" |
|
5293 |
"Modified: / 4.2.2000 / 00:06:06 / cg" |
|
5294 |
! |
|
5295 |
||
593 | 5296 |
addListBoxOn:aModel |
5297 |
"add a selectionInListView to the box. |
|
5298 |
The listViews ScrollWrapper is returned" |
|
5299 |
||
5300 |
^ self |
|
1401 | 5301 |
addListBoxOn:aModel |
5302 |
withNumberOfLines:nil |
|
5303 |
hScrollable:false |
|
5304 |
vScrollable:true. |
|
593 | 5305 |
|
5306 |
" |
|
5307 |
|dialog model listView| |
|
5308 |
||
5309 |
model := SelectionInList new. |
|
5310 |
model list:#('one' 'two' 'three' 'four'). |
|
5311 |
model selectionIndex:2. |
|
5312 |
||
5313 |
dialog := DialogBox new. |
|
5314 |
(dialog addTextLabel:'select any') adjust:#left. |
|
5315 |
||
5316 |
listView := dialog addListBoxOn:model. |
|
5317 |
||
5318 |
dialog addAbortButton; addOkButton. |
|
5319 |
dialog open. |
|
5320 |
||
655 | 5321 |
dialog accepted ifTrue:[Transcript show:'selection is:'; showCR:model selection]. |
593 | 5322 |
" |
5323 |
||
5324 |
"Modified: 27.4.1996 / 18:27:58 / cg" |
|
5325 |
! |
|
5326 |
||
5327 |
addListBoxOn:aModel class:aListViewClass |
|
5328 |
"create & add an instance of aListViewClass to the box. |
|
5329 |
The listViews ScrollWrapper is returned" |
|
5330 |
||
5331 |
^ self |
|
1401 | 5332 |
addListBoxOn:aModel |
5333 |
class:aListViewClass |
|
5334 |
withNumberOfLines:nil |
|
5335 |
hScrollable:false |
|
5336 |
vScrollable:true. |
|
593 | 5337 |
|
5338 |
"Created: 19.4.1996 / 13:06:14 / cg" |
|
5339 |
"Modified: 27.4.1996 / 18:27:53 / cg" |
|
5340 |
! |
|
5341 |
||
5342 |
addListBoxOn:aModel class:aListViewClass withNumberOfLines:numLines |
|
5343 |
"create and add an instance of aListViewClass to the box. |
|
5344 |
The list has numLines (if nonNil) number of lines shown. |
|
5345 |
The listViews ScrollWrapper is returned" |
|
5346 |
||
5347 |
^ self |
|
1401 | 5348 |
addListBoxOn:aModel |
5349 |
class:aListViewClass |
|
5350 |
withNumberOfLines:numLines |
|
5351 |
hScrollable:false |
|
5352 |
vScrollable:true. |
|
593 | 5353 |
|
5354 |
"Created: 19.4.1996 / 13:05:05 / cg" |
|
5355 |
"Modified: 27.4.1996 / 18:27:48 / cg" |
|
5356 |
! |
|
5357 |
||
5358 |
addListBoxOn:aModel class:aListViewClass withNumberOfLines:numLines hScrollable:hs vScrollable:vs |
|
766 | 5359 |
"add an instance of aListViewClass (selectionInListView) to the box. |
593 | 5360 |
The list has numLines (if nonNil) number of lines shown. |
5361 |
If scrolled, the ScrollWrapper is returned - otherwise the listView." |
|
5362 |
||
766 | 5363 |
|l| |
5364 |
||
5365 |
l := self addTextBoxOn:aModel class:aListViewClass withNumberOfLines:numLines hScrollable:hs vScrollable:vs. |
|
593 | 5366 |
l doubleClickAction:[:name | self okPressed]. |
766 | 5367 |
^ l |
593 | 5368 |
|
5369 |
" |
|
5370 |
|dialog listView| |
|
5371 |
||
5372 |
dialog := DialogBox new. |
|
5373 |
(dialog addTextLabel:'select any') adjust:#left. |
|
5374 |
||
5375 |
listView := dialog |
|
1401 | 5376 |
addListBoxOn:nil |
5377 |
class:FileSelectionList |
|
5378 |
withNumberOfLines:10 |
|
5379 |
hScrollable:false |
|
5380 |
vScrollable:false. |
|
593 | 5381 |
|
5382 |
listView directory:'/etc'. |
|
5383 |
||
5384 |
dialog addAbortButton; addOkButton. |
|
5385 |
dialog open. |
|
5386 |
||
655 | 5387 |
dialog accepted ifTrue:[Transcript show:'selection is:'; showCR:listView selectionValue]. |
593 | 5388 |
" |
5389 |
||
5390 |
"Created: 22.2.1996 / 15:40:07 / cg" |
|
5391 |
"Modified: 27.4.1996 / 18:26:15 / cg" |
|
766 | 5392 |
"Modified: 15.6.1996 / 00:31:20 / stefan" |
593 | 5393 |
! |
5394 |
||
5395 |
addListBoxOn:aModel withNumberOfLines:numLines |
|
5396 |
"add a selectionInListView to the box. |
|
5397 |
The list has numLines (if nonNil) number of lines shown. |
|
5398 |
The listViews ScrollWrapper is returned" |
|
5399 |
||
5400 |
^ self |
|
1401 | 5401 |
addListBoxOn:aModel |
5402 |
withNumberOfLines:numLines |
|
5403 |
hScrollable:false |
|
5404 |
vScrollable:true. |
|
593 | 5405 |
|
5406 |
" |
|
5407 |
|dialog model listView| |
|
5408 |
||
5409 |
model := SelectionInList new. |
|
5410 |
model list:#('one' 'two' 'three' 'four'). |
|
5411 |
model selectionIndex:2. |
|
5412 |
||
5413 |
dialog := DialogBox new. |
|
5414 |
(dialog addTextLabel:'select any') adjust:#left. |
|
5415 |
||
5416 |
listView := dialog addListBoxOn:model withNumberOfLines:3. |
|
5417 |
||
5418 |
dialog addAbortButton; addOkButton. |
|
5419 |
dialog open. |
|
5420 |
||
655 | 5421 |
dialog accepted ifTrue:[Transcript show:'selection is:'; showCR:model selection]. |
593 | 5422 |
" |
5423 |
||
5424 |
"Created: 22.2.1996 / 15:40:07 / cg" |
|
5425 |
"Modified: 27.4.1996 / 18:27:42 / cg" |
|
5426 |
! |
|
5427 |
||
5428 |
addListBoxOn:aModel withNumberOfLines:numLines hScrollable:hs vScrollable:vs |
|
5429 |
"add a selectionInListView to the box. |
|
5430 |
The list has numLines (if nonNil) number of lines shown. |
|
5431 |
If scrolled, the ScrollWrapper is returned - otherwise the listView." |
|
5432 |
||
5433 |
^ self |
|
1401 | 5434 |
addListBoxOn:aModel |
5435 |
class:SelectionInListView |
|
5436 |
withNumberOfLines:numLines |
|
5437 |
hScrollable:hs |
|
5438 |
vScrollable:vs |
|
593 | 5439 |
|
5440 |
" |
|
5441 |
|dialog model listView| |
|
5442 |
||
5443 |
model := SelectionInList new. |
|
5444 |
model list:#('one' 'two' 'three' 'four'). |
|
5445 |
model selectionIndex:2. |
|
5446 |
||
5447 |
dialog := DialogBox new. |
|
5448 |
(dialog addTextLabel:'select any') adjust:#left. |
|
5449 |
||
5450 |
listView := dialog addListBoxOn:model withNumberOfLines:3 hScrollable:true vScrollable:true. |
|
5451 |
||
5452 |
dialog addAbortButton; addOkButton. |
|
5453 |
dialog open. |
|
5454 |
||
655 | 5455 |
dialog accepted ifTrue:[Transcript show:'selection is:'; showCR:model selection]. |
593 | 5456 |
" |
5457 |
||
5458 |
" |
|
5459 |
|dialog model listView| |
|
5460 |
||
5461 |
model := SelectionInList new. |
|
5462 |
model list:#('one' 'two' 'three' 'four'). |
|
5463 |
model selectionIndex:2. |
|
5464 |
||
5465 |
dialog := DialogBox new. |
|
5466 |
(dialog addTextLabel:'select any') adjust:#left. |
|
5467 |
||
5468 |
listView := dialog addListBoxOn:model withNumberOfLines:3 hScrollable:false vScrollable:false. |
|
5469 |
||
5470 |
dialog addAbortButton; addOkButton. |
|
5471 |
dialog open. |
|
5472 |
||
655 | 5473 |
dialog accepted ifTrue:[Transcript show:'selection is:'; showCR:model selection]. |
593 | 5474 |
" |
5475 |
||
5476 |
"Created: 22.2.1996 / 15:40:07 / cg" |
|
5477 |
"Modified: 27.4.1996 / 18:26:36 / cg" |
|
5478 |
! |
|
5479 |
||
5480 |
addPopUpList:labelString on:aModel |
|
5481 |
"create a popUpList with a label on aModel and add it. |
|
5482 |
Returns the box." |
|
5483 |
||
5484 |
^ self addPopUpList:labelString on:aModel tabable:true |
|
5485 |
! |
|
5486 |
||
5487 |
addPopUpList:labelString on:aModel tabable:tabable |
|
5488 |
"create a popUpList on aModel and add it. |
|
5489 |
Returns the popUpList." |
|
5490 |
||
5491 |
|p box l| |
|
5492 |
||
5493 |
p := PopUpList on:aModel. |
|
5494 |
p resize; sizeFixed:true. |
|
5495 |
labelString notNil ifTrue:[ |
|
1401 | 5496 |
box := HorizontalPanelView new. |
5497 |
box borderWidth:0; horizontalLayout:#rightSpace. |
|
5498 |
box add:(l := Label label:labelString). |
|
5499 |
l borderWidth:0. |
|
5500 |
box add:p. |
|
593 | 5501 |
] ifFalse:[ |
1401 | 5502 |
box := p. |
593 | 5503 |
]. |
5504 |
self addComponent:box tabable:tabable tabbedComponent:p. |
|
5505 |
^ p |
|
735
2552463a8f34
place popUp at right (without extra space)
Claus Gittinger <cg@exept.de>
parents:
719
diff
changeset
|
5506 |
|
739
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
5507 |
"Modified: 31.5.1996 / 21:25:17 / cg" |
593 | 5508 |
! |
5509 |
||
5510 |
addPopUpListOn:aModel |
|
5511 |
"create a popUpList on aModel and add it. |
|
5512 |
Returns the box." |
|
5513 |
||
5514 |
^ self addPopUpList:nil on:aModel tabable:true |
|
5515 |
! |
|
5516 |
||
5517 |
addPopUpListOn:aModel tabable:tabable |
|
5518 |
"create a popUpList on aModel and add it. |
|
5519 |
Returns the popUpList." |
|
5520 |
||
5521 |
^ self addPopUpList:nil on:aModel tabable:tabable |
|
766 | 5522 |
! |
5523 |
||
5524 |
addTextBoxOn:aModel class:aListViewClass withNumberOfLines:numLines hScrollable:hs vScrollable:vs |
|
5525 |
"add an instance of aListViewClass to the box. |
|
5526 |
The list has numLines (if nonNil) number of lines shown. |
|
5527 |
If scrolled, the ScrollWrapper is returned - otherwise the listView." |
|
5528 |
||
5529 |
|l scr h dH| |
|
5530 |
||
5531 |
l := aListViewClass new. |
|
5532 |
l model:aModel. |
|
5533 |
||
877 | 5534 |
(vs or:[hs]) ifTrue:[ |
1401 | 5535 |
hs ifTrue:[ |
5536 |
scr := HVScrollableView forView:l miniScrollerH:true . |
|
5537 |
] ifFalse:[ |
|
5538 |
scr := ScrollableView forView:l |
|
5539 |
]. |
|
5540 |
scr resize. |
|
5541 |
"/ Transcript show:scr height; show:' '; showCR:l height. |
|
5542 |
dH := scr height - l height. |
|
766 | 5543 |
] ifFalse:[ |
1401 | 5544 |
l level:-1. |
5545 |
scr := l. |
|
5546 |
dH := 0. |
|
766 | 5547 |
]. |
5548 |
||
5549 |
numLines notNil ifTrue:[ |
|
1401 | 5550 |
h := l heightForLines:numLines. |
766 | 5551 |
] ifFalse:[ |
1401 | 5552 |
h := l preferredExtent y |
766 | 5553 |
]. |
5554 |
self addComponent:scr withHeight:(h + dH). |
|
5555 |
^ scr |
|
5556 |
||
5557 |
" |
|
5558 |
|dialog listView| |
|
5559 |
||
5560 |
dialog := DialogBox new. |
|
5561 |
(dialog addTextLabel:'select any') adjust:#left. |
|
5562 |
||
5563 |
listView := dialog |
|
1401 | 5564 |
addTextBoxOn:nil |
5565 |
class:EditTextView |
|
5566 |
withNumberOfLines:10 |
|
5567 |
hScrollable:true |
|
5568 |
vScrollable:true. |
|
766 | 5569 |
|
5570 |
||
5571 |
dialog addAbortButton; addOkButton. |
|
5572 |
dialog open. |
|
5573 |
||
5574 |
dialog accepted ifTrue:[Transcript show:'selection is:'; showCR:listView contents]. |
|
5575 |
" |
|
5576 |
||
5577 |
"Created: 14.6.1996 / 23:33:47 / stefan" |
|
877 | 5578 |
"Modified: 8.11.1996 / 15:31:15 / cg" |
593 | 5579 |
! ! |
5580 |
||
5581 |
!DialogBox methodsFor:'construction-rows & columns'! |
|
5582 |
||
130 | 5583 |
addColumn:aRow fromX:leftX toX:rightX collect:aBlock |
5584 |
"add some elements in a vertical column. |
|
5585 |
Equally space elements as returned from aBlock." |
|
5586 |
||
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5587 |
self |
1401 | 5588 |
addColumn:aRow |
5589 |
fromX:leftX toX:rightX |
|
5590 |
collect:aBlock |
|
5591 |
tabable:false |
|
130 | 5592 |
|
5593 |
" |
|
5594 |
|dialog| |
|
5595 |
||
5596 |
dialog := Dialog new. |
|
5597 |
dialog |
|
1401 | 5598 |
addColumn:#('label1' 'label2' 'lbl3' 'l4' 'label5') |
5599 |
fromX:0.0 |
|
5600 |
toX:1.0 |
|
5601 |
collect:[:label | Label label:label]. |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5602 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5603 |
dialog addOkButton. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5604 |
dialog open. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5605 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5606 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5607 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5608 |
|dialog| |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5609 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5610 |
dialog := Dialog new. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5611 |
dialog |
1401 | 5612 |
addColumn:#('label1' 'label2' 'label3' 'label4' 'label5') |
5613 |
fromX:0.25 |
|
5614 |
toX:0.75 |
|
5615 |
collect:[:label | (Label label:label) adjust:#left]. |
|
130 | 5616 |
|
5617 |
dialog addOkButton. |
|
5618 |
dialog open. |
|
5619 |
" |
|
5620 |
||
5621 |
" |
|
5622 |
|dialog y| |
|
5623 |
||
5624 |
dialog := Dialog new. |
|
5625 |
y := dialog yPosition. |
|
5626 |
dialog |
|
1401 | 5627 |
addColumn:#('a1' 'b1' 'c1' 'd1') |
5628 |
fromX:0 |
|
5629 |
toX:(1/3) |
|
5630 |
collect:[:label | Label label:label]. |
|
130 | 5631 |
|
5632 |
dialog yPosition:y. |
|
5633 |
dialog |
|
1401 | 5634 |
addColumn:#('a2' 'b2' 'c2' 'd2') |
5635 |
fromX:(1/3) |
|
5636 |
toX:(2/3) |
|
5637 |
collect:[:label | Label label:label]. |
|
130 | 5638 |
|
5639 |
dialog yPosition:y. |
|
5640 |
dialog |
|
1401 | 5641 |
addColumn:#('a3' 'b3' 'c3' 'd3') |
5642 |
fromX:(2/3) |
|
5643 |
toX:1 |
|
5644 |
collect:[:label | Label label:label]. |
|
130 | 5645 |
|
5646 |
dialog addOkButton. |
|
5647 |
dialog open. |
|
5648 |
" |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5649 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5650 |
"Modified: 9.2.1996 / 22:22:12 / cg" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5651 |
! |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5652 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5653 |
addColumn:aRow fromX:leftX toX:rightX collect:aBlock tabable:tabable |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5654 |
"add some elements in a vertical column. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5655 |
Equally space elements as returned from aBlock." |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5656 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5657 |
self |
1401 | 5658 |
addColumn:aRow |
5659 |
fromX:leftX toX:rightX |
|
5660 |
collect:aBlock |
|
5661 |
tabable:tabable |
|
5662 |
horizontalLayout:#fitSpace |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5663 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5664 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5665 |
|dialog y values| |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5666 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5667 |
values := (1 to:4) collect:[:dummy | '' asValue]. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5668 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5669 |
dialog := Dialog new. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5670 |
y := dialog yPosition. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5671 |
dialog |
1401 | 5672 |
addColumn:#('one' 'two' 'three' 'four') |
5673 |
fromX:0 |
|
5674 |
toX:0.3 |
|
5675 |
collect:[:label | Label label:label]. |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5676 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5677 |
dialog yPosition:y. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5678 |
dialog |
1401 | 5679 |
addColumn:values |
5680 |
fromX:0.3 |
|
5681 |
toX:1.0 |
|
5682 |
collect:[:value | EditField on:value] |
|
5683 |
tabable:true. |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5684 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5685 |
dialog addOkButton. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5686 |
dialog open. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5687 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5688 |
dialog accepted ifTrue:[ |
1401 | 5689 |
Transcript showCR:(values collect:[:holder | holder value]) |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5690 |
] |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5691 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5692 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5693 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5694 |
|dialog y values| |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5695 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5696 |
values := #(true true false false false true false true) collect:[:val | val asValue]. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5697 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5698 |
dialog := Dialog new. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5699 |
y := dialog yPosition. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5700 |
dialog |
1401 | 5701 |
addColumn:(1 to:4) |
5702 |
fromX:0 |
|
5703 |
toX:0.5 |
|
5704 |
collect:[:idx | CheckToggle on:(values at:idx)] |
|
5705 |
tabable:true |
|
5706 |
horizontalLayout:#center. |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5707 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5708 |
dialog yPosition:y. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5709 |
dialog |
1401 | 5710 |
addColumn:(5 to:8) |
5711 |
fromX:0.5 |
|
5712 |
toX:1.0 |
|
5713 |
collect:[:idx | CheckToggle on:(values at:idx)] |
|
5714 |
tabable:true |
|
5715 |
horizontalLayout:#center. |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5716 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5717 |
dialog addOkButton. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5718 |
dialog open. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5719 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5720 |
dialog accepted ifTrue:[ |
1401 | 5721 |
Transcript showCR:(values collect:[:holder | holder value]) |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5722 |
] |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5723 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5724 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5725 |
"Created: 9.2.1996 / 21:51:47 / cg" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5726 |
"Modified: 9.2.1996 / 22:22:02 / cg" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5727 |
! |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5728 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5729 |
addColumn:aRow fromX:leftX toX:rightX collect:aBlock tabable:tabable horizontalLayout:hLayout |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5730 |
"add some elements in a vertical column. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5731 |
Equally space elements as returned from aBlock." |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5732 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5733 |
|helper component| |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5734 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5735 |
helper := VerticalPanelView new. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5736 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5737 |
aRow do:[:el | |
1401 | 5738 |
component := aBlock value:el. |
5739 |
helper add:component. |
|
5740 |
component resize. |
|
5741 |
tabable ifTrue:[self makeTabable:component]. |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5742 |
]. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5743 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5744 |
helper resize. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5745 |
self addComponent:helper. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5746 |
width < helper preferredExtent x ifTrue:[ |
1401 | 5747 |
self width:helper preferredExtent x. |
5748 |
"/ Transcript show:'w now: '; showCR:helper preferredExtent x |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5749 |
]. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5750 |
helper horizontalLayout:hLayout. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5751 |
helper left:leftX asFloat; |
1401 | 5752 |
right:rightX asFloat; |
5753 |
leftInset:leftIndent; |
|
5754 |
rightInset:rightIndent. |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5755 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5756 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5757 |
|dialog y values| |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5758 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5759 |
values := (1 to:4) collect:[:dummy | '' asValue]. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5760 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5761 |
dialog := Dialog new. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5762 |
y := dialog yPosition. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5763 |
dialog |
1401 | 5764 |
addColumn:#('one' 'two' 'three' 'four') |
5765 |
fromX:0 |
|
5766 |
toX:0.3 |
|
5767 |
collect:[:label | Label label:label]. |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5768 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5769 |
dialog yPosition:y. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5770 |
dialog |
1401 | 5771 |
addColumn:values |
5772 |
fromX:0.3 |
|
5773 |
toX:1.0 |
|
5774 |
collect:[:value | EditField on:value] |
|
5775 |
tabable:true. |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5776 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5777 |
dialog addOkButton. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5778 |
dialog open. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5779 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5780 |
dialog accepted ifTrue:[ |
1401 | 5781 |
Transcript showCR:(values collect:[:holder | holder value]) |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5782 |
] |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5783 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5784 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5785 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5786 |
|dialog y values| |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5787 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5788 |
values := #(true true false false false true false true) collect:[:val | val asValue]. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5789 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5790 |
dialog := Dialog new. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5791 |
y := dialog yPosition. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5792 |
dialog |
1401 | 5793 |
addColumn:(1 to:4) |
5794 |
fromX:0 |
|
5795 |
toX:0.5 |
|
5796 |
collect:[:idx | CheckToggle on:(values at:idx)]. |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5797 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5798 |
dialog yPosition:y. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5799 |
dialog |
1401 | 5800 |
addColumn:(5 to:8) |
5801 |
fromX:0.5 |
|
5802 |
toX:1.0 |
|
5803 |
collect:[:idx | CheckToggle on:(values at:idx)] |
|
5804 |
tabable:true. |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5805 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5806 |
dialog addOkButton. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5807 |
dialog open. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5808 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5809 |
dialog accepted ifTrue:[ |
1401 | 5810 |
Transcript showCR:(values collect:[:holder | holder value]) |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5811 |
] |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5812 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5813 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5814 |
"Modified: 9.2.1996 / 22:02:22 / cg" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5815 |
"Created: 9.2.1996 / 22:20:31 / cg" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5816 |
! |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5817 |
|
130 | 5818 |
addRow:aCol fromX:leftX toX:rightX collect:aBlock |
5819 |
"add some elements in a horizontal row. |
|
5820 |
Equally space elements as returned from aBlock. |
|
5821 |
Advance y." |
|
5822 |
||
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5823 |
self |
1401 | 5824 |
addRow:aCol |
5825 |
fromX:leftX toX:rightX |
|
5826 |
collect:aBlock |
|
5827 |
tabable:true |
|
5828 |
horizontalLayout:#spread |
|
130 | 5829 |
|
5830 |
" |
|
5831 |
|dialog| |
|
5832 |
||
5833 |
dialog := Dialog new. |
|
5834 |
dialog |
|
1401 | 5835 |
addRow:#('a' 'b' 'c' 'd') |
5836 |
fromX:0 |
|
5837 |
toX:1 |
|
5838 |
collect:[:label | Label label:label]. |
|
130 | 5839 |
|
5840 |
dialog addOkButton. |
|
5841 |
dialog open. |
|
5842 |
" |
|
5843 |
||
5844 |
" |
|
5845 |
|dialog| |
|
5846 |
||
5847 |
dialog := Dialog new. |
|
5848 |
dialog |
|
1401 | 5849 |
addRow:#('a1' 'b1' 'c1' 'd1') |
5850 |
fromX:0 |
|
5851 |
toX:1 |
|
5852 |
collect:[:label | Label label:label]. |
|
130 | 5853 |
|
5854 |
dialog |
|
1401 | 5855 |
addRow:#('a2' 'b2' 'c2' 'd2') |
5856 |
fromX:0 |
|
5857 |
toX:0.5 |
|
5858 |
collect:[:label | Label label:label]. |
|
130 | 5859 |
|
5860 |
dialog |
|
1401 | 5861 |
addRow:#('a3' 'b3' 'c3' 'd3') |
5862 |
fromX:0.5 |
|
5863 |
toX:1 |
|
5864 |
collect:[:label | Label label:label]. |
|
130 | 5865 |
|
5866 |
dialog addOkButton. |
|
5867 |
dialog open. |
|
5868 |
" |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5869 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5870 |
"Modified: 9.2.1996 / 22:25:16 / cg" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5871 |
! |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5872 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5873 |
addRow:aCol fromX:leftX toX:rightX collect:aBlock tabable:tabable |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5874 |
"add some elements in a horizontal row. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5875 |
Equally space elements as returned from aBlock. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5876 |
Advance y." |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5877 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5878 |
self |
1401 | 5879 |
addRow:aCol |
5880 |
fromX:leftX toX:rightX |
|
5881 |
collect:aBlock |
|
5882 |
tabable:tabable |
|
5883 |
horizontalLayout:#spread |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5884 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5885 |
"Created: 9.2.1996 / 22:25:35 / cg" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5886 |
! |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5887 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5888 |
addRow:aCol fromX:leftX toX:rightX collect:aBlock tabable:tabable horizontalLayout:hLayout |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5889 |
"add some elements in a horizontal row. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5890 |
Equally space elements as returned from aBlock. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5891 |
Advance y." |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5892 |
|
739
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
5893 |
^ self |
1401 | 5894 |
addRow:aCol |
5895 |
fromX:leftX toX:rightX |
|
5896 |
collect:aBlock |
|
5897 |
tabable:tabable |
|
5898 |
horizontalLayout:hLayout |
|
5899 |
verticalLayout:#fit |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5900 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5901 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5902 |
|dialog| |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5903 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5904 |
dialog := Dialog new. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5905 |
dialog |
1401 | 5906 |
addRow:#('a' 'b' 'c' 'd') |
5907 |
fromX:0 |
|
5908 |
toX:1 |
|
5909 |
collect:[:label | Label label:label] |
|
5910 |
tabable:false |
|
5911 |
horizontalLayout:#fit. |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5912 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5913 |
dialog addOkButton. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5914 |
dialog open. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5915 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5916 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5917 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5918 |
|dialog| |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5919 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5920 |
dialog := Dialog new. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5921 |
dialog |
1401 | 5922 |
addRow:#('one' 'two' 'three' 'four') |
5923 |
fromX:0 |
|
5924 |
toX:1 |
|
5925 |
collect:[:label | Button label:label] |
|
5926 |
tabable:false |
|
5927 |
horizontalLayout:#fit. |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5928 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5929 |
dialog addOkButton. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5930 |
dialog open. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5931 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5932 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5933 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5934 |
|dialog| |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5935 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5936 |
dialog := Dialog new. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5937 |
dialog |
1401 | 5938 |
addRow:#('a1' 'b1' 'c1' 'd1') |
5939 |
fromX:0 |
|
5940 |
toX:1 |
|
5941 |
collect:[:label | Label label:label]. |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5942 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5943 |
dialog |
1401 | 5944 |
addRow:#('a2' 'b2' 'c2' 'd2') |
5945 |
fromX:0 |
|
5946 |
toX:0.5 |
|
5947 |
collect:[:label | Label label:label]. |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5948 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5949 |
dialog |
1401 | 5950 |
addRow:#('a3' 'b3' 'c3' 'd3') |
5951 |
fromX:0.5 |
|
5952 |
toX:1 |
|
5953 |
collect:[:label | Label label:label]. |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5954 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5955 |
dialog addOkButton. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5956 |
dialog open. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5957 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5958 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5959 |
"Created: 9.2.1996 / 22:24:31 / cg" |
739
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
5960 |
"Modified: 31.5.1996 / 20:46:00 / cg" |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
5961 |
! |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
5962 |
|
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
5963 |
addRow:aCol fromX:leftX toX:rightX collect:aBlock tabable:tabable horizontalLayout:hLayout verticalLayout:vLayout |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
5964 |
"add some elements in a horizontal row. |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
5965 |
Equally space elements as returned from aBlock. |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
5966 |
Advance y." |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
5967 |
|
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
5968 |
|helper component| |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
5969 |
|
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
5970 |
helper := HorizontalPanelView new. |
792 | 5971 |
helper borderWidth:0. |
739
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
5972 |
|
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
5973 |
aCol do:[:el | |
1401 | 5974 |
component := aBlock value:el. |
5975 |
component resize. |
|
5976 |
helper add:component. |
|
5977 |
tabable ifTrue:[self makeTabable:component] |
|
739
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
5978 |
]. |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
5979 |
|
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
5980 |
helper resize. |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
5981 |
self addComponent:helper. |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
5982 |
|
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
5983 |
width < helper preferredExtent x ifTrue:[ |
1401 | 5984 |
self width:helper preferredExtent x. |
5985 |
"/ Transcript show:'w now: '; showCR:helper preferredExtent x |
|
739
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
5986 |
]. |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
5987 |
hLayout notNil ifTrue:[ |
1401 | 5988 |
helper horizontalLayout:hLayout. |
739
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
5989 |
]. |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
5990 |
vLayout notNil ifTrue:[ |
1401 | 5991 |
helper verticalLayout:vLayout. |
739
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
5992 |
]. |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
5993 |
helper left:leftX asFloat; |
1401 | 5994 |
right:rightX asFloat. |
739
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
5995 |
|
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
5996 |
" |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
5997 |
|dialog| |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
5998 |
|
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
5999 |
dialog := Dialog new. |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
6000 |
dialog |
1401 | 6001 |
addRow:#('a' 'b' 'c' 'd') |
6002 |
fromX:0 |
|
6003 |
toX:1 |
|
6004 |
collect:[:label | Label label:label] |
|
6005 |
tabable:false |
|
6006 |
horizontalLayout:#fit. |
|
739
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
6007 |
|
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
6008 |
dialog addOkButton. |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
6009 |
dialog open. |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
6010 |
" |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
6011 |
|
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
6012 |
" |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
6013 |
|dialog| |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
6014 |
|
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
6015 |
dialog := Dialog new. |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
6016 |
dialog |
1401 | 6017 |
addRow:#('one' 'two' 'three' 'four') |
6018 |
fromX:0 |
|
6019 |
toX:1 |
|
6020 |
collect:[:label | Button label:label] |
|
6021 |
tabable:false |
|
6022 |
horizontalLayout:#fit. |
|
739
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
6023 |
|
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
6024 |
dialog addOkButton. |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
6025 |
dialog open. |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
6026 |
" |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
6027 |
|
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
6028 |
" |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
6029 |
|dialog| |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
6030 |
|
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
6031 |
dialog := Dialog new. |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
6032 |
dialog |
1401 | 6033 |
addRow:#('a1' 'b1' 'c1' 'd1') |
6034 |
fromX:0 |
|
6035 |
toX:1 |
|
6036 |
collect:[:label | Label label:label]. |
|
739
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
6037 |
|
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
6038 |
dialog |
1401 | 6039 |
addRow:#('a2' 'b2' 'c2' 'd2') |
6040 |
fromX:0 |
|
6041 |
toX:0.5 |
|
6042 |
collect:[:label | Label label:label]. |
|
739
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
6043 |
|
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
6044 |
dialog |
1401 | 6045 |
addRow:#('a3' 'b3' 'c3' 'd3') |
6046 |
fromX:0.5 |
|
6047 |
toX:1 |
|
6048 |
collect:[:label | Label label:label]. |
|
739
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
6049 |
|
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
6050 |
dialog addOkButton. |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
6051 |
dialog open. |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
6052 |
" |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
6053 |
|
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
6054 |
"Created: 31.5.1996 / 20:45:31 / cg" |
792 | 6055 |
"Modified: 17.7.1996 / 12:06:08 / cg" |
76 | 6056 |
! ! |
6057 |
||
551
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
6058 |
!DialogBox methodsFor:'explicit focus control'! |
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
6059 |
|
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
6060 |
focusOnOk |
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
6061 |
windowGroup focusView:okButton |
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
6062 |
|
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
6063 |
"Modified: 19.4.1996 / 16:57:58 / cg" |
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
6064 |
! ! |
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
6065 |
|
76 | 6066 |
!DialogBox methodsFor:'initialization'! |
6067 |
||
197 | 6068 |
focusSequence |
6069 |
"return the elements through which we can step via |
|
6070 |
NextField/PreviousField keys. |
|
6071 |
Here we return all tabable fields followed by all buttons in |
|
6072 |
the panel." |
|
6073 |
||
6074 |
|fields buttons| |
|
6075 |
||
6076 |
tabableElements isNil ifTrue:[ |
|
1843 | 6077 |
fields := #() |
197 | 6078 |
] ifFalse:[ |
1843 | 6079 |
fields := tabableElements |
197 | 6080 |
]. |
6081 |
buttonPanel notNil ifTrue:[ |
|
1843 | 6082 |
buttons := buttonPanel subViews. |
6083 |
buttons notNil ifTrue:[ |
|
6084 |
fields := fields , buttonPanel subViews |
|
6085 |
] |
|
197 | 6086 |
]. |
1843 | 6087 |
^ fields "/ select:[:aField | aField realized and:[aField enabled]]. |
739
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
6088 |
|
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
6089 |
"Modified: 31.5.1996 / 22:05:58 / cg" |
197 | 6090 |
! |
6091 |
||
76 | 6092 |
initialize |
6093 |
|mm| |
|
6094 |
||
6095 |
super initialize. |
|
6096 |
||
573 | 6097 |
"/ label := 'Dialog'. |
948 | 6098 |
acceptValue := ValueHolder newBoolean. |
76 | 6099 |
|
6100 |
mm := ViewSpacing. |
|
6101 |
||
6102 |
acceptReturnAsOK := true. |
|
125 | 6103 |
acceptOnLeave := true. |
1757 | 6104 |
focusToOKOnLeave := DefaultFocusToOKOnLeave. |
280
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
6105 |
hideOnAccept := true. |
469
1d86f97ab2e5
autoAccept as default; configurable
Claus Gittinger <cg@exept.de>
parents:
436
diff
changeset
|
6106 |
autoAccept := true. |
76 | 6107 |
|
6108 |
buttonPanel := HorizontalPanelView in:self. |
|
118 | 6109 |
buttonPanel |
1757 | 6110 |
origin:(0.0 @ 1.0) corner:(1.0 @ 1.0); |
6111 |
bottomInset:mm; |
|
6112 |
topInset:(font height + mm * 2) negated; |
|
6113 |
borderWidth:0; |
|
6114 |
horizontalLayout:#spread. |
|
118 | 6115 |
|
122 | 6116 |
yPosition := ViewSpacing. |
312
008267b920d9
allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
6117 |
leftIndent := rightIndent := (ViewSpacing // 2). |
310
4bbc8deffc8c
allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents:
307
diff
changeset
|
6118 |
needResize := true. |
76 | 6119 |
|
6120 |
" |
|
6121 |
|b| |
|
6122 |
b := DialogBox new. |
|
118 | 6123 |
b addAbortButton; |
6124 |
addOkButton; |
|
6125 |
showAtPointer |
|
76 | 6126 |
" |
6127 |
" |
|
6128 |
|b| |
|
6129 |
b := DialogBox new. |
|
118 | 6130 |
b addOkButton; |
6131 |
showAtPointer |
|
6132 |
" |
|
76 | 6133 |
" |
118 | 6134 |
|b| |
6135 |
b := DialogBox new. |
|
6136 |
b addTextLabel:'hello world'; |
|
6137 |
addOkButton; |
|
6138 |
showAtPointer |
|
6139 |
" |
|
6140 |
" |
|
6141 |
|b| |
|
6142 |
b := DialogBox new. |
|
6143 |
b addTextLabel:'hello world'; |
|
6144 |
addVerticalSpace:50; |
|
6145 |
addOkButton; |
|
6146 |
showAtPointer |
|
6147 |
" |
|
310
4bbc8deffc8c
allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents:
307
diff
changeset
|
6148 |
|
1614 | 6149 |
"Modified: / 23.12.1997 / 10:05:24 / md" |
6150 |
"Modified: / 27.7.1998 / 20:16:37 / cg" |
|
76 | 6151 |
! |
6152 |
||
6153 |
reAdjustGeometry |
|
6154 |
"sent late in snapin processing - gives me a chance |
|
6155 |
to resize for changed font dimensions." |
|
6156 |
||
6157 |
super reAdjustGeometry. |
|
6158 |
okButton notNil ifTrue:[okButton resize]. |
|
6159 |
abortButton notNil ifTrue:[abortButton resize]. |
|
6160 |
self resize |
|
6161 |
! ! |
|
6162 |
||
197 | 6163 |
!DialogBox methodsFor:'private'! |
6164 |
||
6165 |
basicAddComponent:aComponent |
|
6166 |
"add a component, dont change its size" |
|
6167 |
||
6168 |
addedComponents isNil ifTrue:[ |
|
6169 |
addedComponents := OrderedCollection new. |
|
6170 |
]. |
|
6171 |
addedComponents add:aComponent. |
|
6172 |
self addSubView:aComponent. |
|
6173 |
! |
|
6174 |
||
6175 |
hideAndEvaluate:aBlock |
|
6176 |
"if I am modal, make myself invisible and evaluate aBlock. |
|
6177 |
If nonModal, stay up, but also evaluate the block." |
|
6178 |
||
6179 |
(windowGroup notNil and:[windowGroup isModal]) ifTrue:[ |
|
6180 |
self hide. |
|
6181 |
]. |
|
6182 |
aBlock notNil ifTrue:[aBlock value] |
|
6183 |
||
6184 |
"Modified: 5.9.1995 / 19:06:33 / claus" |
|
6185 |
! |
|
6186 |
||
2116 | 6187 |
preOpen |
6188 |
||
6189 |
"Created: / 4.2.2000 / 00:10:48 / cg" |
|
6190 |
! |
|
6191 |
||
197 | 6192 |
realize |
6193 |
"if any inputFields where added, activate the first one" |
|
6194 |
||
1877
a46bf520f9c6
realize first, then assign focus
Claus Gittinger <cg@exept.de>
parents:
1843
diff
changeset
|
6195 |
super realize. |
197 | 6196 |
inputFieldGroup notNil ifTrue:[ |
1646 | 6197 |
inputFieldGroup activateFirstIfNoCurrent |
197 | 6198 |
]. |
1646 | 6199 |
|
6200 |
"Modified: / 13.8.1998 / 21:22:40 / cg" |
|
310
4bbc8deffc8c
allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents:
307
diff
changeset
|
6201 |
! |
4bbc8deffc8c
allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents:
307
diff
changeset
|
6202 |
|
4bbc8deffc8c
allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents:
307
diff
changeset
|
6203 |
resize |
4bbc8deffc8c
allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents:
307
diff
changeset
|
6204 |
needResize ifTrue:[ |
314
705185e7001d
no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents:
312
diff
changeset
|
6205 |
needResize := false. |
705185e7001d
no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents:
312
diff
changeset
|
6206 |
super resize |
310
4bbc8deffc8c
allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents:
307
diff
changeset
|
6207 |
] |
4bbc8deffc8c
allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents:
307
diff
changeset
|
6208 |
|
4bbc8deffc8c
allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents:
307
diff
changeset
|
6209 |
"Created: 27.1.1996 / 17:22:33 / cg" |
4bbc8deffc8c
allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents:
307
diff
changeset
|
6210 |
"Modified: 27.1.1996 / 18:25:40 / cg" |
197 | 6211 |
! ! |
6212 |
||
120 | 6213 |
!DialogBox methodsFor:'queries'! |
118 | 6214 |
|
121 | 6215 |
accepted |
128 | 6216 |
"after the box has closed: |
6217 |
return true if accepted, false if canceled" |
|
125 | 6218 |
|
128 | 6219 |
^ acceptValue value |
121 | 6220 |
! |
6221 |
||
2116 | 6222 |
interfaceSpecFor:aSelector |
6223 |
"return an interface spec. |
|
6224 |
Notice - Dialog should be moved under AppModel so this becomes obsolete." |
|
6225 |
||
6226 |
^ UISpecification from:(self perform:aSelector) |
|
6227 |
||
6228 |
"Modified: / 3.2.2000 / 23:59:16 / cg" |
|
6229 |
! |
|
6230 |
||
120 | 6231 |
positionOffset |
6232 |
"return the delta, by which the box should be displayed |
|
953
050fba15277a
DialogBoxes positionOffset now handles all common cases
Claus Gittinger <cg@exept.de>
parents:
950
diff
changeset
|
6233 |
from the mouse pointer. Here, an offset is returned, which |
050fba15277a
DialogBoxes positionOffset now handles all common cases
Claus Gittinger <cg@exept.de>
parents:
950
diff
changeset
|
6234 |
makes the center of the first return-Button in the panel |
050fba15277a
DialogBoxes positionOffset now handles all common cases
Claus Gittinger <cg@exept.de>
parents:
950
diff
changeset
|
6235 |
appear under the cursor. If there is no such button, |
050fba15277a
DialogBoxes positionOffset now handles all common cases
Claus Gittinger <cg@exept.de>
parents:
950
diff
changeset
|
6236 |
use my superclasses offset." |
050fba15277a
DialogBoxes positionOffset now handles all common cases
Claus Gittinger <cg@exept.de>
parents:
950
diff
changeset
|
6237 |
|
050fba15277a
DialogBoxes positionOffset now handles all common cases
Claus Gittinger <cg@exept.de>
parents:
950
diff
changeset
|
6238 |
|idx butt buttons| |
050fba15277a
DialogBoxes positionOffset now handles all common cases
Claus Gittinger <cg@exept.de>
parents:
950
diff
changeset
|
6239 |
|
050fba15277a
DialogBoxes positionOffset now handles all common cases
Claus Gittinger <cg@exept.de>
parents:
950
diff
changeset
|
6240 |
buttonPanel notNil ifTrue:[ |
1401 | 6241 |
buttons := buttonPanel subViews. |
6242 |
buttons size > 0 ifTrue:[ |
|
6243 |
idx := buttons findFirst:[:b | b isReturnButton]. |
|
6244 |
idx ~~ 0 ifTrue:[ |
|
6245 |
butt := buttons at:idx. |
|
6246 |
||
6247 |
"get our size (preferredExtent) and compute |
|
6248 |
origin and extent of buttonPanel and okButton. |
|
6249 |
This is normally done on view realization." |
|
6250 |
||
6251 |
self resize. |
|
6252 |
buttonPanel pixelOrigin:buttonPanel computeOrigin. |
|
6253 |
buttonPanel pixelExtent:buttonPanel computeExtent. |
|
6254 |
buttonPanel setChildPositionsIfChanged. |
|
6255 |
||
6256 |
^ (butt originRelativeTo:self) + (butt extent // 2) |
|
6257 |
] |
|
6258 |
] |
|
118 | 6259 |
]. |
913 | 6260 |
|
953
050fba15277a
DialogBoxes positionOffset now handles all common cases
Claus Gittinger <cg@exept.de>
parents:
950
diff
changeset
|
6261 |
^ super positionOffset |
912
310c4970e613
Fix #positionOffset to show 'senders' box with cursor on ok-button.
Stefan Vogel <sv@exept.de>
parents:
884
diff
changeset
|
6262 |
|
913 | 6263 |
"Modified: 3.1.1997 / 10:41:58 / stefan" |
953
050fba15277a
DialogBoxes positionOffset now handles all common cases
Claus Gittinger <cg@exept.de>
parents:
950
diff
changeset
|
6264 |
"Modified: 16.1.1997 / 22:00:23 / cg" |
118 | 6265 |
! |
6266 |
||
130 | 6267 |
preferredExtent |
132 | 6268 |
"return my preferred extent. |
6269 |
That is the max component width, or my current width (default); |
|
6270 |
whichever is larger, by the sum of the components heights." |
|
118 | 6271 |
|
120 | 6272 |
|w h p| |
118 | 6273 |
|
797 | 6274 |
"/ If I have an explicit preferredExtent .. |
6275 |
||
713
0c38ad51016d
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
680
diff
changeset
|
6276 |
preferredExtent notNil ifTrue:[ |
1401 | 6277 |
^ preferredExtent |
713
0c38ad51016d
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
680
diff
changeset
|
6278 |
]. |
0c38ad51016d
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
680
diff
changeset
|
6279 |
|
120 | 6280 |
addedComponents notNil ifTrue:[ |
1401 | 6281 |
w := addedComponents |
6282 |
inject:0 |
|
6283 |
into:[:max :element | |
|
6284 |
|eExt prefWidth scale rel relX| |
|
6285 |
||
6286 |
prefWidth := element preferredExtent x. |
|
6287 |
||
6288 |
"/ special (for your convenience) |
|
6289 |
"/ if the element has been added with a relative width, |
|
6290 |
"/ scale it to get at least its preferred width |
|
6291 |
||
6292 |
(rel := element relativeExtent) notNil ifTrue:[ |
|
6293 |
relX := rel x. |
|
6294 |
(relX isNil or:[relX isInteger]) ifFalse:[ |
|
6295 |
prefWidth := (prefWidth * (1 / relX)) rounded |
|
6296 |
]. |
|
6297 |
]. |
|
6298 |
eExt := prefWidth + (element borderWidth * 2). "/ max:element extent x. |
|
6299 |
max max:(eExt + element leftInset + element rightInset)]. |
|
120 | 6300 |
] ifFalse:[ |
1401 | 6301 |
w := super preferredExtent x. |
120 | 6302 |
]. |
132 | 6303 |
w := w max:width. |
310
4bbc8deffc8c
allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents:
307
diff
changeset
|
6304 |
h := yPosition + ViewSpacing. |
118 | 6305 |
|
130 | 6306 |
buttonPanel subViews size ~~ 0 ifTrue:[ |
1401 | 6307 |
p := buttonPanel preferredExtent. |
6308 |
w := w max:p x. |
|
6309 |
h := h |
|
6310 |
+ p y |
|
6311 |
+ ViewSpacing. |
|
120 | 6312 |
]. |
118 | 6313 |
|
120 | 6314 |
"/ okButton isNil ifTrue:[ |
130 | 6315 |
"/ ^ super preferredExtent |
120 | 6316 |
"/ ]. |
130 | 6317 |
"/ p := buttonPanel preferredExtent. |
120 | 6318 |
"/ w := p x. |
6319 |
"/ h := ViewSpacing |
|
6320 |
"/ + p y |
|
6321 |
"/ + ViewSpacing. |
|
6322 |
"/ |
|
6323 |
^ w @ h |
|
310
4bbc8deffc8c
allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents:
307
diff
changeset
|
6324 |
|
797 | 6325 |
"Modified: 19.7.1996 / 20:43:52 / cg" |
310
4bbc8deffc8c
allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents:
307
diff
changeset
|
6326 |
! ! |
4bbc8deffc8c
allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents:
307
diff
changeset
|
6327 |
|
197 | 6328 |
!DialogBox methodsFor:'user actions'! |
76 | 6329 |
|
197 | 6330 |
abortPressed |
6331 |
"sent by the cancel button; user pressed abort button |
|
6332 |
- hide myself and evaluate okAction" |
|
121 | 6333 |
|
197 | 6334 |
abortButton turnOffWithoutRedraw. |
6335 |
acceptValue value:false. |
|
121 | 6336 |
|
197 | 6337 |
"/ actually, only hides if I have been opened modal |
6338 |
self hideAndEvaluate:abortAction |
|
121 | 6339 |
! |
6340 |
||
197 | 6341 |
doAccept |
6342 |
"let all components accept (i.e. update their model from the values), |
|
6343 |
then set my accept value to true. |
|
6344 |
This is confusing: this method was originally called #accept, |
|
6345 |
but renamed for compatibility with ST-80, where #accept returns the |
|
6346 |
accept-valueHolder (which looks like a bad name to me ...)." |
|
76 | 6347 |
|
469
1d86f97ab2e5
autoAccept as default; configurable
Claus Gittinger <cg@exept.de>
parents:
436
diff
changeset
|
6348 |
autoAccept ifTrue:[ |
1401 | 6349 |
addedComponents notNil ifTrue:[ |
6350 |
addedComponents do:[:aComponent | |
|
6351 |
(aComponent respondsTo:#accept) ifTrue:[ |
|
6352 |
aComponent accept |
|
6353 |
] |
|
6354 |
] |
|
6355 |
]. |
|
197 | 6356 |
]. |
6357 |
acceptValue value:true. |
|
469
1d86f97ab2e5
autoAccept as default; configurable
Claus Gittinger <cg@exept.de>
parents:
436
diff
changeset
|
6358 |
|
1d86f97ab2e5
autoAccept as default; configurable
Claus Gittinger <cg@exept.de>
parents:
436
diff
changeset
|
6359 |
"Modified: 4.3.1996 / 12:14:56 / cg" |
128 | 6360 |
! |
6361 |
||
197 | 6362 |
keyPress:aKey x:x y:y |
6363 |
"return-key dublicates ok-function if acceptReturnAsOK is true" |
|
76 | 6364 |
|
490 | 6365 |
<resource: #keyboard (#Return)> |
6366 |
||
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
6367 |
(aKey == #Return) ifTrue:[ |
1401 | 6368 |
(okButton notNil and:[okButton isReturnButton]) ifTrue:[ |
6369 |
^ self okPressed |
|
6370 |
]. |
|
6371 |
(abortButton notNil and:[abortButton isReturnButton]) ifTrue:[ |
|
6372 |
^ self abortPressed |
|
6373 |
]. |
|
197 | 6374 |
]. |
6375 |
super keyPress:aKey x:x y:y |
|
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
6376 |
|
490 | 6377 |
"Modified: 7.3.1996 / 13:15:09 / cg" |
76 | 6378 |
! |
6379 |
||
197 | 6380 |
lastFieldLeft |
6381 |
"if the dialog involves input fields, this is called |
|
6382 |
when the last field is left by Return-key or NextField-key" |
|
120 | 6383 |
|
197 | 6384 |
acceptOnLeave ifTrue:[ |
1401 | 6385 |
acceptReturnAsOK ifTrue:[ |
6386 |
focusToOKOnLeave ifTrue:[ |
|
6387 |
self focusOnOk. |
|
6388 |
^ self. |
|
6389 |
]. |
|
6390 |
self okPressed |
|
6391 |
] |
|
197 | 6392 |
]. |
280
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
6393 |
inputFieldGroup activateFirst |
357
732f59def851
care for acceptReturnAsOK being false and return being pressed
Claus Gittinger <cg@exept.de>
parents:
356
diff
changeset
|
6394 |
|
551
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
6395 |
"Modified: 19.4.1996 / 17:09:02 / cg" |
76 | 6396 |
! |
6397 |
||
197 | 6398 |
okPressed |
6399 |
"sent by the okButton; user pressed ok-button |
|
6400 |
- make myself invisible and if an action was specified do it" |
|
128 | 6401 |
|
197 | 6402 |
okButton notNil ifTrue:[okButton turnOffWithoutRedraw]. |
280
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
6403 |
|
197 | 6404 |
self doAccept. |
6405 |
||
280
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
6406 |
acceptCheck notNil ifTrue:[ |
302 | 6407 |
acceptCheck value ifFalse:[^ self] |
280
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
6408 |
]. |
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
6409 |
|
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
6410 |
hideOnAccept ifTrue:[ |
302 | 6411 |
"/ actually, only hides if I have been opened modal |
6412 |
self hideAndEvaluate:okAction. |
|
280
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
6413 |
] ifFalse:[ |
302 | 6414 |
okAction value |
280
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
6415 |
] |
128 | 6416 |
! ! |
240 | 6417 |
|
846
75c5dc601522
added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents:
831
diff
changeset
|
6418 |
!DialogBox class methodsFor:'documentation'! |
240 | 6419 |
|
6420 |
version |
|
2116 | 6421 |
^ '$Header: /cvs/stx/stx/libwidg/DialogBox.st,v 1.144 2000-02-05 14:20:44 cg Exp $' |
240 | 6422 |
! ! |
498 | 6423 |
DialogBox initialize! |