author | Claus Gittinger <cg@exept.de> |
Thu, 27 Jan 2000 13:01:59 +0100 | |
changeset 2106 | 40b0e35b3dbc |
parent 2080 | 620d5ac7dee5 |
child 2110 | ad32442191f0 |
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 |
" |
fe4300f57e1a
convenient entry: #request:initialAnswer:list
Claus Gittinger <cg@exept.de>
parents:
1877
diff
changeset
|
2629 |
|
fe4300f57e1a
convenient entry: #request:initialAnswer:list
Claus Gittinger <cg@exept.de>
parents:
1877
diff
changeset
|
2630 |
"Modified: / 5.5.1999 / 10:53:45 / cg" |
fe4300f57e1a
convenient entry: #request:initialAnswer:list
Claus Gittinger <cg@exept.de>
parents:
1877
diff
changeset
|
2631 |
! |
fe4300f57e1a
convenient entry: #request:initialAnswer:list
Claus Gittinger <cg@exept.de>
parents:
1877
diff
changeset
|
2632 |
|
718
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
2633 |
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
|
2634 |
"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
|
2635 |
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
|
2636 |
or cancelValue (if cancel was pressed)" |
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
2637 |
|
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
2638 |
^ self |
1401 | 2639 |
request:aString |
2640 |
displayAt:nil |
|
2641 |
centered:false |
|
2642 |
action:nil |
|
2643 |
initialAnswer:initial |
|
2644 |
okLabel:okLabel |
|
2645 |
cancelLabel:nil |
|
2646 |
title:titleString |
|
2647 |
onCancel:cancelAction |
|
718
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
2648 |
|
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
2649 |
" |
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
2650 |
Dialog |
1401 | 2651 |
request:'enter a string:' |
2652 |
initialAnswer:'the default' |
|
2653 |
onCancel:['foooo'] |
|
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 |
"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
|
2657 |
"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
|
2658 |
! |
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
2659 |
|
1705
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2660 |
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
|
2661 |
"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
|
2662 |
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
|
2663 |
or cancelValue (if cancel was pressed)" |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2664 |
|
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2665 |
^ self |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2666 |
request:aString |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2667 |
displayAt:nil |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2668 |
centered:false |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2669 |
action:nil |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2670 |
initialAnswer:initial |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2671 |
okLabel:okLabel |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2672 |
cancelLabel:nil |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2673 |
title:titleString |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2674 |
onCancel:cancelAction |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2675 |
list:listOfChoices |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2676 |
|
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2677 |
" |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2678 |
Dialog |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2679 |
request:'enter a string:' |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2680 |
initialAnswer:'the default' |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2681 |
okLabel:'ok' |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2682 |
title:'demo' |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2683 |
onCancel:nil |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2684 |
list:#('foo' 'bar' 'baz') |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2685 |
" |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2686 |
|
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2687 |
"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
|
2688 |
"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
|
2689 |
! |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2690 |
|
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
|
2691 |
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
|
2692 |
"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
|
2693 |
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
|
2694 |
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
|
2695 |
|
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2696 |
^ self |
1401 | 2697 |
request:aString |
2698 |
displayAt:nil |
|
2699 |
centered:false |
|
2700 |
action:nil |
|
2701 |
initialAnswer:initial |
|
2702 |
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
|
2703 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2704 |
" |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2705 |
Dialog |
1401 | 2706 |
request:'enter a string:' |
2707 |
initialAnswer:'the default' |
|
2708 |
onCancel:['foooo'] |
|
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2709 |
" |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2710 |
|
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2711 |
"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
|
2712 |
! |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2713 |
|
1705
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2714 |
request:aString list:listOfChoices |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2715 |
"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
|
2716 |
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
|
2717 |
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
|
2718 |
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
|
2719 |
|
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2720 |
^ self |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2721 |
request:aString |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2722 |
displayAt:nil |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2723 |
centered:false |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2724 |
action:nil |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2725 |
initialAnswer:'' |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2726 |
okLabel:nil |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2727 |
cancelLabel:nil |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2728 |
title:nil |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2729 |
onCancel:nil |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2730 |
list:listOfChoices |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2731 |
|
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2732 |
" |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2733 |
Dialog |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2734 |
request:'enter a string:' |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2735 |
list:#('foo' 'bar' 'baz') |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2736 |
" |
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 |
"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
|
2739 |
! |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2740 |
|
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2741 |
request:aString okLabel:okLabel |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2742 |
"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
|
2743 |
The okButton is labelled as okLabel. |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2744 |
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
|
2745 |
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
|
2746 |
|
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2747 |
^ self |
1401 | 2748 |
request:aString |
2749 |
displayAt:nil |
|
2750 |
centered:false |
|
2751 |
action:nil |
|
2752 |
initialAnswer:'' |
|
2753 |
okLabel:okLabel |
|
2754 |
cancelLabel:nil |
|
2755 |
onCancel:'' |
|
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2756 |
|
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2757 |
" |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2758 |
Dialog |
1401 | 2759 |
request:'enter a string:' |
2760 |
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
|
2761 |
" |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2762 |
|
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2763 |
"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
|
2764 |
"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
|
2765 |
! |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2766 |
|
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2767 |
request:aString okLabel:okLabel onCancel:cancelValue |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2768 |
"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
|
2769 |
The okButton is labelled as okLabel. |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2770 |
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
|
2771 |
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
|
2772 |
|
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2773 |
^ self |
1401 | 2774 |
request:aString |
2775 |
displayAt:nil |
|
2776 |
centered:false |
|
2777 |
action:nil |
|
2778 |
initialAnswer:'' |
|
2779 |
okLabel:okLabel |
|
2780 |
cancelLabel:nil |
|
2781 |
onCancel:cancelValue |
|
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2782 |
|
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2783 |
" |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2784 |
Dialog |
1401 | 2785 |
request:'enter a string:' |
2786 |
okLabel:'yes' |
|
2787 |
onCancel:nil |
|
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 |
"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
|
2791 |
! |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2792 |
|
718
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
2793 |
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
|
2794 |
"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
|
2795 |
The okButton is labelled as okLabel. |
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
2796 |
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
|
2797 |
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
|
2798 |
|
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
2799 |
^ self |
1401 | 2800 |
request:aString |
2801 |
displayAt:nil |
|
2802 |
centered:false |
|
2803 |
action:nil |
|
2804 |
initialAnswer:'' |
|
2805 |
okLabel:okLabel |
|
2806 |
cancelLabel:nil |
|
2807 |
title:titleString |
|
2808 |
onCancel:cancelValue |
|
718
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
2809 |
|
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
2810 |
" |
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
2811 |
Dialog |
1401 | 2812 |
request:'enter a string:' |
2813 |
okLabel:'yes' |
|
2814 |
title:'foo' |
|
2815 |
onCancel:nil |
|
718
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 |
|
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
2818 |
"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
|
2819 |
"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
|
2820 |
! |
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
2821 |
|
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
|
2822 |
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
|
2823 |
"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
|
2824 |
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
|
2825 |
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
|
2826 |
|
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2827 |
^ self |
1401 | 2828 |
request:aString |
2829 |
displayAt:nil |
|
2830 |
centered:false |
|
2831 |
action:nil |
|
2832 |
initialAnswer:'' |
|
2833 |
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
|
2834 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2835 |
" |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2836 |
Dialog |
1401 | 2837 |
request:'enter a string:' |
2838 |
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
|
2839 |
" |
d3fe810390cb
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 |
"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
|
2842 |
"Modified: 29.5.1996 / 14:28:59 / cg" |
100 | 2843 |
! |
2844 |
||
197 | 2845 |
requestPassword:aString |
2846 |
"launch a Dialog, which allows user to enter something invisibly. |
|
2847 |
Return the entered string (may be empty string) |
|
2848 |
or nil (if cancel was pressed)" |
|
100 | 2849 |
|
197 | 2850 |
^ EnterBox requestPassword:aString |
133 | 2851 |
|
2852 |
" |
|
2853 |
Dialog |
|
197 | 2854 |
requestPassword:'enter secret:' |
133 | 2855 |
" |
197 | 2856 |
|
2857 |
"Created: 17.11.1995 / 09:45:21 / cg" |
|
2014 | 2858 |
! |
2859 |
||
2860 |
requestText:title lines:numLines columns:numCols initialAnswer:initialText |
|
2861 |
"open a dialog asking for multiline text. |
|
2862 |
Return a stringCollection or nil if cancelled." |
|
2863 |
||
2864 |
|dialog textView| |
|
2865 |
||
2866 |
dialog := self new. |
|
2867 |
(dialog addTextLabel:(self classResources string:title)) adjust:#left. |
|
2868 |
textView := dialog addTextBoxOn:nil |
|
2869 |
class:EditTextView |
|
2870 |
withNumberOfLines:numLines |
|
2871 |
hScrollable:true |
|
2872 |
vScrollable:true. |
|
2873 |
dialog width:(textView preferredExtentForLines:numLines cols:numCols) x. |
|
2874 |
textView contents:initialText. |
|
2875 |
dialog addAbortAndOkButtons. |
|
2876 |
dialog okButton isReturnButton:false. |
|
2877 |
dialog makeTabable:textView. |
|
2878 |
dialog open. |
|
2879 |
dialog accepted ifTrue:[ |
|
2880 |
^ textView contents |
|
2881 |
]. |
|
2882 |
^ nil |
|
2883 |
||
2884 |
||
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
|
2885 |
! ! |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2886 |
|
846
75c5dc601522
added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents:
831
diff
changeset
|
2887 |
!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
|
2888 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2889 |
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
|
2890 |
"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
|
2891 |
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
|
2892 |
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
|
2893 |
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
|
2894 |
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
|
2895 |
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
|
2896 |
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
|
2897 |
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
|
2898 |
|
1284 | 2899 |
|box listView panel answer| |
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
|
2900 |
|
d3fe810390cb
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 |
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
|
2902 |
(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
|
2903 |
|
d3fe810390cb
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 |
list notNil ifTrue:[ |
1401 | 2905 |
maxLines > list size ifTrue:[ |
2906 |
listView := ScrollableView for:SelectionInListView. |
|
2907 |
] ifFalse:[ |
|
2908 |
listView := SelectionInListView new. |
|
2909 |
listView level:-1. |
|
2910 |
]. |
|
2911 |
listView list:list. |
|
2912 |
listView doubleClickAction:[:line | box hide. ^ listValues at:line]. |
|
2913 |
box addComponent:listView indent:(ViewSpacing // 2) withHeight:(listView heightForLines:maxLines). |
|
2914 |
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
|
2915 |
]. |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2916 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2917 |
buttonLabels notNil ifTrue:[ |
1401 | 2918 |
panel := HorizontalPanelView new. |
2919 |
panel horizontalLayout:#fitSpace. |
|
2920 |
buttonLabels keysAndValuesDo:[:index :label | |
|
2921 |
|b| |
|
2922 |
||
2923 |
b := Button label:label. |
|
2924 |
b action:[box hide. ^ buttonValues at:index]. |
|
2925 |
panel add:b. |
|
2926 |
box makeTabable:b. |
|
2927 |
]. |
|
2928 |
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
|
2929 |
]. |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2930 |
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
|
2931 |
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
|
2932 |
|
4bbc8deffc8c
allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents:
307
diff
changeset
|
2933 |
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
|
2934 |
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
|
2935 |
|
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
|
2936 |
box showAtPointer. |
719
574be1981be0
destroy boxes from standard dialogs
Claus Gittinger <cg@exept.de>
parents:
718
diff
changeset
|
2937 |
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
|
2938 |
box accepted ifTrue:[ |
1401 | 2939 |
(answer := listView selection) notNil ifTrue:[ |
2940 |
^ listValues at:answer |
|
2941 |
] |
|
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
|
2942 |
]. |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2943 |
^ cancelBlock value |
197 | 2944 |
|
2945 |
" |
|
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
|
2946 |
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
|
2947 |
|
1401 | 2948 |
Transcript showCR:( |
2949 |
Dialog |
|
2950 |
choose:'choose any' |
|
2951 |
fromList:#('one' 'two' 'three' 'four') |
|
2952 |
values:#(1 2 3 4) |
|
2953 |
buttons:#('five' 'six' 'seven') |
|
2954 |
values:#(5 6 7) |
|
2955 |
lines:10 |
|
2956 |
cancel:nil |
|
2957 |
) |
|
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
|
2958 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2959 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2960 |
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
|
2961 |
|
1401 | 2962 |
Transcript showCR:( |
2963 |
Dialog |
|
2964 |
choose:'choose any' |
|
2965 |
fromList:#('one' 'two' 'three' 'four') |
|
2966 |
values:#(1 2 3 4) |
|
2967 |
buttons:nil |
|
2968 |
values:nil |
|
2969 |
lines:4 |
|
2970 |
cancel:nil |
|
2971 |
) |
|
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
|
2972 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2973 |
|
558 | 2974 |
no list (lines argument is ignored): |
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
|
2975 |
|
1401 | 2976 |
Transcript showCR:( |
2977 |
Dialog |
|
2978 |
choose:'choose any' |
|
2979 |
fromList:nil |
|
2980 |
values:nil |
|
2981 |
buttons:#('one' 'two' 'three' 'four') |
|
2982 |
values:#(1 2 3 4) |
|
2983 |
lines:nil |
|
2984 |
cancel:nil |
|
2985 |
) |
|
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
|
2986 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2987 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2988 |
full including cancel 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
|
2989 |
|
1401 | 2990 |
Transcript showCR:( |
2991 |
Dialog |
|
2992 |
choose:'choose example' |
|
2993 |
fromList:#('one' 'two' 'three' 'four') |
|
2994 |
values:#(1 2 3 4) |
|
2995 |
buttons:#('five' 'six' 'seven') |
|
2996 |
values:#(5 6 7) |
|
2997 |
lines:4 |
|
2998 |
cancel:[Transcript flash. #aborted] |
|
2999 |
) |
|
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
|
3000 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3001 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3002 |
degenerated: |
d3fe810390cb
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 |
|
1401 | 3004 |
Transcript showCR:( |
3005 |
Dialog |
|
3006 |
choose:'choose any' |
|
3007 |
fromList:nil |
|
3008 |
values:nil |
|
3009 |
buttons:nil |
|
3010 |
values:nil |
|
3011 |
lines:nil |
|
3012 |
cancel:nil |
|
3013 |
) |
|
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
|
3014 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3015 |
|
133 | 3016 |
" |
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
|
3017 |
|
719
574be1981be0
destroy boxes from standard dialogs
Claus Gittinger <cg@exept.de>
parents:
718
diff
changeset
|
3018 |
"Modified: 29.5.1996 / 15:27: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
|
3019 |
! |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3020 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3021 |
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
|
3022 |
"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
|
3023 |
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
|
3024 |
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
|
3025 |
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
|
3026 |
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
|
3027 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3028 |
^ self |
314
705185e7001d
no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents:
312
diff
changeset
|
3029 |
choose:aString |
705185e7001d
no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents:
312
diff
changeset
|
3030 |
fromList:list |
705185e7001d
no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents:
312
diff
changeset
|
3031 |
values:listValues |
705185e7001d
no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents:
312
diff
changeset
|
3032 |
buttons:nil |
705185e7001d
no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents:
312
diff
changeset
|
3033 |
values:nil |
705185e7001d
no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents:
312
diff
changeset
|
3034 |
lines:maxLines |
705185e7001d
no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents:
312
diff
changeset
|
3035 |
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
|
3036 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3037 |
" |
655 | 3038 |
Transcript showCR:( |
314
705185e7001d
no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents:
312
diff
changeset
|
3039 |
Dialog |
705185e7001d
no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents:
312
diff
changeset
|
3040 |
choose:'choose any' |
705185e7001d
no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents:
312
diff
changeset
|
3041 |
fromList:#('one' 'two' 'three' 'four') |
705185e7001d
no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents:
312
diff
changeset
|
3042 |
values:#(1 2 3 4) |
705185e7001d
no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents:
312
diff
changeset
|
3043 |
lines:4 |
705185e7001d
no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents:
312
diff
changeset
|
3044 |
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
|
3045 |
) |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3046 |
|
655 | 3047 |
Transcript showCR:( |
314
705185e7001d
no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents:
312
diff
changeset
|
3048 |
Dialog |
705185e7001d
no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents:
312
diff
changeset
|
3049 |
choose:'choose example' |
705185e7001d
no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents:
312
diff
changeset
|
3050 |
fromList:#('one' 'two' 'three' 'four') |
705185e7001d
no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents:
312
diff
changeset
|
3051 |
values:#(1 2 3 4) |
705185e7001d
no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents:
312
diff
changeset
|
3052 |
lines:4 |
705185e7001d
no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents:
312
diff
changeset
|
3053 |
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
|
3054 |
) |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3055 |
" |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3056 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3057 |
"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
|
3058 |
! |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3059 |
|
803 | 3060 |
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
|
3061 |
"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
|
3062 |
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
|
3063 |
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
|
3064 |
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
|
3065 |
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
|
3066 |
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
|
3067 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3068 |
|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
|
3069 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3070 |
box := OptionBox title:aString numberOfOptions:buttonLabels size. |
803 | 3071 |
windowLabel notNil ifTrue:[ |
1401 | 3072 |
box label:windowLabel |
803 | 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 |
box buttonTitles:(self classResources array:buttonLabels) |
1401 | 3075 |
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
|
3076 |
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
|
3077 |
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
|
3078 |
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
|
3079 |
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
|
3080 |
box showAtPointer. |
719
574be1981be0
destroy boxes from standard dialogs
Claus Gittinger <cg@exept.de>
parents:
718
diff
changeset
|
3081 |
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
|
3082 |
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
|
3083 |
^ 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
|
3084 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3085 |
"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
|
3086 |
|
d3fe810390cb
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 |
Dialog |
1401 | 3088 |
choose:'choose any' |
3089 |
labels:#('one' 'two' 'three' 'four') |
|
3090 |
values:#(1 2 3 4) |
|
3091 |
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
|
3092 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3093 |
Dialog |
1401 | 3094 |
choose:'choose any' |
3095 |
labels:#('cancel' 'foo' 'bar' 'baz') |
|
3096 |
values:#(nil foo bar baz) |
|
3097 |
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
|
3098 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3099 |
Dialog |
1401 | 3100 |
choose:'choose any' |
3101 |
labels:#('one' 'two' 'three' 'four') |
|
3102 |
values:#(1 2 3 4) |
|
3103 |
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
|
3104 |
" |
d3fe810390cb
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 |
|
719
574be1981be0
destroy boxes from standard dialogs
Claus Gittinger <cg@exept.de>
parents:
718
diff
changeset
|
3106 |
"Modified: 29.5.1996 / 15:27:32 / cg" |
803 | 3107 |
"Created: 22.7.1996 / 11:44:27 / cg" |
3108 |
! |
|
3109 |
||
3110 |
choose:aString labels:buttonLabels values:values default:default |
|
3111 |
"launch a Dialog, which allows user to enter any of buttonLabels. |
|
3112 |
Returning a corresponding value from the values-array. |
|
3113 |
The default entries button is marked as a return button and entering |
|
3114 |
return will choose that value. |
|
3115 |
For a good userInterface style, we recommend this being the last |
|
3116 |
entry (to make the right-most button the default button)." |
|
3117 |
||
3118 |
^ self |
|
1401 | 3119 |
choose:aString |
3120 |
label:nil |
|
3121 |
labels:buttonLabels |
|
3122 |
values:values |
|
3123 |
default:default |
|
803 | 3124 |
|
3125 |
||
3126 |
"no good style (default button is not the rightmost one) |
|
3127 |
||
3128 |
Dialog |
|
1401 | 3129 |
choose:'choose any' |
3130 |
labels:#('one' 'two' 'three' 'four') |
|
3131 |
values:#(1 2 3 4) |
|
3132 |
default:2 |
|
803 | 3133 |
|
3134 |
Dialog |
|
1401 | 3135 |
choose:'choose any' |
3136 |
labels:#('cancel' 'foo' 'bar' 'baz') |
|
3137 |
values:#(nil foo bar baz) |
|
3138 |
default:#baz |
|
803 | 3139 |
|
3140 |
Dialog |
|
1401 | 3141 |
choose:'choose any' |
3142 |
labels:#('one' 'two' 'three' 'four') |
|
3143 |
values:#(1 2 3 4) |
|
3144 |
default:nil |
|
803 | 3145 |
" |
3146 |
||
3147 |
"Modified: 22.7.1996 / 11:46:09 / cg" |
|
100 | 3148 |
! ! |
3149 |
||
1573
63a7b74f45be
added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
1488
diff
changeset
|
3150 |
!DialogBox class methodsFor:'queries'! |
63a7b74f45be
added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
1488
diff
changeset
|
3151 |
|
63a7b74f45be
added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
1488
diff
changeset
|
3152 |
defaultParentWindow |
63a7b74f45be
added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
1488
diff
changeset
|
3153 |
"return a default parent (top-) window for the dialog. |
63a7b74f45be
added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
1488
diff
changeset
|
3154 |
Here, the currently active view is returned, if there |
63a7b74f45be
added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
1488
diff
changeset
|
3155 |
is one; otherwise, the first encountered topView is |
63a7b74f45be
added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
1488
diff
changeset
|
3156 |
returned." |
63a7b74f45be
added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
1488
diff
changeset
|
3157 |
|
63a7b74f45be
added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
1488
diff
changeset
|
3158 |
|activeGroup| |
63a7b74f45be
added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
1488
diff
changeset
|
3159 |
|
63a7b74f45be
added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
1488
diff
changeset
|
3160 |
activeGroup := WindowGroup activeGroup. |
63a7b74f45be
added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
1488
diff
changeset
|
3161 |
activeGroup isNil ifTrue:[ |
63a7b74f45be
added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
1488
diff
changeset
|
3162 |
"/ mhmh - looks like I am a background process ... |
63a7b74f45be
added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
1488
diff
changeset
|
3163 |
activeGroup := Transcript windowGroup. |
63a7b74f45be
added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
1488
diff
changeset
|
3164 |
activeGroup isNil ifTrue:[^ nil]. |
63a7b74f45be
added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
1488
diff
changeset
|
3165 |
]. |
63a7b74f45be
added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
1488
diff
changeset
|
3166 |
^ activeGroup topViews first. |
63a7b74f45be
added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
1488
diff
changeset
|
3167 |
|
63a7b74f45be
added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
1488
diff
changeset
|
3168 |
" |
63a7b74f45be
added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
1488
diff
changeset
|
3169 |
self defaultParentWindow |
63a7b74f45be
added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
1488
diff
changeset
|
3170 |
" |
63a7b74f45be
added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
1488
diff
changeset
|
3171 |
|
63a7b74f45be
added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
1488
diff
changeset
|
3172 |
"Modified: / 16.6.1998 / 12:36:15 / cg" |
63a7b74f45be
added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
1488
diff
changeset
|
3173 |
! ! |
63a7b74f45be
added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
1488
diff
changeset
|
3174 |
|
197 | 3175 |
!DialogBox methodsFor:'accessing-behavior'! |
3176 |
||
3177 |
abortAction:aBlock |
|
3178 |
"define the action to be performed when abort is pressed" |
|
3179 |
||
3180 |
abortAction := aBlock |
|
125 | 3181 |
! |
3182 |
||
280
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
3183 |
acceptCheck:aBlock |
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
3184 |
"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
|
3185 |
accepted (ok-button or Return-key). If it returns true, the box is closed, |
2106 | 3186 |
otherwise not. Of course, you may also use a valueHolder instead of a block |
3187 |
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
|
3188 |
|
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
3189 |
acceptCheck := aBlock |
2106 | 3190 |
|
3191 |
"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
|
3192 |
! |
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
3193 |
|
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
3194 |
acceptOnLeave:aBoolean |
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
3195 |
"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
|
3196 |
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
|
3197 |
|
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
3198 |
acceptOnLeave := aBoolean. |
551
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
3199 |
|
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
3200 |
"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
|
3201 |
! |
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
3202 |
|
197 | 3203 |
acceptReturnAsOK:aBoolean |
3204 |
"turn on/off interpretation of return-key as ok. |
|
3205 |
Default is on" |
|
3206 |
||
3207 |
acceptReturnAsOK := aBoolean. |
|
3208 |
okButton notNil ifTrue:[ |
|
3209 |
okButton isReturnButton:aBoolean. |
|
3210 |
] |
|
3211 |
! |
|
3212 |
||
3213 |
action:aBlock |
|
3214 |
"set the action to be performed when user presses ok-button; |
|
3215 |
aBlock must be nil or a block. This method simply |
|
3216 |
reuses okAction: and has been added for a consistent action-setting |
|
3217 |
protocol." |
|
76 | 3218 |
|
197 | 3219 |
self okAction:aBlock |
3220 |
! |
|
3221 |
||
280
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
3222 |
focusOnField:anInputField |
1646 | 3223 |
"arrange for the argument to get the focus (initially)" |
3224 |
||
280
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
3225 |
inputFieldGroup makeActive:anInputField |
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
3226 |
|
1646 | 3227 |
"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
|
3228 |
! |
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
3229 |
|
551
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
3230 |
focusToOKOnLeave:aBoolean |
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
3231 |
"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
|
3232 |
or cursor key. |
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
3233 |
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
|
3234 |
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
|
3235 |
the dialog is accepted & closed." |
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
3236 |
|
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
3237 |
focusToOKOnLeave := aBoolean. |
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
3238 |
|
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
3239 |
"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
|
3240 |
"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
|
3241 |
! |
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
3242 |
|
280
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
3243 |
hideOnAccept:aBoolean |
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
3244 |
"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
|
3245 |
The default is true" |
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
3246 |
|
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
3247 |
hideOnAccept := aBoolean |
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
3248 |
! |
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
3249 |
|
593 | 3250 |
makeTabable:aComponentOrSubcomponent |
3251 |
"add a component (usually a subcomponent, of which the dialog |
|
3252 |
does not know) to the list of tabable ones (i.e. those, that can be |
|
3253 |
stepped through via FocusNext/FocusPrevious). |
|
3254 |
Toplevel tabable components are usually added with #addComponent:tabable:" |
|
3255 |
||
3256 |
tabableElements isNil ifTrue:[ |
|
1401 | 3257 |
tabableElements := OrderedCollection new |
593 | 3258 |
]. |
739
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
3259 |
(tabableElements includesIdentical:aComponentOrSubcomponent) ifFalse:[ |
1401 | 3260 |
tabableElements add:aComponentOrSubcomponent. |
3261 |
||
3262 |
(aComponentOrSubcomponent isInputField) ifTrue:[ |
|
3263 |
self addToInputFieldGroup:aComponentOrSubcomponent |
|
3264 |
]. |
|
593 | 3265 |
]. |
3266 |
||
739
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
3267 |
"Modified: 31.5.1996 / 21:22:13 / cg" |
593 | 3268 |
! |
3269 |
||
1843 | 3270 |
makeTabable:aComponentOrSubcomponent after:anotherComponent |
3271 |
"add a component (usually a subcomponent, of which the dialog |
|
3272 |
does not know) to the list of tabable ones (i.e. those, that can be |
|
3273 |
stepped through via FocusNext/FocusPrevious). |
|
3274 |
Toplevel tabable components are usually added with #addComponent:tabable:" |
|
3275 |
||
3276 |
tabableElements isNil ifTrue:[ |
|
3277 |
tabableElements := OrderedCollection new |
|
3278 |
]. |
|
3279 |
tabableElements removeIdentical:aComponentOrSubcomponent ifAbsent:nil. |
|
3280 |
||
3281 |
anotherComponent isNil ifTrue:[ |
|
3282 |
tabableElements addLast:aComponentOrSubcomponent |
|
3283 |
] ifFalse:[ |
|
3284 |
tabableElements add:aComponentOrSubcomponent after:anotherComponent. |
|
3285 |
]. |
|
3286 |
||
3287 |
(aComponentOrSubcomponent isInputField) ifTrue:[ |
|
3288 |
self addToInputFieldGroup:aComponentOrSubcomponent after:anotherComponent |
|
3289 |
]. |
|
3290 |
||
3291 |
"Modified: 18.10.1997 / 03:08:20 / cg" |
|
3292 |
! |
|
3293 |
||
593 | 3294 |
makeTabable:aComponentOrSubcomponent before:anotherComponent |
3295 |
"add a component (usually a subcomponent, of which the dialog |
|
3296 |
does not know) to the list of tabable ones (i.e. those, that can be |
|
3297 |
stepped through via FocusNext/FocusPrevious). |
|
3298 |
Toplevel tabable components are usually added with #addComponent:tabable:" |
|
3299 |
||
3300 |
tabableElements isNil ifTrue:[ |
|
1843 | 3301 |
tabableElements := OrderedCollection new |
593 | 3302 |
]. |
989
ca2cdf005359
use #removeIdentical: - its faster.
Claus Gittinger <cg@exept.de>
parents:
953
diff
changeset
|
3303 |
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
|
3304 |
|
593 | 3305 |
anotherComponent isNil ifTrue:[ |
1843 | 3306 |
tabableElements addFirst:aComponentOrSubcomponent |
593 | 3307 |
] ifFalse:[ |
1843 | 3308 |
tabableElements add:aComponentOrSubcomponent before:anotherComponent. |
593 | 3309 |
]. |
3310 |
||
3311 |
(aComponentOrSubcomponent isInputField) ifTrue:[ |
|
1843 | 3312 |
self addToInputFieldGroup:aComponentOrSubcomponent before:anotherComponent |
593 | 3313 |
]. |
3314 |
||
1355 | 3315 |
"Modified: 18.10.1997 / 03:08:20 / cg" |
3316 |
! |
|
3317 |
||
3318 |
makeUntabable:aComponentOrSubcomponent |
|
3319 |
(tabableElements includesIdentical:aComponentOrSubcomponent) ifFalse:[ |
|
1401 | 3320 |
tabableElements removeIdentical:aComponentOrSubcomponent. |
3321 |
||
3322 |
(aComponentOrSubcomponent isInputField) ifTrue:[ |
|
3323 |
self removeFromInputFieldGroup:aComponentOrSubcomponent |
|
3324 |
]. |
|
1355 | 3325 |
]. |
3326 |
||
3327 |
"Modified: 18.10.1997 / 02:50:05 / cg" |
|
593 | 3328 |
! |
3329 |
||
197 | 3330 |
okAction:aBlock |
3331 |
"define the action to be performed when ok is pressed" |
|
133 | 3332 |
|
197 | 3333 |
okAction := aBlock |
3334 |
! ! |
|
3335 |
||
3336 |
!DialogBox methodsFor:'accessing-components'! |
|
3337 |
||
3338 |
abortButton |
|
3339 |
"return the abortButton - this access is provided to allow |
|
3340 |
setting the buttons look (for example: colors or font)" |
|
3341 |
||
3342 |
^ abortButton |
|
76 | 3343 |
! |
3344 |
||
197 | 3345 |
okButton |
3346 |
"return the okButton - this access is provided to allow |
|
3347 |
setting the buttons look (for example: colors or font)" |
|
76 | 3348 |
|
197 | 3349 |
^ okButton |
3350 |
! ! |
|
155 | 3351 |
|
197 | 3352 |
!DialogBox methodsFor:'accessing-elements'! |
3353 |
||
3354 |
componentAt:name |
|
680 | 3355 |
"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
|
3356 |
named previously with #name:as:" |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3357 |
|
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3358 |
namedComponents isNil ifTrue:[^ nil]. |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3359 |
^ namedComponents at:name ifAbsent:nil |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3360 |
|
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3361 |
"Modified: 16.1.1997 / 11:40:50 / cg" |
76 | 3362 |
! |
3363 |
||
280
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
3364 |
inputFieldGroup |
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
3365 |
^ inputFieldGroup |
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
3366 |
! |
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
3367 |
|
197 | 3368 |
name:element as:name |
680 | 3369 |
"assign a name to a component. This can be done during construction, |
3370 |
to allow later access to the components (i.e. without a need to |
|
3371 |
remember them in some instVars)" |
|
3372 |
||
950
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3373 |
namedComponents isNil ifTrue:[ |
1401 | 3374 |
namedComponents := Dictionary new. |
197 | 3375 |
]. |
950
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3376 |
namedComponents at:name put:element |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3377 |
|
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3378 |
"Modified: 16.1.1997 / 11:41:03 / cg" |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3379 |
! ! |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3380 |
|
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3381 |
!DialogBox methodsFor:'accessing-look'! |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3382 |
|
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3383 |
abortText:aString |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3384 |
"define the label in the abort-button" |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3385 |
|
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3386 |
|oldSize| |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3387 |
|
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3388 |
aString ~= abortButton label ifTrue:[ |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3389 |
oldSize := abortButton extent. |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3390 |
abortButton label:aString. |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3391 |
abortButton resize. |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3392 |
abortButton extent ~= oldSize ifTrue:[ |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3393 |
shown ifTrue:[self resize] |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3394 |
] |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3395 |
] |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3396 |
! |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3397 |
|
1702 | 3398 |
hideButtons |
3399 |
"hides the buttonPanel (i.e. the ok and cancel buttons if any)" |
|
3400 |
||
3401 |
buttonPanel notNil ifTrue:[buttonPanel beInvisible] |
|
3402 |
! |
|
3403 |
||
950
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3404 |
okText:aString |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3405 |
"define the text in the ok-button" |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3406 |
|
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3407 |
|oldSize| |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3408 |
|
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3409 |
aString ~= okButton label ifTrue:[ |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3410 |
oldSize := okButton extent. |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3411 |
okButton label:aString. |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3412 |
okButton resize. |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3413 |
okButton extent ~= oldSize ifTrue:[ |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3414 |
shown ifTrue:[self resize] |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3415 |
] |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3416 |
] |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3417 |
! |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3418 |
|
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3419 |
okText:okString abortText:abortString |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3420 |
"set both texts displayed in the buttons" |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3421 |
|
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3422 |
(abortString ~= abortButton label |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3423 |
or:[okString ~= okButton label]) ifTrue:[ |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3424 |
okButton label:okString. |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3425 |
abortButton label:abortString. |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3426 |
okButton resize. |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3427 |
abortButton resize. |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3428 |
shown ifTrue:[self resize] |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3429 |
] |
197 | 3430 |
! ! |
3431 |
||
3432 |
!DialogBox methodsFor:'accessing-models'! |
|
76 | 3433 |
|
197 | 3434 |
accept |
3435 |
"return the valueHolder holding true when the box |
|
3436 |
is accepted, false if closed via the windowManager or |
|
3437 |
the cancel button. |
|
3438 |
This is confusing: this method was originally called #acceptValue, |
|
3439 |
but renamed for compatibility with ST-80. |
|
3440 |
This looks like a bad name to me, since in most other situations, #accept |
|
3441 |
is used to force an accept, not to return some valueHolder ...)." |
|
3442 |
||
3443 |
^ acceptValue |
|
280
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
3444 |
! |
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
3445 |
|
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
3446 |
acceptChannel:aValueHolder |
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
3447 |
"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
|
3448 |
is accepted" |
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
3449 |
|
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
3450 |
acceptValue := aValueHolder |
950
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3451 |
! |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3452 |
|
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3453 |
aspectAt:anAspectSymbol put:aDataModel |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3454 |
"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
|
3455 |
requires that a corresponding dataModel has been set (usually during |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3456 |
initialization) via the #aspectAt:put: message. |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3457 |
Allows users of boxes to access individual values - especially useful, |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3458 |
in multi-field dialogs." |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3459 |
|
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3460 |
bindings isNil ifTrue:[bindings := IdentityDictionary new]. |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3461 |
bindings at:anAspectSymbol put:aDataModel |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3462 |
|
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3463 |
"Created: 16.1.1997 / 11:38:46 / cg" |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3464 |
"Modified: 16.1.1997 / 11:41:28 / cg" |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3465 |
! |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3466 |
|
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3467 |
aspectFor:anAspectSymbol |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3468 |
"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
|
3469 |
requires that a corresponding dataModel has been set (usually during |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3470 |
initialization) via the #aspectAt:put: message. |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3471 |
Allows users of boxes to access individual values - especially useful, |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3472 |
in multi-field dialogs." |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3473 |
|
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3474 |
bindings isNil ifTrue:[^ nil]. |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3475 |
^ bindings at:anAspectSymbol ifAbsent:nil |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3476 |
|
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3477 |
"Modified: 16.1.1997 / 11:41:34 / cg" |
76 | 3478 |
! ! |
3479 |
||
120 | 3480 |
!DialogBox methodsFor:'construction-adding'! |
3481 |
||
593 | 3482 |
addComponent:aComponent |
3483 |
"add any component with its preferred height and full width. |
|
3484 |
Returns the component." |
|
3485 |
||
3486 |
^ self addComponent:aComponent indent:nil tabable:false |
|
3487 |
||
3488 |
"Modified: 9.2.1996 / 22:22:41 / cg" |
|
3489 |
! |
|
3490 |
||
3491 |
addComponent:aComponent indent:indent |
|
3492 |
"add any component with its preferred height and full width. |
|
3493 |
The indent is temporarily changed to indent. |
|
3494 |
Returns the component." |
|
3495 |
||
3496 |
^ self addComponent:aComponent indent:indent tabable:false |
|
3497 |
||
3498 |
"Modified: 9.2.1996 / 22:22:44 / cg" |
|
3499 |
! |
|
3500 |
||
3501 |
addComponent:aComponent indent:indent tabable:tabable |
|
3502 |
"add any component with its preferred height and full width. |
|
3503 |
The indent is temporarily changed to indent. |
|
3504 |
Returns the component." |
|
3505 |
||
3506 |
|oldLeft oldRight result| |
|
3507 |
||
3508 |
oldLeft := leftIndent. |
|
3509 |
oldRight := rightIndent. |
|
3510 |
indent notNil ifTrue:[ |
|
1401 | 3511 |
leftIndent := rightIndent := indent. |
593 | 3512 |
]. |
3513 |
result := self addComponent:aComponent tabable:tabable tabbedComponent:aComponent. |
|
3514 |
leftIndent := oldLeft. |
|
3515 |
rightIndent := oldRight. |
|
3516 |
^ result |
|
3517 |
||
3518 |
"Modified: 9.2.1996 / 22:22:50 / cg" |
|
3519 |
! |
|
3520 |
||
3521 |
addComponent:aComponent indent:indent withExtent:ext |
|
3522 |
"add any component with some given extent. |
|
3523 |
Returns the component." |
|
3524 |
||
3525 |
|fullSize lI rI| |
|
3526 |
||
3527 |
indent isNil ifTrue:[ |
|
1401 | 3528 |
lI := leftIndent. |
3529 |
rI := rightIndent. |
|
593 | 3530 |
] ifFalse:[ |
1401 | 3531 |
lI := rI := indent |
593 | 3532 |
]. |
3533 |
||
3534 |
self basicAddComponent:aComponent. |
|
3535 |
fullSize := ext + (lI + rI @ 0). |
|
3536 |
aComponent extent:fullSize. |
|
3537 |
aComponent origin:0.0@yPosition; |
|
1401 | 3538 |
leftInset:lI; |
3539 |
rightInset:rI. |
|
593 | 3540 |
yPosition := yPosition + aComponent height + ViewSpacing. |
3541 |
width := fullSize x max:width. |
|
3542 |
needResize := true. |
|
3543 |
^ aComponent |
|
3544 |
||
3545 |
"Modified: 9.2.1996 / 22:22:54 / cg" |
|
3546 |
! |
|
3547 |
||
3548 |
addComponent:aComponent indent:indent withHeight:height |
|
3549 |
"add any component with some given height and full width. |
|
3550 |
Returns the component." |
|
3551 |
||
3552 |
|lI rI| |
|
3553 |
||
3554 |
indent isNil ifTrue:[ |
|
1401 | 3555 |
lI := leftIndent. |
3556 |
rI := rightIndent. |
|
593 | 3557 |
] ifFalse:[ |
1401 | 3558 |
lI := rI := indent |
593 | 3559 |
]. |
3560 |
self basicAddComponent:aComponent. |
|
3561 |
aComponent height:height. |
|
3562 |
aComponent origin:0.0@yPosition; |
|
1401 | 3563 |
width:1.0; |
3564 |
leftInset:lI; |
|
3565 |
rightInset:rI. |
|
593 | 3566 |
yPosition := yPosition + "aComponent" height + ViewSpacing. |
3567 |
needResize := true. |
|
3568 |
^ aComponent |
|
3569 |
||
3570 |
"Modified: 9.2.1996 / 22:22:58 / cg" |
|
3571 |
! |
|
3572 |
||
3573 |
addComponent:aComponent tabable:tabable |
|
3574 |
"add any component with its preferred height and full width. |
|
3575 |
Returns the component." |
|
3576 |
||
3577 |
^ self addComponent:aComponent tabable:tabable tabbedComponent:aComponent |
|
3578 |
||
3579 |
"Modified: 9.2.1996 / 22:23:04 / cg" |
|
3580 |
! |
|
3581 |
||
3582 |
addComponent:aComponent tabable:tabable tabbedComponent:subComponent |
|
3583 |
"add any component with its preferred height and full width. |
|
3584 |
Returns the component." |
|
3585 |
||
3586 |
tabable ifTrue:[ |
|
1401 | 3587 |
tabableElements isNil ifTrue:[ |
3588 |
tabableElements := OrderedCollection new |
|
3589 |
]. |
|
3590 |
tabableElements add:subComponent |
|
593 | 3591 |
]. |
3592 |
^ self addComponent:aComponent |
|
1401 | 3593 |
withHeight:(aComponent preferredExtent y). |
593 | 3594 |
|
3595 |
"Modified: 9.2.1996 / 22:23:07 / cg" |
|
3596 |
! |
|
3597 |
||
3598 |
addComponent:aComponent withExtent:ext |
|
3599 |
"add any component with some given extent. |
|
3600 |
Returns the component." |
|
3601 |
||
3602 |
^ self addComponent:aComponent indent:nil withExtent:ext |
|
3603 |
||
3604 |
"Modified: 9.2.1996 / 22:23:11 / cg" |
|
3605 |
! |
|
3606 |
||
3607 |
addComponent:aComponent withHeight:height |
|
3608 |
"add any component with some given height and full width. |
|
3609 |
Returns the component." |
|
3610 |
||
3611 |
^ self addComponent:aComponent indent:nil withHeight:height |
|
3612 |
||
3613 |
"Modified: 9.2.1996 / 22:23:15 / cg" |
|
3614 |
! |
|
3615 |
||
745
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3616 |
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
|
3617 |
"add a label and some view side-by-side. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3618 |
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
|
3619 |
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
|
3620 |
The inputField gets model as its model. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3621 |
Return the inputField." |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3622 |
|
795 | 3623 |
^ self |
1401 | 3624 |
addLabelledField:aView |
3625 |
label:labelString |
|
3626 |
adjust:labelAdjust |
|
3627 |
tabable:tabable |
|
3628 |
from:leftX to:rightX separateAtX:relativeX |
|
3629 |
nameAs:nil |
|
745
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3630 |
|
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3631 |
" |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3632 |
|dialog model field| |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3633 |
|
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3634 |
model := '' asValue. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3635 |
|
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3636 |
dialog := DialogBox new. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3637 |
|
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3638 |
field := dialog |
1401 | 3639 |
addLabelledField:(EditField on:model) label:'input here:' |
3640 |
adjust:#left |
|
3641 |
tabable:true |
|
3642 |
separateAtX:0.3. |
|
745
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3643 |
|
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3644 |
dialog addAbortButton; addOkButton. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3645 |
dialog open. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3646 |
dialog accepted ifTrue:[Transcript showCR:model value]. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3647 |
" |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3648 |
|
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3649 |
" |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3650 |
|dialog model field| |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3651 |
|
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3652 |
model := SelectionInList new. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3653 |
model list:#('foo' 'bar' 'baz'). |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3654 |
model selectionIndex:2. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3655 |
|
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3656 |
dialog := DialogBox new. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3657 |
|
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3658 |
field := dialog |
1401 | 3659 |
addLabelledField:(PopUpList on:model) label:'select here:' |
3660 |
adjust:#left |
|
3661 |
tabable:true |
|
3662 |
separateAtX:0.3. |
|
745
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3663 |
|
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3664 |
dialog addAbortButton; addOkButton. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3665 |
dialog open. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3666 |
dialog accepted ifTrue:[Transcript showCR:model value]. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3667 |
" |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3668 |
|
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3669 |
"Created: 3.6.1996 / 11:03:24 / cg" |
795 | 3670 |
"Modified: 17.7.1996 / 15:04:07 / cg" |
3671 |
! |
|
3672 |
||
3673 |
addLabelledField:aView label:labelString adjust:labelAdjust tabable:tabable from:leftX to:rightX separateAtX:relativeX nameAs:aName |
|
3674 |
"add a label and some view side-by-side. |
|
3675 |
The labels goes from 0.0 to relativeX; the inputField from relativeX to 1.0. |
|
3676 |
The labels string is defined by labelString and adjusted according to labelAdjust. |
|
3677 |
The inputField gets model as its model. |
|
3678 |
Return the inputField." |
|
3679 |
||
3680 |
|y lbl max relW| |
|
3681 |
||
3682 |
y := self yPosition. |
|
3683 |
lbl := Label label:labelString. |
|
3684 |
max := lbl preferredExtent y max:(aView preferredExtent y). |
|
3685 |
||
3686 |
relW := rightX - leftX. |
|
3687 |
||
3688 |
self addComponent:lbl indent:leftIndent withHeight:max. |
|
3689 |
lbl rightInset:0. |
|
3690 |
lbl |
|
1401 | 3691 |
width:(relW*relativeX); |
3692 |
left:leftX; |
|
3693 |
adjust:labelAdjust; borderWidth:0. |
|
795 | 3694 |
|
3695 |
self yPosition:y. |
|
3696 |
self addComponent:aView tabable:tabable. |
|
3697 |
aView |
|
1401 | 3698 |
leftInset:ViewSpacing; |
3699 |
rightInset:ViewSpacing. |
|
795 | 3700 |
|
3701 |
aView |
|
1401 | 3702 |
width:relW*(1.0 - relativeX); |
3703 |
left:leftX+(relW*relativeX). |
|
795 | 3704 |
|
3705 |
aView isInputField ifTrue:[ |
|
1401 | 3706 |
self addToInputFieldGroup:aView |
795 | 3707 |
]. |
3708 |
||
3709 |
aName notNil ifTrue:[ |
|
1401 | 3710 |
self name:lbl as:(aName , '.label'). |
3711 |
self name:aView as:aName |
|
795 | 3712 |
]. |
3713 |
^ aView |
|
3714 |
||
3715 |
" |
|
3716 |
|dialog model field| |
|
3717 |
||
3718 |
model := '' asValue. |
|
3719 |
||
3720 |
dialog := DialogBox new. |
|
3721 |
||
3722 |
field := dialog |
|
1401 | 3723 |
addLabelledField:(EditField on:model) |
3724 |
label:'input here:' |
|
3725 |
adjust:#left |
|
3726 |
tabable:true |
|
3727 |
separateAtX:0.3. |
|
807 | 3728 |
|
3729 |
dialog addAbortButton; addOkButton. |
|
3730 |
dialog open. |
|
3731 |
dialog accepted ifTrue:[Transcript showCR:model value]. |
|
3732 |
" |
|
3733 |
||
3734 |
" |
|
3735 |
|dialog model field| |
|
3736 |
||
3737 |
model := '' asValue. |
|
3738 |
||
3739 |
dialog := DialogBox new. |
|
3740 |
||
3741 |
field := dialog |
|
1401 | 3742 |
addLabelledField:((ComboListView on:model) list:#('foo' 'bar' 'baz')) |
3743 |
label:'select foo:' |
|
3744 |
adjust:#left |
|
3745 |
tabable:true |
|
3746 |
separateAtX:0.3. |
|
795 | 3747 |
|
3748 |
dialog addAbortButton; addOkButton. |
|
3749 |
dialog open. |
|
3750 |
dialog accepted ifTrue:[Transcript showCR:model value]. |
|
3751 |
" |
|
3752 |
||
3753 |
" |
|
3754 |
|dialog model field| |
|
3755 |
||
3756 |
model := SelectionInList new. |
|
3757 |
model list:#('foo' 'bar' 'baz'). |
|
3758 |
model selectionIndex:2. |
|
3759 |
||
3760 |
dialog := DialogBox new. |
|
3761 |
||
3762 |
field := dialog |
|
1401 | 3763 |
addLabelledField:(PopUpList on:model) |
3764 |
label:'select here:' |
|
3765 |
adjust:#left |
|
3766 |
tabable:true |
|
3767 |
separateAtX:0.3. |
|
795 | 3768 |
|
3769 |
dialog addAbortButton; addOkButton. |
|
3770 |
dialog open. |
|
3771 |
dialog accepted ifTrue:[Transcript showCR:model value]. |
|
3772 |
" |
|
3773 |
||
3774 |
"Created: 17.7.1996 / 15:03:32 / cg" |
|
807 | 3775 |
"Modified: 26.7.1996 / 18:11:12 / cg" |
745
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3776 |
! |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3777 |
|
593 | 3778 |
addLabelledField:aView label:labelString adjust:labelAdjust tabable:tabable separateAtX:relativeX |
3779 |
"add a label and some view side-by-side. |
|
3780 |
The labels goes from 0.0 to relativeX; the inputField from relativeX to 1.0. |
|
3781 |
The labels string is defined by labelString and adjusted according to labelAdjust. |
|
3782 |
The inputField gets model as its model. |
|
3783 |
Return the inputField." |
|
3784 |
||
745
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3785 |
^ self |
1401 | 3786 |
addLabelledField:aView |
3787 |
label:labelString |
|
3788 |
adjust:labelAdjust |
|
3789 |
tabable:tabable |
|
3790 |
from:0.0 to:1.0 |
|
3791 |
separateAtX:relativeX |
|
745
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 |
"/ |y lbl max| |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3794 |
"/ |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3795 |
"/ y := self yPosition. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3796 |
"/ lbl := Label label:labelString. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3797 |
"/ max := lbl preferredExtent y max:(aView preferredExtent y). |
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 |
"/ self addComponent:lbl indent:leftIndent withHeight:max. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3800 |
"/ lbl rightInset:0. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3801 |
"/ lbl width:relativeX; adjust:labelAdjust; borderWidth:0. |
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 |
"/ self yPosition:y. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3804 |
"/ self addComponent:aView tabable:tabable. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3805 |
"/ aView leftInset:ViewSpacing; rightInset:ViewSpacing. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3806 |
"/ aView width:(1.0 - relativeX); left:relativeX. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3807 |
"/ |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3808 |
"/ aView isInputField ifTrue:[ |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3809 |
"/ self addToInputFieldGroup:aView |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3810 |
"/ ]. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3811 |
"/ |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3812 |
"/ ^ aView |
593 | 3813 |
|
3814 |
" |
|
3815 |
|dialog model field| |
|
3816 |
||
3817 |
model := '' asValue. |
|
3818 |
||
3819 |
dialog := DialogBox new. |
|
3820 |
||
3821 |
field := dialog |
|
1401 | 3822 |
addLabelledField:(EditField on:model) label:'input here:' |
3823 |
adjust:#left |
|
3824 |
tabable:true |
|
3825 |
separateAtX:0.3. |
|
593 | 3826 |
|
3827 |
dialog addAbortButton; addOkButton. |
|
3828 |
dialog open. |
|
655 | 3829 |
dialog accepted ifTrue:[Transcript showCR:model value]. |
593 | 3830 |
" |
3831 |
||
3832 |
" |
|
3833 |
|dialog model field| |
|
3834 |
||
3835 |
model := SelectionInList new. |
|
3836 |
model list:#('foo' 'bar' 'baz'). |
|
3837 |
model selectionIndex:2. |
|
3838 |
||
3839 |
dialog := DialogBox new. |
|
3840 |
||
3841 |
field := dialog |
|
1401 | 3842 |
addLabelledField:(PopUpList on:model) label:'select here:' |
3843 |
adjust:#left |
|
3844 |
tabable:true |
|
3845 |
separateAtX:0.3. |
|
593 | 3846 |
|
3847 |
dialog addAbortButton; addOkButton. |
|
3848 |
dialog open. |
|
655 | 3849 |
dialog accepted ifTrue:[Transcript showCR:model value]. |
593 | 3850 |
" |
3851 |
||
3852 |
"Created: 13.4.1996 / 13:41:31 / cg" |
|
745
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3853 |
"Modified: 3.6.1996 / 18:48:49 / cg" |
593 | 3854 |
! |
3855 |
||
3856 |
addTextLabel:aString |
|
3857 |
"create a text label - the name has been choosen for ST-80 compatibility; |
|
3858 |
however, ST/X labels allow image labels too. |
|
3859 |
Returns the label." |
|
3860 |
||
3861 |
|l| |
|
3862 |
||
3863 |
l := Label new label:aString. |
|
3864 |
l borderWidth:0. |
|
3865 |
self addComponent:l. |
|
3866 |
^ l |
|
3867 |
||
3868 |
" |
|
3869 |
|b| |
|
3870 |
||
3871 |
b := DialogBox new. |
|
3872 |
b addTextLabel:'hello'. |
|
3873 |
b showAtPointer |
|
3874 |
" |
|
3875 |
" |
|
3876 |
|b| |
|
3877 |
||
3878 |
b := DialogBox new. |
|
3879 |
b leftIndent:100. |
|
3880 |
b addTextLabel:'hello'. |
|
3881 |
b leftIndent:0. |
|
3882 |
b addTextLabel:'world'. |
|
3883 |
b showAtPointer |
|
3884 |
" |
|
3885 |
" |
|
3886 |
|b| |
|
3887 |
||
3888 |
b := DialogBox new. |
|
3889 |
b addTextLabel:'hello'. |
|
3890 |
b addTextLabel:'world'. |
|
3891 |
b addOkButton. |
|
3892 |
b showAtPointer |
|
3893 |
" |
|
3894 |
" |
|
3895 |
|b| |
|
3896 |
||
3897 |
b := DialogBox new. |
|
3898 |
b addTextLabel:'hello'. |
|
3899 |
(b addTextLabel:'world') foregroundColor:Color red. |
|
3900 |
b addOkButton. |
|
3901 |
b showAtPointer |
|
3902 |
" |
|
3903 |
" |
|
3904 |
|b| |
|
3905 |
||
3906 |
b := DialogBox new. |
|
3907 |
b addTextLabel:'hello world\\How about this ?' withCRs. |
|
3908 |
b addOkButton. |
|
3909 |
b showAtPointer |
|
3910 |
" |
|
3911 |
" |
|
3912 |
|b| |
|
3913 |
||
3914 |
b := DialogBox new. |
|
3915 |
b addTextLabel:'hello world\\How about this ?' withCRs. |
|
3916 |
b addTextLabel:'not bad'. |
|
3917 |
b addAbortButton. |
|
3918 |
b addOkButton. |
|
3919 |
b showAtPointer |
|
3920 |
" |
|
3921 |
! |
|
3922 |
||
3923 |
addToInputFieldGroup:aComponentOrSubcomponent |
|
3924 |
"add a component to the input group. |
|
3925 |
The argument, aComponentOrSubcomponent may even be a nested subcomponent of |
|
3926 |
a topLevel component." |
|
3927 |
||
1355 | 3928 |
self |
1401 | 3929 |
addToInputFieldGroup:aComponentOrSubcomponent before:nil |
1355 | 3930 |
|
3931 |
"Modified: 18.10.1997 / 03:09:17 / cg" |
|
3932 |
! |
|
3933 |
||
3934 |
addToInputFieldGroup:aComponentOrSubcomponent before:anotherComponent |
|
3935 |
"add a component to the input group. |
|
3936 |
The argument, aComponentOrSubcomponent may even be a nested subcomponent of |
|
3937 |
a topLevel component." |
|
3938 |
||
593 | 3939 |
inputFieldGroup isNil ifTrue:[ |
1759 | 3940 |
inputFieldGroup := EnterFieldGroup new. |
3941 |
inputFieldGroup leaveAction:[self lastFieldLeft]. |
|
3942 |
"/ |
|
3943 |
"/ the first inputField gets the focus initially |
|
3944 |
"/ |
|
3945 |
aComponentOrSubcomponent hasKeyboardFocus:true. |
|
593 | 3946 |
]. |
1355 | 3947 |
inputFieldGroup add:aComponentOrSubcomponent before:anotherComponent. |
593 | 3948 |
self delegate:(KeyboardForwarder to:inputFieldGroup condition:#noFocus). |
3949 |
||
739
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
3950 |
"/ inputFields isNil ifTrue:[ |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
3951 |
"/ inputFields := OrderedCollection new. |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
3952 |
"/ |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
3953 |
"/ "/ 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
|
3954 |
"/ |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
3955 |
"/ aComponentOrSubcomponent showCursor. |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
3956 |
"/ aComponentOrSubcomponent hasKeyboardFocus:true. |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
3957 |
"/ ] ifFalse:[ |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
3958 |
"/ aComponentOrSubcomponent hideCursor. |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
3959 |
"/ aComponentOrSubcomponent hasKeyboardFocus:false. |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
3960 |
"/ ]. |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
3961 |
"/ inputFields add:aComponentOrSubcomponent |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
3962 |
|
1355 | 3963 |
"Modified: 18.10.1997 / 02:47:20 / cg" |
3964 |
"Created: 18.10.1997 / 03:08:51 / cg" |
|
3965 |
! |
|
3966 |
||
3967 |
removeFromInputFieldGroup:aComponentOrSubcomponent |
|
3968 |
"remove a component from the input group. |
|
3969 |
The argument, aComponentOrSubcomponent may even be a nested subcomponent of |
|
3970 |
a topLevel component." |
|
3971 |
||
3972 |
inputFieldGroup isNil ifTrue:[^ self]. |
|
3973 |
inputFieldGroup remove:aComponentOrSubcomponent. |
|
3974 |
||
3975 |
"Created: 18.10.1997 / 02:51:30 / cg" |
|
593 | 3976 |
! ! |
3977 |
||
3978 |
!DialogBox methodsFor:'construction-buttons'! |
|
3979 |
||
1763 | 3980 |
addAbortAndOkButtons |
3981 |
"create both abort- and Ok Buttons" |
|
3982 |
||
3983 |
self addAbortButton; addOkButton |
|
3984 |
! |
|
3985 |
||
197 | 3986 |
addAbortButton |
3987 |
"create an abortButton - to be sent from redefined initialize |
|
162 | 3988 |
methods in subclasses or when creating a box programmatically. |
3989 |
Returns the button." |
|
3990 |
||
197 | 3991 |
^ self addAbortButtonLabelled:nil |
122 | 3992 |
! |
120 | 3993 |
|
162 | 3994 |
addAbortButton:aButton |
3995 |
"add an already created abortButton - to be sent from redefined initialize |
|
3996 |
methods in subclasses or when creating a box programmatically. |
|
3997 |
Returns the button." |
|
3998 |
||
1764 | 3999 |
<resource: #style (#'dialogBox.okAtLeft')> |
4000 |
||
162 | 4001 |
abortButton := aButton. |
4002 |
aButton model:self; change:#abortPressed. |
|
1764 | 4003 |
(styleSheet at:'dialogBox.okAtLeft' default:false) ifTrue:[ |
1763 | 4004 |
self addButton:aButton after:nil. |
4005 |
] ifFalse:[ |
|
4006 |
self addButton:aButton before:nil. |
|
4007 |
]. |
|
4008 |
^ aButton. |
|
162 | 4009 |
|
4010 |
"Created: 17.9.1995 / 20:17:26 / claus" |
|
4011 |
! |
|
4012 |
||
122 | 4013 |
addAbortButtonLabelled:buttonLabel |
4014 |
"create an abortButton with a label - to be sent from redefined initialize |
|
4015 |
methods in subclasses or when creating a box programmatically. |
|
4016 |
A nil argument creates one with the default label. |
|
4017 |
Returns the button." |
|
4018 |
||
162 | 4019 |
|aButton| |
4020 |
||
4021 |
aButton := Button abortButton. |
|
4022 |
buttonLabel notNil ifTrue:[aButton label:buttonLabel]. |
|
4023 |
^ self addAbortButton:aButton |
|
4024 |
||
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4025 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4026 |
|dialog| |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4027 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4028 |
dialog := DialogBox new. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4029 |
dialog addAbortButtonLabelled:'get out of here'. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4030 |
dialog addOkButtonLabelled:'yes thats ok'. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4031 |
dialog open. |
655 | 4032 |
dialog accepted ifTrue:[Transcript showCR:'yes']. |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4033 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4034 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4035 |
"Modified: 9.2.1996 / 22:09:40 / cg" |
120 | 4036 |
! |
76 | 4037 |
|
197 | 4038 |
addButton:aButton |
4039 |
"add a button into the buttonPanel. |
|
122 | 4040 |
Returns the button." |
120 | 4041 |
|
197 | 4042 |
^ self addButton:aButton after:nil |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4043 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4044 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4045 |
|dialog| |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4046 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4047 |
dialog := DialogBox new. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4048 |
dialog addAbortButton. |
655 | 4049 |
dialog addButton:(Button label:'foo' action:[Transcript showCR:'foo']). |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4050 |
dialog addOkButton. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4051 |
dialog open. |
655 | 4052 |
dialog accepted ifTrue:[Transcript showCR:'yes']. |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4053 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4054 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4055 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4056 |
|dialog| |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4057 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4058 |
dialog := DialogBox new. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4059 |
dialog addAbortButton. |
655 | 4060 |
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
|
4061 |
dialog addOkButton. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4062 |
dialog open. |
655 | 4063 |
dialog accepted ifTrue:[Transcript showCR:'yes']. |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4064 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4065 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4066 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4067 |
|dialog| |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4068 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4069 |
dialog := DialogBox new. |
655 | 4070 |
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
|
4071 |
dialog addAbortButton. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4072 |
dialog addOkButton. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4073 |
dialog open. |
655 | 4074 |
dialog accepted ifTrue:[Transcript showCR:'yes']. |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4075 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4076 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4077 |
"Modified: 9.2.1996 / 22:14:17 / cg" |
197 | 4078 |
! |
4079 |
||
4080 |
addButton:aButton after:someOtherButtonOrNil |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4081 |
"add a button into the buttonPanel. |
197 | 4082 |
If the argument someOtherButtonOrNil is nil, the button is |
4083 |
added at the end." |
|
4084 |
||
4085 |
|h| |
|
4086 |
||
4087 |
buttonPanel addSubView:aButton after:someOtherButtonOrNil. |
|
4088 |
buttonPanel subViews size > 1 ifTrue:[ |
|
1843 | 4089 |
buttonPanel horizontalLayout:#fitSpace. |
197 | 4090 |
]. |
4091 |
(h := (aButton heightIncludingBorder + (ViewSpacing * 2))) > buttonPanel topInset ifTrue:[ |
|
1843 | 4092 |
buttonPanel topInset:h negated |
197 | 4093 |
]. |
310
4bbc8deffc8c
allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents:
307
diff
changeset
|
4094 |
needResize := true. |
197 | 4095 |
^ aButton |
310
4bbc8deffc8c
allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents:
307
diff
changeset
|
4096 |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4097 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4098 |
|dialog| |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4099 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4100 |
dialog := DialogBox new. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4101 |
dialog addAbortButton. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4102 |
dialog addOkButton. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4103 |
dialog addButton:(Button |
1843 | 4104 |
label:'foo' |
4105 |
action:[dialog hide. Transcript showCR:'foo']) |
|
4106 |
after:(dialog okButton). |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4107 |
dialog open. |
655 | 4108 |
dialog accepted ifTrue:[Transcript showCR:'yes']. |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4109 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4110 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4111 |
|dialog| |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4112 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4113 |
dialog := DialogBox new. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4114 |
dialog addAbortButton. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4115 |
dialog addOkButton. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4116 |
dialog addButton:(Button |
1843 | 4117 |
label:'foo' |
4118 |
action:[dialog hide. Transcript showCR:'foo']) |
|
4119 |
after:(dialog abortButton). |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4120 |
dialog open. |
655 | 4121 |
dialog accepted ifTrue:[Transcript showCR:'yes']. |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4122 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4123 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4124 |
|dialog| |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4125 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4126 |
dialog := DialogBox new. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4127 |
dialog addAbortButton. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4128 |
dialog addOkButton. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4129 |
dialog addButton:(Button |
1843 | 4130 |
label:'foo' |
4131 |
action:[dialog hide. Transcript showCR:'foo']) |
|
4132 |
after:nil. |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4133 |
dialog open. |
655 | 4134 |
dialog accepted ifTrue:[Transcript showCR:'yes']. |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4135 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4136 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4137 |
"Modified: 9.2.1996 / 22:13:51 / cg" |
197 | 4138 |
! |
4139 |
||
353
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
4140 |
addButton:aButton before:someOtherButtonOrNil |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
4141 |
"add a button into the buttonPanel. |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
4142 |
If the argument someOtherButtonOrNil is nil, the button is |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
4143 |
added upFront." |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
4144 |
|
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
4145 |
|h| |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
4146 |
|
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
4147 |
buttonPanel addSubView:aButton before:someOtherButtonOrNil. |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
4148 |
buttonPanel subViews size > 1 ifTrue:[ |
1843 | 4149 |
buttonPanel horizontalLayout:#fitSpace. |
353
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
4150 |
]. |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
4151 |
(h := (aButton heightIncludingBorder + (ViewSpacing * 2))) > buttonPanel topInset ifTrue:[ |
1843 | 4152 |
buttonPanel topInset:h negated |
353
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
4153 |
]. |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
4154 |
needResize := true. |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
4155 |
^ aButton |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
4156 |
|
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
4157 |
" |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
4158 |
|dialog| |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
4159 |
|
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
4160 |
dialog := DialogBox new. |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
4161 |
dialog addAbortButton. |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
4162 |
dialog addOkButton. |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
4163 |
dialog addButton:(Button |
1843 | 4164 |
label:'foo' |
4165 |
action:[dialog hide. Transcript showCR:'foo']) |
|
4166 |
before:(dialog okButton). |
|
353
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
4167 |
dialog open. |
655 | 4168 |
dialog accepted ifTrue:[Transcript showCR:'yes']. |
353
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
4169 |
" |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
4170 |
" |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
4171 |
|dialog| |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
4172 |
|
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
4173 |
dialog := DialogBox new. |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
4174 |
dialog addAbortButton. |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
4175 |
dialog addOkButton. |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
4176 |
dialog addButton:(Button |
1843 | 4177 |
label:'foo' |
4178 |
action:[dialog hide. Transcript showCR:'foo']) |
|
4179 |
before:nil. |
|
353
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
4180 |
dialog open. |
655 | 4181 |
dialog accepted ifTrue:[Transcript showCR:'yes']. |
353
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
4182 |
" |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
4183 |
|
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
4184 |
"Modified: 9.2.1996 / 22:13:51 / cg" |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
4185 |
"Created: 10.2.1996 / 16:04:35 / cg" |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
4186 |
! |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
4187 |
|
593 | 4188 |
addHelpButtonFor:pathToHelpText |
4189 |
"add a help button to the buttonPanel. |
|
4190 |
The argument, pathToHelpText should specify the path to the help |
|
4191 |
text under either the doc/online/<language> or the help/<language> |
|
4192 |
directory." |
|
4193 |
||
1764 | 4194 |
<resource: #style (#'dialogBox.okAtLeft')> |
4195 |
||
593 | 4196 |
|helpButton| |
4197 |
||
4198 |
helpButton := Button label:(resources string:'help'). |
|
4199 |
helpButton action:[ |
|
1760
631f902aaabe
care for styleSheets right-to-left button order.
Claus Gittinger <cg@exept.de>
parents:
1759
diff
changeset
|
4200 |
self withWaitCursorDo:[HTMLDocumentView openFullOnHelpFile:pathToHelpText] |
631f902aaabe
care for styleSheets right-to-left button order.
Claus Gittinger <cg@exept.de>
parents:
1759
diff
changeset
|
4201 |
]. |
1764 | 4202 |
(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
|
4203 |
self addButton:helpButton after:nil. |
631f902aaabe
care for styleSheets right-to-left button order.
Claus Gittinger <cg@exept.de>
parents:
1759
diff
changeset
|
4204 |
] ifFalse:[ |
631f902aaabe
care for styleSheets right-to-left button order.
Claus Gittinger <cg@exept.de>
parents:
1759
diff
changeset
|
4205 |
self addButton:helpButton before:nil. |
631f902aaabe
care for styleSheets right-to-left button order.
Claus Gittinger <cg@exept.de>
parents:
1759
diff
changeset
|
4206 |
]. |
631f902aaabe
care for styleSheets right-to-left button order.
Claus Gittinger <cg@exept.de>
parents:
1759
diff
changeset
|
4207 |
^ helpButton |
593 | 4208 |
|
4209 |
" |
|
4210 |
|box| |
|
4211 |
||
4212 |
box := DialogBox new. |
|
4213 |
box |
|
1760
631f902aaabe
care for styleSheets right-to-left button order.
Claus Gittinger <cg@exept.de>
parents:
1759
diff
changeset
|
4214 |
addHelpButtonFor:'Launcher/compilerSettings.html'; |
631f902aaabe
care for styleSheets right-to-left button order.
Claus Gittinger <cg@exept.de>
parents:
1759
diff
changeset
|
4215 |
addAbortButton; |
631f902aaabe
care for styleSheets right-to-left button order.
Claus Gittinger <cg@exept.de>
parents:
1759
diff
changeset
|
4216 |
addOkButton. |
593 | 4217 |
|
4218 |
box open |
|
4219 |
" |
|
4220 |
||
659 | 4221 |
"Modified: 20.5.1996 / 20:30:55 / cg" |
831
8af010be0a02
Rename Launcher-->OldLauncher, NewLauncher-->Launcher.
Stefan Vogel <sv@exept.de>
parents:
807
diff
changeset
|
4222 |
"Modified: 9.9.1996 / 22:40:21 / stefan" |
593 | 4223 |
! |
4224 |
||
4225 |
addOkButton |
|
4226 |
"create an okButton - to be sent from redefined initialize |
|
4227 |
methods in subclasses or when creating a box programmatically. |
|
4228 |
Returns the button." |
|
4229 |
||
4230 |
^ self addOkButtonLabelled:nil |
|
4231 |
||
4232 |
" |
|
4233 |
|dialog| |
|
4234 |
||
4235 |
dialog := DialogBox new. |
|
4236 |
dialog addOkButton. |
|
4237 |
dialog open. |
|
655 | 4238 |
dialog accepted ifTrue:[Transcript showCR:'yes']. |
593 | 4239 |
" |
4240 |
||
4241 |
"Modified: 9.2.1996 / 21:37:02 / cg" |
|
4242 |
! |
|
4243 |
||
4244 |
addOkButton:aButton |
|
4245 |
"add an already created okButton - to be sent from redefined initialize |
|
4246 |
methods in subclasses or when creating a box programmatically. |
|
4247 |
Returns the button." |
|
4248 |
||
1764 | 4249 |
<resource: #style (#'dialogBox.okAtLeft')> |
4250 |
||
4251 |
"/ okButton isNil ifTrue:[ |
|
4252 |
okButton := aButton. |
|
4253 |
"/ ]. |
|
593 | 4254 |
aButton model:self; change:#okPressed. |
1764 | 4255 |
(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
|
4256 |
self addButton:aButton before:nil. |
631f902aaabe
care for styleSheets right-to-left button order.
Claus Gittinger <cg@exept.de>
parents:
1759
diff
changeset
|
4257 |
] ifFalse:[ |
631f902aaabe
care for styleSheets right-to-left button order.
Claus Gittinger <cg@exept.de>
parents:
1759
diff
changeset
|
4258 |
self addButton:aButton after:nil. |
631f902aaabe
care for styleSheets right-to-left button order.
Claus Gittinger <cg@exept.de>
parents:
1759
diff
changeset
|
4259 |
]. |
631f902aaabe
care for styleSheets right-to-left button order.
Claus Gittinger <cg@exept.de>
parents:
1759
diff
changeset
|
4260 |
^ aButton. |
593 | 4261 |
|
4262 |
" |
|
4263 |
|dialog b| |
|
4264 |
||
4265 |
b := Button label:((Image fromFile:'garfield.gif') magnifiedBy:0.5). |
|
4266 |
||
4267 |
dialog := DialogBox new. |
|
4268 |
dialog addOkButton:b. |
|
4269 |
dialog open. |
|
655 | 4270 |
dialog accepted ifTrue:[Transcript showCR:'yes']. |
593 | 4271 |
" |
4272 |
||
4273 |
"Modified: 17.9.1995 / 20:20:41 / claus" |
|
4274 |
"Modified: 9.2.1996 / 21:38:48 / cg" |
|
4275 |
! |
|
4276 |
||
4277 |
addOkButtonLabelled:buttonLabel |
|
4278 |
"create an okButton with a label - to be sent from redefined initialize |
|
4279 |
methods in subclasses or when creating a box programmatically. |
|
4280 |
A nil argument creates one with the default text. |
|
4281 |
Returns the button." |
|
4282 |
||
4283 |
|aButton| |
|
4284 |
||
4285 |
aButton := Button okButton. |
|
4286 |
buttonLabel notNil ifTrue:[aButton label:buttonLabel]. |
|
4287 |
aButton isReturnButton:acceptReturnAsOK. |
|
4288 |
^ self addOkButton:aButton. |
|
4289 |
||
4290 |
" |
|
4291 |
|dialog| |
|
4292 |
||
4293 |
dialog := DialogBox new. |
|
4294 |
dialog addOkButtonLabelled:'get out of here'. |
|
4295 |
dialog open. |
|
655 | 4296 |
dialog accepted ifTrue:[Transcript showCR:'yes']. |
593 | 4297 |
" |
4298 |
||
4299 |
"Modified: 9.2.1996 / 21:39:34 / cg" |
|
4300 |
! ! |
|
4301 |
||
4302 |
!DialogBox methodsFor:'construction-check & comboboxes'! |
|
4303 |
||
197 | 4304 |
addCheckBox:label on:aModel |
4305 |
"create a checkBox with label on aModel and add it. |
|
4306 |
Returns the box." |
|
4307 |
||
4308 |
^ self addCheckBox:label on:aModel tabable:true |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4309 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4310 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4311 |
|dialog check| |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4312 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4313 |
check := true asValue. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4314 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4315 |
dialog := DialogBox new. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4316 |
dialog addCheckBox:'on or off' on:check. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4317 |
dialog addOkButton. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4318 |
dialog open. |
655 | 4319 |
dialog accepted ifTrue:[Transcript showCR:check value]. |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4320 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4321 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4322 |
"Modified: 9.2.1996 / 22:15:38 / cg" |
197 | 4323 |
! |
4324 |
||
600 | 4325 |
addCheckBox:label on:aModel tabable:tabable |
4326 |
"create a checkBox with label on aModel and add it. |
|
4327 |
Returns the box." |
|
4328 |
||
4329 |
|b| |
|
4330 |
||
4331 |
b := CheckBox on:aModel. |
|
4332 |
b label:label. |
|
4333 |
self addComponent:b tabable:tabable. |
|
4334 |
^ b |
|
4335 |
||
4336 |
" |
|
4337 |
|dialog check1 check2 check3| |
|
4338 |
||
4339 |
check1 := true asValue. |
|
4340 |
check2 := false asValue. |
|
4341 |
check3 := true asValue. |
|
4342 |
||
4343 |
dialog := DialogBox new. |
|
4344 |
dialog addCheckBox:'on or off' on:check1 tabable:false. |
|
4345 |
dialog addHorizontalLine. |
|
4346 |
||
4347 |
dialog addCheckBox:'on or off' on:check2 tabable:true. |
|
4348 |
dialog addCheckBox:'on or off' on:check3 tabable:true. |
|
4349 |
dialog addOkButton. |
|
4350 |
dialog open. |
|
4351 |
" |
|
4352 |
||
4353 |
"Modified: 9.2.1996 / 22:16:49 / cg" |
|
4354 |
! |
|
4355 |
||
593 | 4356 |
addComboBoxOn:aModel |
4357 |
"create a comboBoxView on aModel and add it. |
|
4358 |
Returns the comboBoxView." |
|
4359 |
||
4360 |
^ self addComboBoxOn:aModel tabable:true |
|
4361 |
||
4362 |
" |
|
4363 |
without a list, the comboBox is disabled: |
|
4364 |
||
4365 |
|box val| |
|
4366 |
||
4367 |
val := 'some input' asValue. |
|
4368 |
||
4369 |
box := Dialog new. |
|
4370 |
||
4371 |
(box addTextLabel:'combo box example') adjust:#left. |
|
4372 |
box addVerticalSpace. |
|
4373 |
(box addComboBoxOn:val). |
|
4374 |
box addOkButton. |
|
4375 |
box open. |
|
4376 |
box accepted ifTrue:[ |
|
1401 | 4377 |
Transcript showCR:val value |
593 | 4378 |
]. |
4379 |
" |
|
4380 |
||
4381 |
"with a list, it can be pulled: |
|
4382 |
||
4383 |
|box val| |
|
4384 |
||
4385 |
val := '' asValue. |
|
4386 |
||
4387 |
box := Dialog new. |
|
4388 |
||
4389 |
(box addTextLabel:'combo box example') adjust:#left. |
|
4390 |
box addVerticalSpace. |
|
4391 |
(box addComboBoxOn:val) list:#('one' 'two' 'three' 'four'). |
|
4392 |
box addOkButton. |
|
4393 |
box open. |
|
4394 |
box accepted ifTrue:[ |
|
1401 | 4395 |
Transcript showCR:val value |
593 | 4396 |
]. |
4397 |
" |
|
4398 |
||
4399 |
"Modified: 28.2.1996 / 15:17:39 / cg" |
|
4400 |
"Created: 4.3.1996 / 17:21:45 / cg" |
|
4401 |
! |
|
4402 |
||
4403 |
addComboBoxOn:aModel tabable:tabable |
|
4404 |
"create a comboBoxView on aModel and add it. |
|
4405 |
Returns the comboBoxView." |
|
4406 |
||
4407 |
|f| |
|
4408 |
||
4409 |
f := ComboBoxView new. |
|
4410 |
f model:aModel. |
|
4411 |
self addComponent:f tabable:tabable. |
|
4412 |
tabable ifTrue:[ |
|
1401 | 4413 |
self addToInputFieldGroup:f editor. |
593 | 4414 |
]. |
4415 |
^ f |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4416 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4417 |
" |
593 | 4418 |
without a list, the comboBox is disabled: |
4419 |
||
4420 |
|box val| |
|
4421 |
||
4422 |
val := 'some input' asValue. |
|
4423 |
||
4424 |
box := Dialog new. |
|
4425 |
||
4426 |
(box addTextLabel:'combo box example') adjust:#left. |
|
4427 |
box addVerticalSpace. |
|
4428 |
(box addComboBoxOn:val tabable:true). |
|
4429 |
box addOkButton. |
|
4430 |
box open. |
|
4431 |
box accepted ifTrue:[ |
|
1401 | 4432 |
Transcript showCR:val value |
593 | 4433 |
]. |
4434 |
" |
|
4435 |
||
4436 |
"with a list, it can be pulled: |
|
4437 |
||
4438 |
|box val| |
|
4439 |
||
4440 |
val := '' asValue. |
|
4441 |
||
4442 |
box := Dialog new. |
|
4443 |
||
4444 |
(box addTextLabel:'combo box example') adjust:#left. |
|
4445 |
box addVerticalSpace. |
|
4446 |
(box addComboBoxOn:val tabable:true) list:#('one' 'two' 'three' 'four'). |
|
4447 |
box addOkButton. |
|
4448 |
box open. |
|
4449 |
box accepted ifTrue:[ |
|
1401 | 4450 |
Transcript showCR:val value |
593 | 4451 |
]. |
4452 |
" |
|
4453 |
||
4454 |
"Modified: 4.3.1996 / 17:21:57 / cg" |
|
4455 |
! |
|
4456 |
||
4457 |
addComboListOn:aModel |
|
4458 |
"create a comboListView on aModel and add it. |
|
4459 |
Returns the comboListView." |
|
4460 |
||
4461 |
^ self addComboListOn:aModel tabable:true |
|
4462 |
||
4463 |
"without a list, the comboList is disabled: |
|
4464 |
||
4465 |
|box val| |
|
4466 |
||
4467 |
val := 'some input' asValue. |
|
4468 |
||
4469 |
box := Dialog new. |
|
4470 |
||
4471 |
(box addTextLabel:'combo list example') adjust:#left. |
|
4472 |
box addVerticalSpace. |
|
4473 |
(box addComboListOn:val). |
|
4474 |
box addOkButton. |
|
4475 |
box open. |
|
4476 |
box accepted ifTrue:[ |
|
1401 | 4477 |
Transcript showCR:val value |
593 | 4478 |
]. |
4479 |
" |
|
4480 |
||
4481 |
"with a list, it can be pulled: |
|
4482 |
||
4483 |
|box val| |
|
4484 |
||
4485 |
val := '' asValue. |
|
4486 |
||
4487 |
box := Dialog new. |
|
4488 |
||
4489 |
(box addTextLabel:'combo box example') adjust:#left. |
|
4490 |
box addVerticalSpace. |
|
4491 |
(box addComboListOn:val) list:#('one' 'two' 'three' 'four'). |
|
4492 |
box addOkButton. |
|
4493 |
box open. |
|
4494 |
box accepted ifTrue:[ |
|
1401 | 4495 |
Transcript showCR:val value |
593 | 4496 |
]. |
4497 |
" |
|
4498 |
||
4499 |
"Created: 28.2.1996 / 15:16:34 / cg" |
|
4500 |
"Modified: 4.3.1996 / 17:22:59 / cg" |
|
4501 |
! |
|
4502 |
||
4503 |
addComboListOn:aModel tabable:tabable |
|
4504 |
"create a comboListView on aModel and add it. |
|
4505 |
Returns the comboListView." |
|
4506 |
||
4507 |
|f| |
|
4508 |
||
4509 |
f := ComboListView new. |
|
4510 |
f model:aModel. |
|
4511 |
self addComponent:f tabable:tabable. |
|
4512 |
^ f |
|
4513 |
||
4514 |
"without a list, the comboList is disabled: |
|
4515 |
||
4516 |
|box val| |
|
4517 |
||
4518 |
val := 'some input' asValue. |
|
4519 |
||
4520 |
box := Dialog new. |
|
4521 |
||
4522 |
(box addTextLabel:'combo list example') adjust:#left. |
|
4523 |
box addVerticalSpace. |
|
4524 |
(box addComboListOn:val tabable:true). |
|
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 addComboListOn:val tabable:true) 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 |
"Created: 28.2.1996 / 15:16:34 / cg" |
|
4551 |
"Modified: 4.3.1996 / 17:23:38 / cg" |
|
4552 |
! ! |
|
4553 |
||
4554 |
!DialogBox methodsFor:'construction-inputfields'! |
|
4555 |
||
4556 |
addFilenameInputFieldOn:aModel in:aDirectory tabable:tabable |
|
4557 |
"create a fileName input field on aModel and add it. |
|
4558 |
Returns the field. This is much like a normal input field, |
|
4559 |
but supports filename completion." |
|
4560 |
||
4561 |
|f| |
|
4562 |
||
4563 |
f := FilenameEditField new. |
|
4564 |
aDirectory notNil ifTrue:[f directory:aDirectory]. |
|
4565 |
f model:aModel. |
|
4566 |
self addInputField:f tabable:tabable. |
|
4567 |
^ f |
|
4568 |
! |
|
4569 |
||
4570 |
addInputField:aField |
|
4571 |
"add an already created input field. |
|
4572 |
Returns the field." |
|
4573 |
||
4574 |
^ self addInputField:aField tabable:true |
|
4575 |
||
4576 |
"Modified: 9.2.1996 / 20:46:16 / cg" |
|
4577 |
! |
|
4578 |
||
4579 |
addInputField:aField tabable:tabable |
|
4580 |
"add an already created input field. |
|
4581 |
If tabable is true, the field is put into a group, to allow |
|
4582 |
stepping through the fields with #Cursor/#Return keys. |
|
4583 |
Returns the field." |
|
4584 |
||
4585 |
self addComponent:aField tabable:tabable. |
|
4586 |
tabable ifTrue:[ |
|
1401 | 4587 |
self addToInputFieldGroup:aField. |
593 | 4588 |
]. |
4589 |
^ aField |
|
4590 |
||
739
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
4591 |
"Modified: 31.5.1996 / 21:22:29 / cg" |
593 | 4592 |
! |
4593 |
||
4594 |
addInputFieldOn:aModel |
|
4595 |
"create an input field on aModel and add it. |
|
4596 |
Returns the field." |
|
4597 |
||
4598 |
^ self addInputFieldOn:aModel tabable:true |
|
4599 |
||
4600 |
" |
|
4601 |
|dialog model field| |
|
4602 |
||
4603 |
model := '' asValue. |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4604 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4605 |
dialog := DialogBox new. |
593 | 4606 |
(dialog addTextLabel:'enter a string') adjust:#left. |
4607 |
||
4608 |
field := dialog addInputFieldOn:model. |
|
4609 |
||
4610 |
dialog addAbortButton; addOkButton. |
|
4611 |
dialog open. |
|
655 | 4612 |
dialog accepted ifTrue:[Transcript showCR:model value]. |
593 | 4613 |
" |
4614 |
||
4615 |
"Modified: 9.2.1996 / 21:34:14 / cg" |
|
4616 |
! |
|
4617 |
||
4618 |
addInputFieldOn:aModel tabable:tabable |
|
4619 |
"create an input field on aModel and add it. |
|
4620 |
If tabable is false, the field cannot be tabbed into |
|
4621 |
and return does not close the box. |
|
4622 |
(pointer must be moved into it). |
|
4623 |
Returns the field." |
|
4624 |
||
4625 |
|f| |
|
4626 |
||
913 | 4627 |
f := EditField model:aModel. |
593 | 4628 |
self addInputField:f tabable:tabable. |
4629 |
^ f |
|
4630 |
||
4631 |
" a non-tabable field: |
|
4632 |
||
4633 |
|dialog model field| |
|
4634 |
||
4635 |
model := '' asValue. |
|
4636 |
||
4637 |
dialog := DialogBox new. |
|
4638 |
(dialog addTextLabel:'enter a string') adjust:#left. |
|
4639 |
||
4640 |
field := dialog addInputFieldOn:model tabable:false. |
|
4641 |
||
4642 |
dialog addAbortButton; addOkButton. |
|
4643 |
dialog open. |
|
655 | 4644 |
dialog accepted ifTrue:[Transcript showCR:model value]. |
593 | 4645 |
" |
4646 |
||
4647 |
"Modified: 9.2.1996 / 21:36:16 / cg" |
|
913 | 4648 |
"Modified: 3.1.1997 / 10:24:04 / stefan" |
593 | 4649 |
! |
4650 |
||
745
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
4651 |
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
|
4652 |
"add a label and an inputField side-by-side. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
4653 |
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
|
4654 |
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
|
4655 |
The inputField gets model as its model. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
4656 |
Return the inputField." |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
4657 |
|
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
4658 |
|
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
4659 |
^ self |
1401 | 4660 |
addLabelledField:(EditField on:model) label:labelString |
4661 |
adjust:labelAdjust |
|
4662 |
tabable:tabable |
|
4663 |
from:leftX to:rightX |
|
4664 |
separateAtX:relativeX. |
|
745
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
4665 |
|
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
4666 |
" |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
4667 |
|dialog model field| |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
4668 |
|
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
4669 |
model := '' asValue. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
4670 |
|
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
4671 |
dialog := DialogBox new. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
4672 |
|
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
4673 |
field := dialog |
1401 | 4674 |
addLabelledInputField:'enter a string' |
4675 |
adjust:#left |
|
4676 |
on:model |
|
4677 |
tabable:true |
|
4678 |
separateAtX:0.3. |
|
745
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
4679 |
|
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
4680 |
dialog addAbortButton; addOkButton. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
4681 |
dialog open. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
4682 |
dialog accepted ifTrue:[Transcript showCR:model value]. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
4683 |
" |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
4684 |
|
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
4685 |
" |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
4686 |
|dialog model1 model2 field| |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
4687 |
|
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
4688 |
model1 := '' asValue. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
4689 |
model2 := '' asValue. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
4690 |
|
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
4691 |
dialog := DialogBox new. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
4692 |
|
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
4693 |
dialog addTextLabel:'a two-input box'. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
4694 |
dialog addHorizontalLine. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
4695 |
|
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
4696 |
field := dialog |
1401 | 4697 |
addLabelledInputField:'string1:' |
4698 |
adjust:#right |
|
4699 |
on:model1 |
|
4700 |
tabable:true |
|
4701 |
separateAtX:0.4. |
|
745
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
4702 |
|
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
4703 |
field := dialog |
1401 | 4704 |
addLabelledInputField:'string2:' |
4705 |
adjust:#right |
|
4706 |
on:model2 |
|
4707 |
tabable:true |
|
4708 |
separateAtX:0.4. |
|
745
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
4709 |
|
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
4710 |
dialog addAbortButton; addOkButton. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
4711 |
dialog open. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
4712 |
dialog accepted ifTrue:[ |
1401 | 4713 |
Transcript showCR:model1 value. |
4714 |
Transcript showCR:model2 value. |
|
745
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
4715 |
]. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
4716 |
" |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
4717 |
|
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
4718 |
"Modified: 19.4.1996 / 17:39:46 / cg" |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
4719 |
"Created: 3.6.1996 / 11:04:23 / cg" |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
4720 |
! |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
4721 |
|
593 | 4722 |
addLabelledInputField:labelString adjust:labelAdjust on:model tabable:tabable separateAtX:relativeX |
4723 |
"add a label and an inputField side-by-side. |
|
4724 |
The labels goes from 0.0 to relativeX; the inputField from relativeX to 1.0. |
|
4725 |
The labels string is defined by labelString and adjusted according to labelAdjust. |
|
4726 |
The inputField gets model as its model. |
|
4727 |
Return the inputField." |
|
4728 |
||
4729 |
||
4730 |
^ self |
|
1401 | 4731 |
addLabelledField:(EditField on:model) label:labelString |
4732 |
adjust:labelAdjust |
|
4733 |
tabable:tabable |
|
4734 |
separateAtX:relativeX. |
|
593 | 4735 |
|
4736 |
" |
|
4737 |
|dialog model field| |
|
4738 |
||
4739 |
model := '' asValue. |
|
4740 |
||
4741 |
dialog := DialogBox new. |
|
4742 |
||
4743 |
field := dialog |
|
1401 | 4744 |
addLabelledInputField:'enter a string' |
4745 |
adjust:#left |
|
4746 |
on:model |
|
4747 |
tabable:true |
|
4748 |
separateAtX:0.3. |
|
593 | 4749 |
|
4750 |
dialog addAbortButton; addOkButton. |
|
4751 |
dialog open. |
|
655 | 4752 |
dialog accepted ifTrue:[Transcript showCR:model value]. |
593 | 4753 |
" |
4754 |
||
4755 |
" |
|
4756 |
|dialog model1 model2 field| |
|
4757 |
||
4758 |
model1 := '' asValue. |
|
4759 |
model2 := '' asValue. |
|
4760 |
||
4761 |
dialog := DialogBox new. |
|
4762 |
||
4763 |
dialog addTextLabel:'a two-input box'. |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4764 |
dialog addHorizontalLine. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4765 |
|
593 | 4766 |
field := dialog |
1401 | 4767 |
addLabelledInputField:'string1:' |
4768 |
adjust:#right |
|
4769 |
on:model1 |
|
4770 |
tabable:true |
|
4771 |
separateAtX:0.4. |
|
593 | 4772 |
|
4773 |
field := dialog |
|
1401 | 4774 |
addLabelledInputField:'string2:' |
4775 |
adjust:#right |
|
4776 |
on:model2 |
|
4777 |
tabable:true |
|
4778 |
separateAtX:0.4. |
|
593 | 4779 |
|
4780 |
dialog addAbortButton; addOkButton. |
|
4781 |
dialog open. |
|
4782 |
dialog accepted ifTrue:[ |
|
1401 | 4783 |
Transcript showCR:model1 value. |
4784 |
Transcript showCR:model2 value. |
|
593 | 4785 |
]. |
4786 |
" |
|
4787 |
||
4788 |
"Created: 13.4.1996 / 13:41:31 / cg" |
|
4789 |
"Modified: 19.4.1996 / 17:39:46 / cg" |
|
4790 |
! ! |
|
4791 |
||
4792 |
!DialogBox methodsFor:'construction-layout'! |
|
4793 |
||
4794 |
addHorizontalLine |
|
4795 |
"add a horizontal line as separator" |
|
4796 |
||
4797 |
^ self addComponent:(Separator new extent:1.0 @ 5). |
|
4798 |
||
4799 |
" |
|
4800 |
|dialog| |
|
4801 |
||
4802 |
dialog := DialogBox new. |
|
4803 |
dialog |
|
1401 | 4804 |
addTextLabel:'some title string'; |
4805 |
addHorizontalLine; |
|
4806 |
addTextLabel:'more text'; |
|
4807 |
addOkButton; |
|
4808 |
open. |
|
593 | 4809 |
" |
4810 |
||
4811 |
" |
|
4812 |
|dialog| |
|
4813 |
||
4814 |
dialog := DialogBox new. |
|
4815 |
dialog |
|
1401 | 4816 |
addTextLabel:'some title string'; |
4817 |
addHorizontalLine; |
|
4818 |
addTextLabel:'more text'. |
|
593 | 4819 |
(dialog addHorizontalLine) width:20. |
4820 |
dialog addTextLabel:'more text'. |
|
4821 |
(dialog addHorizontalLine) width:20. |
|
4822 |
dialog |
|
1401 | 4823 |
addTextLabel:'more text'; |
4824 |
addHorizontalLine; |
|
4825 |
addOkButton; |
|
4826 |
open. |
|
593 | 4827 |
" |
4828 |
||
4829 |
"Modified: 19.4.1996 / 15:11:30 / cg" |
|
4830 |
! |
|
4831 |
||
4832 |
addVerticalSpace |
|
4833 |
"add a default vertical space (1 mm)" |
|
4834 |
||
4835 |
self addVerticalSpace:(ViewSpacing). |
|
4836 |
||
4837 |
" |
|
4838 |
|dialog| |
|
4839 |
||
4840 |
dialog := DialogBox new. |
|
4841 |
dialog addTextLabel:'some title string'. |
|
4842 |
dialog addVerticalSpace. |
|
4843 |
dialog addTextLabel:'more text'. |
|
4844 |
||
4845 |
dialog addOkButton. |
|
4846 |
dialog open. |
|
4847 |
" |
|
4848 |
||
4849 |
"Modified: 9.2.1996 / 21:41:10 / cg" |
|
4850 |
! |
|
4851 |
||
4852 |
addVerticalSpace:nPixel |
|
4853 |
"add some pixels of space to the next component" |
|
4854 |
||
4855 |
yPosition := yPosition + nPixel. |
|
4856 |
needResize := true. |
|
4857 |
||
4858 |
" |
|
4859 |
|dialog| |
|
4860 |
||
4861 |
dialog := DialogBox new. |
|
4862 |
dialog addTextLabel:'some title string'. |
|
4863 |
dialog addVerticalSpace:50. |
|
4864 |
dialog addTextLabel:'more text'. |
|
4865 |
||
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4866 |
dialog addOkButton. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4867 |
dialog open. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4868 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4869 |
|
593 | 4870 |
"Modified: 9.2.1996 / 21:41:23 / cg" |
4871 |
! |
|
4872 |
||
4873 |
leftIndent |
|
4874 |
"return the current indent |
|
4875 |
(current x position - thats where the next component will be located)." |
|
4876 |
||
4877 |
^ leftIndent |
|
4878 |
||
4879 |
"Modified: 27.1.1996 / 18:21:31 / cg" |
|
4880 |
! |
|
4881 |
||
4882 |
leftIndent:aNumber |
|
4883 |
"set the left indent (current x position - thats where the next component |
|
4884 |
will be located)." |
|
4885 |
||
4886 |
leftIndent := aNumber. |
|
4887 |
needResize := true. |
|
4888 |
||
4889 |
" |
|
4890 |
|dialog| |
|
4891 |
||
4892 |
dialog := DialogBox new. |
|
4893 |
(dialog addTextLabel:'label1') adjust:#left. |
|
4894 |
dialog leftIndent:20. |
|
4895 |
(dialog addTextLabel:'label2') adjust:#left. |
|
4896 |
dialog leftIndent:40. |
|
4897 |
(dialog addTextLabel:'label3') adjust:#left. |
|
4898 |
dialog leftIndent:60. |
|
4899 |
(dialog addTextLabel:'label4') adjust:#left. |
|
4900 |
||
4901 |
dialog addOkButton. |
|
4902 |
dialog open. |
|
4903 |
" |
|
4904 |
||
4905 |
"Modified: 9.2.1996 / 21:42:20 / cg" |
|
4906 |
! |
|
4907 |
||
4908 |
rightIndent |
|
4909 |
"return the current right indent." |
|
4910 |
||
4911 |
^ rightIndent |
|
4912 |
||
4913 |
"Modified: 27.1.1996 / 18:21:31 / cg" |
|
4914 |
! |
|
4915 |
||
4916 |
rightIndent:aNumber |
|
4917 |
"set the right indent" |
|
4918 |
||
4919 |
rightIndent := aNumber. |
|
4920 |
needResize := true. |
|
4921 |
||
4922 |
" |
|
4923 |
|dialog| |
|
4924 |
||
4925 |
dialog := DialogBox new. |
|
4926 |
(dialog addTextLabel:'label1') adjust:#right. |
|
4927 |
dialog rightIndent:20. |
|
4928 |
(dialog addTextLabel:'label2') adjust:#right. |
|
4929 |
dialog rightIndent:40. |
|
4930 |
(dialog addTextLabel:'label3') adjust:#right. |
|
4931 |
dialog rightIndent:60. |
|
4932 |
(dialog addTextLabel:'label4') adjust:#right. |
|
4933 |
||
4934 |
dialog addOkButton. |
|
4935 |
dialog open. |
|
4936 |
" |
|
4937 |
||
4938 |
"Modified: 9.2.1996 / 21:42:46 / cg" |
|
4939 |
! |
|
4940 |
||
4941 |
stickAtBottomWithFixHeight:aComponent |
|
4942 |
"arrange for a component to be positioned at a constant offset |
|
4943 |
from the bottom of the box and its height to remain the same. |
|
4944 |
This will keep the component at a constant distance from the bottom |
|
4945 |
(without this setup, it would stay at a constant offset from the top)" |
|
4946 |
||
1949
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
4947 |
self stickAtBottomWithFixHeight:aComponent left:0.0 right:1.0 |
593 | 4948 |
|
4949 |
" |
|
4950 |
compare the resizing behavior of: |
|
4951 |
||
1949
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
4952 |
|box| |
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
4953 |
|
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
4954 |
box := Dialog new. |
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
4955 |
box addTextLabel:'hello'. |
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
4956 |
box addTextLabel:'hello2'. |
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
4957 |
box addOkButton. |
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
4958 |
box show |
593 | 4959 |
|
4960 |
with: |
|
4961 |
||
1949
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
4962 |
|box l2| |
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
4963 |
|
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
4964 |
box := Dialog new. |
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
4965 |
box addTextLabel:'hello'. |
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
4966 |
l2 := box addTextLabel:'hello2'. |
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
4967 |
box addOkButton. |
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
4968 |
box stickAtBottomWithFixHeight:l2. |
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
4969 |
box show |
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
4970 |
" |
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
4971 |
|
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
4972 |
"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
|
4973 |
"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
|
4974 |
! |
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
4975 |
|
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
4976 |
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
|
4977 |
"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
|
4978 |
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
|
4979 |
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
|
4980 |
(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
|
4981 |
|
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
4982 |
self resize. |
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
4983 |
|
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
4984 |
aComponent |
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
4985 |
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
|
4986 |
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
|
4987 |
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
|
4988 |
|
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
4989 |
" |
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
4990 |
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
|
4991 |
|
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
4992 |
|box| |
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
4993 |
|
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
4994 |
box := Dialog new. |
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
4995 |
box addTextLabel:'hello'. |
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
4996 |
box addTextLabel:'hello2'. |
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
4997 |
box addOkButton. |
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
4998 |
box show |
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
4999 |
|
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
5000 |
with: |
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
5001 |
|
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
5002 |
|box l2| |
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
5003 |
|
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
5004 |
box := Dialog new. |
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
5005 |
box addTextLabel:'hello'. |
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
5006 |
l2 := box addTextLabel:'hello2'. |
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
5007 |
box addOkButton. |
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
5008 |
box stickAtBottomWithFixHeight:l2. |
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
5009 |
box show |
593 | 5010 |
" |
5011 |
||
5012 |
"Created: 27.1.1996 / 17:17:41 / cg" |
|
5013 |
"Modified: 27.1.1996 / 18:29:03 / cg" |
|
5014 |
! |
|
5015 |
||
5016 |
stickAtBottomWithVariableHeight:aComponent |
|
5017 |
"arrange for a component to be positioned at a constant offset |
|
5018 |
from the bottom of the box and its height to be adjusted. |
|
5019 |
This will resize the component for a constant distance from the top, |
|
5020 |
and the bottom. |
|
5021 |
(without this setup, its height would remain constant)" |
|
5022 |
||
5023 |
self resize. |
|
5024 |
||
5025 |
aComponent |
|
1401 | 5026 |
bottomInset:(self height - aComponent bottom); |
5027 |
corner:1.0@1.0. |
|
593 | 5028 |
|
5029 |
" |
|
5030 |
compare the resizing behavior of: |
|
5031 |
||
1401 | 5032 |
|box| |
5033 |
||
5034 |
box := Dialog new. |
|
5035 |
box addTextLabel:'hello'. |
|
5036 |
(box addComponent:(SelectionInListView new)) level:-1. |
|
5037 |
box addOkButton. |
|
5038 |
box show |
|
593 | 5039 |
|
5040 |
with: |
|
5041 |
||
1401 | 5042 |
|box list| |
5043 |
||
5044 |
box := Dialog new. |
|
5045 |
box addTextLabel:'hello'. |
|
5046 |
list := (box addComponent:(SelectionInListView new)) level:-1. |
|
5047 |
box addOkButton. |
|
5048 |
box stickAtBottomWithVariableHeight:list. |
|
5049 |
box show |
|
593 | 5050 |
" |
5051 |
||
5052 |
"Modified: 27.4.1996 / 18:34:20 / cg" |
|
5053 |
! |
|
5054 |
||
5055 |
yPosition |
|
5056 |
"return the current y position (thats where the next component |
|
5057 |
will be located)." |
|
5058 |
||
5059 |
^ yPosition |
|
120 | 5060 |
! |
5061 |
||
593 | 5062 |
yPosition:aNumber |
5063 |
"set the current y position (thats where the next component |
|
5064 |
will be located)." |
|
5065 |
||
5066 |
yPosition := aNumber. |
|
5067 |
needResize := true. |
|
5068 |
||
5069 |
" |
|
5070 |
|dialog pos| |
|
5071 |
||
5072 |
dialog := DialogBox new. |
|
5073 |
pos := dialog yPosition. |
|
5074 |
(dialog addTextLabel:'label1') width:0.5. |
|
5075 |
dialog yPosition:pos. |
|
5076 |
(dialog addTextLabel:'label2') width:0.5; left:0.5. |
|
5077 |
||
5078 |
dialog addOkButton. |
|
5079 |
dialog open. |
|
5080 |
" |
|
5081 |
||
5082 |
" |
|
5083 |
|dialog pos| |
|
5084 |
||
5085 |
dialog := DialogBox new. |
|
5086 |
pos := dialog yPosition. |
|
5087 |
#('one' 'two' 'three' 'four') |
|
5088 |
with:#(0.0 0.25 0.5 0.75) do:[:lbl :x | |
|
1401 | 5089 |
dialog yPosition:pos. |
5090 |
(dialog addComponent:(Button label:lbl) tabable:true) |
|
5091 |
width:0.25; left:x. |
|
593 | 5092 |
]. |
5093 |
||
5094 |
dialog addOkButton. |
|
5095 |
dialog open. |
|
5096 |
" |
|
5097 |
||
5098 |
"Modified: 9.2.1996 / 21:46:40 / cg" |
|
5099 |
! ! |
|
5100 |
||
5101 |
!DialogBox methodsFor:'construction-lists'! |
|
5102 |
||
5103 |
addListBoxOn:aModel |
|
5104 |
"add a selectionInListView to the box. |
|
5105 |
The listViews ScrollWrapper is returned" |
|
5106 |
||
5107 |
^ self |
|
1401 | 5108 |
addListBoxOn:aModel |
5109 |
withNumberOfLines:nil |
|
5110 |
hScrollable:false |
|
5111 |
vScrollable:true. |
|
593 | 5112 |
|
5113 |
" |
|
5114 |
|dialog model listView| |
|
5115 |
||
5116 |
model := SelectionInList new. |
|
5117 |
model list:#('one' 'two' 'three' 'four'). |
|
5118 |
model selectionIndex:2. |
|
5119 |
||
5120 |
dialog := DialogBox new. |
|
5121 |
(dialog addTextLabel:'select any') adjust:#left. |
|
5122 |
||
5123 |
listView := dialog addListBoxOn:model. |
|
5124 |
||
5125 |
dialog addAbortButton; addOkButton. |
|
5126 |
dialog open. |
|
5127 |
||
655 | 5128 |
dialog accepted ifTrue:[Transcript show:'selection is:'; showCR:model selection]. |
593 | 5129 |
" |
5130 |
||
5131 |
"Modified: 27.4.1996 / 18:27:58 / cg" |
|
5132 |
! |
|
5133 |
||
5134 |
addListBoxOn:aModel class:aListViewClass |
|
5135 |
"create & add an instance of aListViewClass to the box. |
|
5136 |
The listViews ScrollWrapper is returned" |
|
5137 |
||
5138 |
^ self |
|
1401 | 5139 |
addListBoxOn:aModel |
5140 |
class:aListViewClass |
|
5141 |
withNumberOfLines:nil |
|
5142 |
hScrollable:false |
|
5143 |
vScrollable:true. |
|
593 | 5144 |
|
5145 |
"Created: 19.4.1996 / 13:06:14 / cg" |
|
5146 |
"Modified: 27.4.1996 / 18:27:53 / cg" |
|
5147 |
! |
|
5148 |
||
5149 |
addListBoxOn:aModel class:aListViewClass withNumberOfLines:numLines |
|
5150 |
"create and add an instance of aListViewClass to the box. |
|
5151 |
The list has numLines (if nonNil) number of lines shown. |
|
5152 |
The listViews ScrollWrapper is returned" |
|
5153 |
||
5154 |
^ self |
|
1401 | 5155 |
addListBoxOn:aModel |
5156 |
class:aListViewClass |
|
5157 |
withNumberOfLines:numLines |
|
5158 |
hScrollable:false |
|
5159 |
vScrollable:true. |
|
593 | 5160 |
|
5161 |
"Created: 19.4.1996 / 13:05:05 / cg" |
|
5162 |
"Modified: 27.4.1996 / 18:27:48 / cg" |
|
5163 |
! |
|
5164 |
||
5165 |
addListBoxOn:aModel class:aListViewClass withNumberOfLines:numLines hScrollable:hs vScrollable:vs |
|
766 | 5166 |
"add an instance of aListViewClass (selectionInListView) to the box. |
593 | 5167 |
The list has numLines (if nonNil) number of lines shown. |
5168 |
If scrolled, the ScrollWrapper is returned - otherwise the listView." |
|
5169 |
||
766 | 5170 |
|l| |
5171 |
||
5172 |
l := self addTextBoxOn:aModel class:aListViewClass withNumberOfLines:numLines hScrollable:hs vScrollable:vs. |
|
593 | 5173 |
l doubleClickAction:[:name | self okPressed]. |
766 | 5174 |
^ l |
593 | 5175 |
|
5176 |
" |
|
5177 |
|dialog listView| |
|
5178 |
||
5179 |
dialog := DialogBox new. |
|
5180 |
(dialog addTextLabel:'select any') adjust:#left. |
|
5181 |
||
5182 |
listView := dialog |
|
1401 | 5183 |
addListBoxOn:nil |
5184 |
class:FileSelectionList |
|
5185 |
withNumberOfLines:10 |
|
5186 |
hScrollable:false |
|
5187 |
vScrollable:false. |
|
593 | 5188 |
|
5189 |
listView directory:'/etc'. |
|
5190 |
||
5191 |
dialog addAbortButton; addOkButton. |
|
5192 |
dialog open. |
|
5193 |
||
655 | 5194 |
dialog accepted ifTrue:[Transcript show:'selection is:'; showCR:listView selectionValue]. |
593 | 5195 |
" |
5196 |
||
5197 |
"Created: 22.2.1996 / 15:40:07 / cg" |
|
5198 |
"Modified: 27.4.1996 / 18:26:15 / cg" |
|
766 | 5199 |
"Modified: 15.6.1996 / 00:31:20 / stefan" |
593 | 5200 |
! |
5201 |
||
5202 |
addListBoxOn:aModel withNumberOfLines:numLines |
|
5203 |
"add a selectionInListView to the box. |
|
5204 |
The list has numLines (if nonNil) number of lines shown. |
|
5205 |
The listViews ScrollWrapper is returned" |
|
5206 |
||
5207 |
^ self |
|
1401 | 5208 |
addListBoxOn:aModel |
5209 |
withNumberOfLines:numLines |
|
5210 |
hScrollable:false |
|
5211 |
vScrollable:true. |
|
593 | 5212 |
|
5213 |
" |
|
5214 |
|dialog model listView| |
|
5215 |
||
5216 |
model := SelectionInList new. |
|
5217 |
model list:#('one' 'two' 'three' 'four'). |
|
5218 |
model selectionIndex:2. |
|
5219 |
||
5220 |
dialog := DialogBox new. |
|
5221 |
(dialog addTextLabel:'select any') adjust:#left. |
|
5222 |
||
5223 |
listView := dialog addListBoxOn:model withNumberOfLines:3. |
|
5224 |
||
5225 |
dialog addAbortButton; addOkButton. |
|
5226 |
dialog open. |
|
5227 |
||
655 | 5228 |
dialog accepted ifTrue:[Transcript show:'selection is:'; showCR:model selection]. |
593 | 5229 |
" |
5230 |
||
5231 |
"Created: 22.2.1996 / 15:40:07 / cg" |
|
5232 |
"Modified: 27.4.1996 / 18:27:42 / cg" |
|
5233 |
! |
|
5234 |
||
5235 |
addListBoxOn:aModel withNumberOfLines:numLines hScrollable:hs vScrollable:vs |
|
5236 |
"add a selectionInListView to the box. |
|
5237 |
The list has numLines (if nonNil) number of lines shown. |
|
5238 |
If scrolled, the ScrollWrapper is returned - otherwise the listView." |
|
5239 |
||
5240 |
^ self |
|
1401 | 5241 |
addListBoxOn:aModel |
5242 |
class:SelectionInListView |
|
5243 |
withNumberOfLines:numLines |
|
5244 |
hScrollable:hs |
|
5245 |
vScrollable:vs |
|
593 | 5246 |
|
5247 |
" |
|
5248 |
|dialog model listView| |
|
5249 |
||
5250 |
model := SelectionInList new. |
|
5251 |
model list:#('one' 'two' 'three' 'four'). |
|
5252 |
model selectionIndex:2. |
|
5253 |
||
5254 |
dialog := DialogBox new. |
|
5255 |
(dialog addTextLabel:'select any') adjust:#left. |
|
5256 |
||
5257 |
listView := dialog addListBoxOn:model withNumberOfLines:3 hScrollable:true vScrollable:true. |
|
5258 |
||
5259 |
dialog addAbortButton; addOkButton. |
|
5260 |
dialog open. |
|
5261 |
||
655 | 5262 |
dialog accepted ifTrue:[Transcript show:'selection is:'; showCR:model selection]. |
593 | 5263 |
" |
5264 |
||
5265 |
" |
|
5266 |
|dialog model listView| |
|
5267 |
||
5268 |
model := SelectionInList new. |
|
5269 |
model list:#('one' 'two' 'three' 'four'). |
|
5270 |
model selectionIndex:2. |
|
5271 |
||
5272 |
dialog := DialogBox new. |
|
5273 |
(dialog addTextLabel:'select any') adjust:#left. |
|
5274 |
||
5275 |
listView := dialog addListBoxOn:model withNumberOfLines:3 hScrollable:false vScrollable:false. |
|
5276 |
||
5277 |
dialog addAbortButton; addOkButton. |
|
5278 |
dialog open. |
|
5279 |
||
655 | 5280 |
dialog accepted ifTrue:[Transcript show:'selection is:'; showCR:model selection]. |
593 | 5281 |
" |
5282 |
||
5283 |
"Created: 22.2.1996 / 15:40:07 / cg" |
|
5284 |
"Modified: 27.4.1996 / 18:26:36 / cg" |
|
5285 |
! |
|
5286 |
||
5287 |
addPopUpList:labelString on:aModel |
|
5288 |
"create a popUpList with a label on aModel and add it. |
|
5289 |
Returns the box." |
|
5290 |
||
5291 |
^ self addPopUpList:labelString on:aModel tabable:true |
|
5292 |
! |
|
5293 |
||
5294 |
addPopUpList:labelString on:aModel tabable:tabable |
|
5295 |
"create a popUpList on aModel and add it. |
|
5296 |
Returns the popUpList." |
|
5297 |
||
5298 |
|p box l| |
|
5299 |
||
5300 |
p := PopUpList on:aModel. |
|
5301 |
p resize; sizeFixed:true. |
|
5302 |
labelString notNil ifTrue:[ |
|
1401 | 5303 |
box := HorizontalPanelView new. |
5304 |
box borderWidth:0; horizontalLayout:#rightSpace. |
|
5305 |
box add:(l := Label label:labelString). |
|
5306 |
l borderWidth:0. |
|
5307 |
box add:p. |
|
593 | 5308 |
] ifFalse:[ |
1401 | 5309 |
box := p. |
593 | 5310 |
]. |
5311 |
self addComponent:box tabable:tabable tabbedComponent:p. |
|
5312 |
^ p |
|
735
2552463a8f34
place popUp at right (without extra space)
Claus Gittinger <cg@exept.de>
parents:
719
diff
changeset
|
5313 |
|
739
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
5314 |
"Modified: 31.5.1996 / 21:25:17 / cg" |
593 | 5315 |
! |
5316 |
||
5317 |
addPopUpListOn:aModel |
|
5318 |
"create a popUpList on aModel and add it. |
|
5319 |
Returns the box." |
|
5320 |
||
5321 |
^ self addPopUpList:nil on:aModel tabable:true |
|
5322 |
! |
|
5323 |
||
5324 |
addPopUpListOn:aModel tabable:tabable |
|
5325 |
"create a popUpList on aModel and add it. |
|
5326 |
Returns the popUpList." |
|
5327 |
||
5328 |
^ self addPopUpList:nil on:aModel tabable:tabable |
|
766 | 5329 |
! |
5330 |
||
5331 |
addTextBoxOn:aModel class:aListViewClass withNumberOfLines:numLines hScrollable:hs vScrollable:vs |
|
5332 |
"add an instance of aListViewClass to the box. |
|
5333 |
The list has numLines (if nonNil) number of lines shown. |
|
5334 |
If scrolled, the ScrollWrapper is returned - otherwise the listView." |
|
5335 |
||
5336 |
|l scr h dH| |
|
5337 |
||
5338 |
l := aListViewClass new. |
|
5339 |
l model:aModel. |
|
5340 |
||
877 | 5341 |
(vs or:[hs]) ifTrue:[ |
1401 | 5342 |
hs ifTrue:[ |
5343 |
scr := HVScrollableView forView:l miniScrollerH:true . |
|
5344 |
] ifFalse:[ |
|
5345 |
scr := ScrollableView forView:l |
|
5346 |
]. |
|
5347 |
scr resize. |
|
5348 |
"/ Transcript show:scr height; show:' '; showCR:l height. |
|
5349 |
dH := scr height - l height. |
|
766 | 5350 |
] ifFalse:[ |
1401 | 5351 |
l level:-1. |
5352 |
scr := l. |
|
5353 |
dH := 0. |
|
766 | 5354 |
]. |
5355 |
||
5356 |
numLines notNil ifTrue:[ |
|
1401 | 5357 |
h := l heightForLines:numLines. |
766 | 5358 |
] ifFalse:[ |
1401 | 5359 |
h := l preferredExtent y |
766 | 5360 |
]. |
5361 |
self addComponent:scr withHeight:(h + dH). |
|
5362 |
^ scr |
|
5363 |
||
5364 |
" |
|
5365 |
|dialog listView| |
|
5366 |
||
5367 |
dialog := DialogBox new. |
|
5368 |
(dialog addTextLabel:'select any') adjust:#left. |
|
5369 |
||
5370 |
listView := dialog |
|
1401 | 5371 |
addTextBoxOn:nil |
5372 |
class:EditTextView |
|
5373 |
withNumberOfLines:10 |
|
5374 |
hScrollable:true |
|
5375 |
vScrollable:true. |
|
766 | 5376 |
|
5377 |
||
5378 |
dialog addAbortButton; addOkButton. |
|
5379 |
dialog open. |
|
5380 |
||
5381 |
dialog accepted ifTrue:[Transcript show:'selection is:'; showCR:listView contents]. |
|
5382 |
" |
|
5383 |
||
5384 |
"Created: 14.6.1996 / 23:33:47 / stefan" |
|
877 | 5385 |
"Modified: 8.11.1996 / 15:31:15 / cg" |
593 | 5386 |
! ! |
5387 |
||
5388 |
!DialogBox methodsFor:'construction-rows & columns'! |
|
5389 |
||
130 | 5390 |
addColumn:aRow fromX:leftX toX:rightX collect:aBlock |
5391 |
"add some elements in a vertical column. |
|
5392 |
Equally space elements as returned from aBlock." |
|
5393 |
||
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5394 |
self |
1401 | 5395 |
addColumn:aRow |
5396 |
fromX:leftX toX:rightX |
|
5397 |
collect:aBlock |
|
5398 |
tabable:false |
|
130 | 5399 |
|
5400 |
" |
|
5401 |
|dialog| |
|
5402 |
||
5403 |
dialog := Dialog new. |
|
5404 |
dialog |
|
1401 | 5405 |
addColumn:#('label1' 'label2' 'lbl3' 'l4' 'label5') |
5406 |
fromX:0.0 |
|
5407 |
toX:1.0 |
|
5408 |
collect:[:label | Label label:label]. |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5409 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5410 |
dialog addOkButton. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5411 |
dialog open. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5412 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5413 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5414 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5415 |
|dialog| |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5416 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5417 |
dialog := Dialog new. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5418 |
dialog |
1401 | 5419 |
addColumn:#('label1' 'label2' 'label3' 'label4' 'label5') |
5420 |
fromX:0.25 |
|
5421 |
toX:0.75 |
|
5422 |
collect:[:label | (Label label:label) adjust:#left]. |
|
130 | 5423 |
|
5424 |
dialog addOkButton. |
|
5425 |
dialog open. |
|
5426 |
" |
|
5427 |
||
5428 |
" |
|
5429 |
|dialog y| |
|
5430 |
||
5431 |
dialog := Dialog new. |
|
5432 |
y := dialog yPosition. |
|
5433 |
dialog |
|
1401 | 5434 |
addColumn:#('a1' 'b1' 'c1' 'd1') |
5435 |
fromX:0 |
|
5436 |
toX:(1/3) |
|
5437 |
collect:[:label | Label label:label]. |
|
130 | 5438 |
|
5439 |
dialog yPosition:y. |
|
5440 |
dialog |
|
1401 | 5441 |
addColumn:#('a2' 'b2' 'c2' 'd2') |
5442 |
fromX:(1/3) |
|
5443 |
toX:(2/3) |
|
5444 |
collect:[:label | Label label:label]. |
|
130 | 5445 |
|
5446 |
dialog yPosition:y. |
|
5447 |
dialog |
|
1401 | 5448 |
addColumn:#('a3' 'b3' 'c3' 'd3') |
5449 |
fromX:(2/3) |
|
5450 |
toX:1 |
|
5451 |
collect:[:label | Label label:label]. |
|
130 | 5452 |
|
5453 |
dialog addOkButton. |
|
5454 |
dialog open. |
|
5455 |
" |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5456 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5457 |
"Modified: 9.2.1996 / 22:22:12 / cg" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5458 |
! |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5459 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5460 |
addColumn:aRow fromX:leftX toX:rightX collect:aBlock tabable:tabable |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5461 |
"add some elements in a vertical column. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5462 |
Equally space elements as returned from aBlock." |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5463 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5464 |
self |
1401 | 5465 |
addColumn:aRow |
5466 |
fromX:leftX toX:rightX |
|
5467 |
collect:aBlock |
|
5468 |
tabable:tabable |
|
5469 |
horizontalLayout:#fitSpace |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5470 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5471 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5472 |
|dialog y values| |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5473 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5474 |
values := (1 to:4) collect:[:dummy | '' asValue]. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5475 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5476 |
dialog := Dialog new. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5477 |
y := dialog yPosition. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5478 |
dialog |
1401 | 5479 |
addColumn:#('one' 'two' 'three' 'four') |
5480 |
fromX:0 |
|
5481 |
toX:0.3 |
|
5482 |
collect:[:label | Label label:label]. |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5483 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5484 |
dialog yPosition:y. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5485 |
dialog |
1401 | 5486 |
addColumn:values |
5487 |
fromX:0.3 |
|
5488 |
toX:1.0 |
|
5489 |
collect:[:value | EditField on:value] |
|
5490 |
tabable:true. |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5491 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5492 |
dialog addOkButton. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5493 |
dialog open. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5494 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5495 |
dialog accepted ifTrue:[ |
1401 | 5496 |
Transcript showCR:(values collect:[:holder | holder value]) |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5497 |
] |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5498 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5499 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5500 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5501 |
|dialog y values| |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5502 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5503 |
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
|
5504 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5505 |
dialog := Dialog new. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5506 |
y := dialog yPosition. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5507 |
dialog |
1401 | 5508 |
addColumn:(1 to:4) |
5509 |
fromX:0 |
|
5510 |
toX:0.5 |
|
5511 |
collect:[:idx | CheckToggle on:(values at:idx)] |
|
5512 |
tabable:true |
|
5513 |
horizontalLayout:#center. |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5514 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5515 |
dialog yPosition:y. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5516 |
dialog |
1401 | 5517 |
addColumn:(5 to:8) |
5518 |
fromX:0.5 |
|
5519 |
toX:1.0 |
|
5520 |
collect:[:idx | CheckToggle on:(values at:idx)] |
|
5521 |
tabable:true |
|
5522 |
horizontalLayout:#center. |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5523 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5524 |
dialog addOkButton. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5525 |
dialog open. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5526 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5527 |
dialog accepted ifTrue:[ |
1401 | 5528 |
Transcript showCR:(values collect:[:holder | holder value]) |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5529 |
] |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5530 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5531 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5532 |
"Created: 9.2.1996 / 21:51:47 / cg" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5533 |
"Modified: 9.2.1996 / 22:22:02 / cg" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5534 |
! |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5535 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5536 |
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
|
5537 |
"add some elements in a vertical column. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5538 |
Equally space elements as returned from aBlock." |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5539 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5540 |
|helper component| |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5541 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5542 |
helper := VerticalPanelView new. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5543 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5544 |
aRow do:[:el | |
1401 | 5545 |
component := aBlock value:el. |
5546 |
helper add:component. |
|
5547 |
component resize. |
|
5548 |
tabable ifTrue:[self makeTabable:component]. |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5549 |
]. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5550 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5551 |
helper resize. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5552 |
self addComponent:helper. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5553 |
width < helper preferredExtent x ifTrue:[ |
1401 | 5554 |
self width:helper preferredExtent x. |
5555 |
"/ Transcript show:'w now: '; showCR:helper preferredExtent x |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5556 |
]. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5557 |
helper horizontalLayout:hLayout. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5558 |
helper left:leftX asFloat; |
1401 | 5559 |
right:rightX asFloat; |
5560 |
leftInset:leftIndent; |
|
5561 |
rightInset:rightIndent. |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5562 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5563 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5564 |
|dialog y values| |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5565 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5566 |
values := (1 to:4) collect:[:dummy | '' asValue]. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5567 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5568 |
dialog := Dialog new. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5569 |
y := dialog yPosition. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5570 |
dialog |
1401 | 5571 |
addColumn:#('one' 'two' 'three' 'four') |
5572 |
fromX:0 |
|
5573 |
toX:0.3 |
|
5574 |
collect:[:label | Label label:label]. |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5575 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5576 |
dialog yPosition:y. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5577 |
dialog |
1401 | 5578 |
addColumn:values |
5579 |
fromX:0.3 |
|
5580 |
toX:1.0 |
|
5581 |
collect:[:value | EditField on:value] |
|
5582 |
tabable:true. |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5583 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5584 |
dialog addOkButton. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5585 |
dialog open. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5586 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5587 |
dialog accepted ifTrue:[ |
1401 | 5588 |
Transcript showCR:(values collect:[:holder | holder value]) |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5589 |
] |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5590 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5591 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5592 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5593 |
|dialog y values| |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5594 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5595 |
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
|
5596 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5597 |
dialog := Dialog new. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5598 |
y := dialog yPosition. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5599 |
dialog |
1401 | 5600 |
addColumn:(1 to:4) |
5601 |
fromX:0 |
|
5602 |
toX:0.5 |
|
5603 |
collect:[:idx | CheckToggle on:(values at:idx)]. |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5604 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5605 |
dialog yPosition:y. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5606 |
dialog |
1401 | 5607 |
addColumn:(5 to:8) |
5608 |
fromX:0.5 |
|
5609 |
toX:1.0 |
|
5610 |
collect:[:idx | CheckToggle on:(values at:idx)] |
|
5611 |
tabable:true. |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5612 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5613 |
dialog addOkButton. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5614 |
dialog open. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5615 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5616 |
dialog accepted ifTrue:[ |
1401 | 5617 |
Transcript showCR:(values collect:[:holder | holder value]) |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5618 |
] |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5619 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5620 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5621 |
"Modified: 9.2.1996 / 22:02:22 / cg" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5622 |
"Created: 9.2.1996 / 22:20:31 / cg" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5623 |
! |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5624 |
|
130 | 5625 |
addRow:aCol fromX:leftX toX:rightX collect:aBlock |
5626 |
"add some elements in a horizontal row. |
|
5627 |
Equally space elements as returned from aBlock. |
|
5628 |
Advance y." |
|
5629 |
||
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5630 |
self |
1401 | 5631 |
addRow:aCol |
5632 |
fromX:leftX toX:rightX |
|
5633 |
collect:aBlock |
|
5634 |
tabable:true |
|
5635 |
horizontalLayout:#spread |
|
130 | 5636 |
|
5637 |
" |
|
5638 |
|dialog| |
|
5639 |
||
5640 |
dialog := Dialog new. |
|
5641 |
dialog |
|
1401 | 5642 |
addRow:#('a' 'b' 'c' 'd') |
5643 |
fromX:0 |
|
5644 |
toX:1 |
|
5645 |
collect:[:label | Label label:label]. |
|
130 | 5646 |
|
5647 |
dialog addOkButton. |
|
5648 |
dialog open. |
|
5649 |
" |
|
5650 |
||
5651 |
" |
|
5652 |
|dialog| |
|
5653 |
||
5654 |
dialog := Dialog new. |
|
5655 |
dialog |
|
1401 | 5656 |
addRow:#('a1' 'b1' 'c1' 'd1') |
5657 |
fromX:0 |
|
5658 |
toX:1 |
|
5659 |
collect:[:label | Label label:label]. |
|
130 | 5660 |
|
5661 |
dialog |
|
1401 | 5662 |
addRow:#('a2' 'b2' 'c2' 'd2') |
5663 |
fromX:0 |
|
5664 |
toX:0.5 |
|
5665 |
collect:[:label | Label label:label]. |
|
130 | 5666 |
|
5667 |
dialog |
|
1401 | 5668 |
addRow:#('a3' 'b3' 'c3' 'd3') |
5669 |
fromX:0.5 |
|
5670 |
toX:1 |
|
5671 |
collect:[:label | Label label:label]. |
|
130 | 5672 |
|
5673 |
dialog addOkButton. |
|
5674 |
dialog open. |
|
5675 |
" |
|
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 |
"Modified: 9.2.1996 / 22:25:16 / cg" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5678 |
! |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5679 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5680 |
addRow:aCol fromX:leftX toX:rightX collect:aBlock tabable:tabable |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5681 |
"add some elements in a horizontal row. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5682 |
Equally space elements as returned from aBlock. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5683 |
Advance y." |
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 |
self |
1401 | 5686 |
addRow:aCol |
5687 |
fromX:leftX toX:rightX |
|
5688 |
collect:aBlock |
|
5689 |
tabable:tabable |
|
5690 |
horizontalLayout:#spread |
|
344
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 |
"Created: 9.2.1996 / 22:25:35 / cg" |
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 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5695 |
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
|
5696 |
"add some elements in a horizontal row. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5697 |
Equally space elements as returned from aBlock. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5698 |
Advance y." |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5699 |
|
739
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
5700 |
^ self |
1401 | 5701 |
addRow:aCol |
5702 |
fromX:leftX toX:rightX |
|
5703 |
collect:aBlock |
|
5704 |
tabable:tabable |
|
5705 |
horizontalLayout:hLayout |
|
5706 |
verticalLayout:#fit |
|
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 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5709 |
|dialog| |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5710 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5711 |
dialog := Dialog new. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5712 |
dialog |
1401 | 5713 |
addRow:#('a' 'b' 'c' 'd') |
5714 |
fromX:0 |
|
5715 |
toX:1 |
|
5716 |
collect:[:label | Label label:label] |
|
5717 |
tabable:false |
|
5718 |
horizontalLayout:#fit. |
|
344
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 addOkButton. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5721 |
dialog open. |
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 |
|dialog| |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5726 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5727 |
dialog := Dialog new. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5728 |
dialog |
1401 | 5729 |
addRow:#('one' 'two' 'three' 'four') |
5730 |
fromX:0 |
|
5731 |
toX:1 |
|
5732 |
collect:[:label | Button label:label] |
|
5733 |
tabable:false |
|
5734 |
horizontalLayout:#fit. |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5735 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5736 |
dialog addOkButton. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5737 |
dialog open. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5738 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5739 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5740 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5741 |
|dialog| |
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 |
dialog := Dialog new. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5744 |
dialog |
1401 | 5745 |
addRow:#('a1' 'b1' 'c1' 'd1') |
5746 |
fromX:0 |
|
5747 |
toX:1 |
|
5748 |
collect:[:label | Label label:label]. |
|
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 |
dialog |
1401 | 5751 |
addRow:#('a2' 'b2' 'c2' 'd2') |
5752 |
fromX:0 |
|
5753 |
toX:0.5 |
|
5754 |
collect:[:label | Label label:label]. |
|
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 |
dialog |
1401 | 5757 |
addRow:#('a3' 'b3' 'c3' 'd3') |
5758 |
fromX:0.5 |
|
5759 |
toX:1 |
|
5760 |
collect:[:label | Label label:label]. |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5761 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5762 |
dialog addOkButton. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5763 |
dialog open. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5764 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5765 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5766 |
"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
|
5767 |
"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
|
5768 |
! |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
5769 |
|
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
5770 |
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
|
5771 |
"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
|
5772 |
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
|
5773 |
Advance y." |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
5774 |
|
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
5775 |
|helper component| |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
5776 |
|
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
5777 |
helper := HorizontalPanelView new. |
792 | 5778 |
helper borderWidth:0. |
739
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
5779 |
|
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
5780 |
aCol do:[:el | |
1401 | 5781 |
component := aBlock value:el. |
5782 |
component resize. |
|
5783 |
helper add:component. |
|
5784 |
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
|
5785 |
]. |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
5786 |
|
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
5787 |
helper resize. |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
5788 |
self addComponent:helper. |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
5789 |
|
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
5790 |
width < helper preferredExtent x ifTrue:[ |
1401 | 5791 |
self width:helper preferredExtent x. |
5792 |
"/ 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
|
5793 |
]. |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
5794 |
hLayout notNil ifTrue:[ |
1401 | 5795 |
helper horizontalLayout:hLayout. |
739
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
5796 |
]. |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
5797 |
vLayout notNil ifTrue:[ |
1401 | 5798 |
helper verticalLayout:vLayout. |
739
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
5799 |
]. |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
5800 |
helper left:leftX asFloat; |
1401 | 5801 |
right:rightX asFloat. |
739
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
5802 |
|
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
5803 |
" |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
5804 |
|dialog| |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
5805 |
|
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
5806 |
dialog := Dialog new. |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
5807 |
dialog |
1401 | 5808 |
addRow:#('a' 'b' 'c' 'd') |
5809 |
fromX:0 |
|
5810 |
toX:1 |
|
5811 |
collect:[:label | Label label:label] |
|
5812 |
tabable:false |
|
5813 |
horizontalLayout:#fit. |
|
739
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
5814 |
|
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
5815 |
dialog addOkButton. |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
5816 |
dialog open. |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
5817 |
" |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
5818 |
|
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
5819 |
" |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
5820 |
|dialog| |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
5821 |
|
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
5822 |
dialog := Dialog new. |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
5823 |
dialog |
1401 | 5824 |
addRow:#('one' 'two' 'three' 'four') |
5825 |
fromX:0 |
|
5826 |
toX:1 |
|
5827 |
collect:[:label | Button label:label] |
|
5828 |
tabable:false |
|
5829 |
horizontalLayout:#fit. |
|
739
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
5830 |
|
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
5831 |
dialog addOkButton. |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
5832 |
dialog open. |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
5833 |
" |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
5834 |
|
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
5835 |
" |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
5836 |
|dialog| |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
5837 |
|
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
5838 |
dialog := Dialog new. |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
5839 |
dialog |
1401 | 5840 |
addRow:#('a1' 'b1' 'c1' 'd1') |
5841 |
fromX:0 |
|
5842 |
toX:1 |
|
5843 |
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
|
5844 |
|
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
5845 |
dialog |
1401 | 5846 |
addRow:#('a2' 'b2' 'c2' 'd2') |
5847 |
fromX:0 |
|
5848 |
toX:0.5 |
|
5849 |
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
|
5850 |
|
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
5851 |
dialog |
1401 | 5852 |
addRow:#('a3' 'b3' 'c3' 'd3') |
5853 |
fromX:0.5 |
|
5854 |
toX:1 |
|
5855 |
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
|
5856 |
|
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
5857 |
dialog addOkButton. |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
5858 |
dialog open. |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
5859 |
" |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
5860 |
|
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
5861 |
"Created: 31.5.1996 / 20:45:31 / cg" |
792 | 5862 |
"Modified: 17.7.1996 / 12:06:08 / cg" |
76 | 5863 |
! ! |
5864 |
||
551
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
5865 |
!DialogBox methodsFor:'explicit focus control'! |
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
5866 |
|
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
5867 |
focusOnOk |
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
5868 |
windowGroup focusView:okButton |
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
5869 |
|
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
5870 |
"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
|
5871 |
! ! |
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
5872 |
|
76 | 5873 |
!DialogBox methodsFor:'initialization'! |
5874 |
||
197 | 5875 |
focusSequence |
5876 |
"return the elements through which we can step via |
|
5877 |
NextField/PreviousField keys. |
|
5878 |
Here we return all tabable fields followed by all buttons in |
|
5879 |
the panel." |
|
5880 |
||
5881 |
|fields buttons| |
|
5882 |
||
5883 |
tabableElements isNil ifTrue:[ |
|
1843 | 5884 |
fields := #() |
197 | 5885 |
] ifFalse:[ |
1843 | 5886 |
fields := tabableElements |
197 | 5887 |
]. |
5888 |
buttonPanel notNil ifTrue:[ |
|
1843 | 5889 |
buttons := buttonPanel subViews. |
5890 |
buttons notNil ifTrue:[ |
|
5891 |
fields := fields , buttonPanel subViews |
|
5892 |
] |
|
197 | 5893 |
]. |
1843 | 5894 |
^ 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
|
5895 |
|
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
5896 |
"Modified: 31.5.1996 / 22:05:58 / cg" |
197 | 5897 |
! |
5898 |
||
76 | 5899 |
initialize |
5900 |
|mm| |
|
5901 |
||
5902 |
super initialize. |
|
5903 |
||
573 | 5904 |
"/ label := 'Dialog'. |
948 | 5905 |
acceptValue := ValueHolder newBoolean. |
76 | 5906 |
|
5907 |
mm := ViewSpacing. |
|
5908 |
||
5909 |
acceptReturnAsOK := true. |
|
125 | 5910 |
acceptOnLeave := true. |
1757 | 5911 |
focusToOKOnLeave := DefaultFocusToOKOnLeave. |
280
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
5912 |
hideOnAccept := true. |
469
1d86f97ab2e5
autoAccept as default; configurable
Claus Gittinger <cg@exept.de>
parents:
436
diff
changeset
|
5913 |
autoAccept := true. |
76 | 5914 |
|
5915 |
buttonPanel := HorizontalPanelView in:self. |
|
118 | 5916 |
buttonPanel |
1757 | 5917 |
origin:(0.0 @ 1.0) corner:(1.0 @ 1.0); |
5918 |
bottomInset:mm; |
|
5919 |
topInset:(font height + mm * 2) negated; |
|
5920 |
borderWidth:0; |
|
5921 |
horizontalLayout:#spread. |
|
118 | 5922 |
|
122 | 5923 |
yPosition := ViewSpacing. |
312
008267b920d9
allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
5924 |
leftIndent := rightIndent := (ViewSpacing // 2). |
310
4bbc8deffc8c
allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents:
307
diff
changeset
|
5925 |
needResize := true. |
76 | 5926 |
|
5927 |
" |
|
5928 |
|b| |
|
5929 |
b := DialogBox new. |
|
118 | 5930 |
b addAbortButton; |
5931 |
addOkButton; |
|
5932 |
showAtPointer |
|
76 | 5933 |
" |
5934 |
" |
|
5935 |
|b| |
|
5936 |
b := DialogBox new. |
|
118 | 5937 |
b addOkButton; |
5938 |
showAtPointer |
|
5939 |
" |
|
76 | 5940 |
" |
118 | 5941 |
|b| |
5942 |
b := DialogBox new. |
|
5943 |
b addTextLabel:'hello world'; |
|
5944 |
addOkButton; |
|
5945 |
showAtPointer |
|
5946 |
" |
|
5947 |
" |
|
5948 |
|b| |
|
5949 |
b := DialogBox new. |
|
5950 |
b addTextLabel:'hello world'; |
|
5951 |
addVerticalSpace:50; |
|
5952 |
addOkButton; |
|
5953 |
showAtPointer |
|
5954 |
" |
|
310
4bbc8deffc8c
allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents:
307
diff
changeset
|
5955 |
|
1614 | 5956 |
"Modified: / 23.12.1997 / 10:05:24 / md" |
5957 |
"Modified: / 27.7.1998 / 20:16:37 / cg" |
|
76 | 5958 |
! |
5959 |
||
5960 |
reAdjustGeometry |
|
5961 |
"sent late in snapin processing - gives me a chance |
|
5962 |
to resize for changed font dimensions." |
|
5963 |
||
5964 |
super reAdjustGeometry. |
|
5965 |
okButton notNil ifTrue:[okButton resize]. |
|
5966 |
abortButton notNil ifTrue:[abortButton resize]. |
|
5967 |
self resize |
|
5968 |
! ! |
|
5969 |
||
197 | 5970 |
!DialogBox methodsFor:'private'! |
5971 |
||
5972 |
basicAddComponent:aComponent |
|
5973 |
"add a component, dont change its size" |
|
5974 |
||
5975 |
addedComponents isNil ifTrue:[ |
|
5976 |
addedComponents := OrderedCollection new. |
|
5977 |
]. |
|
5978 |
addedComponents add:aComponent. |
|
5979 |
self addSubView:aComponent. |
|
5980 |
! |
|
5981 |
||
5982 |
hideAndEvaluate:aBlock |
|
5983 |
"if I am modal, make myself invisible and evaluate aBlock. |
|
5984 |
If nonModal, stay up, but also evaluate the block." |
|
5985 |
||
5986 |
(windowGroup notNil and:[windowGroup isModal]) ifTrue:[ |
|
5987 |
self hide. |
|
5988 |
]. |
|
5989 |
aBlock notNil ifTrue:[aBlock value] |
|
5990 |
||
5991 |
"Modified: 5.9.1995 / 19:06:33 / claus" |
|
5992 |
! |
|
5993 |
||
5994 |
realize |
|
5995 |
"if any inputFields where added, activate the first one" |
|
5996 |
||
1877
a46bf520f9c6
realize first, then assign focus
Claus Gittinger <cg@exept.de>
parents:
1843
diff
changeset
|
5997 |
super realize. |
197 | 5998 |
inputFieldGroup notNil ifTrue:[ |
1646 | 5999 |
inputFieldGroup activateFirstIfNoCurrent |
197 | 6000 |
]. |
1646 | 6001 |
|
6002 |
"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
|
6003 |
! |
4bbc8deffc8c
allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents:
307
diff
changeset
|
6004 |
|
4bbc8deffc8c
allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents:
307
diff
changeset
|
6005 |
resize |
4bbc8deffc8c
allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents:
307
diff
changeset
|
6006 |
needResize ifTrue:[ |
314
705185e7001d
no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents:
312
diff
changeset
|
6007 |
needResize := false. |
705185e7001d
no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents:
312
diff
changeset
|
6008 |
super resize |
310
4bbc8deffc8c
allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents:
307
diff
changeset
|
6009 |
] |
4bbc8deffc8c
allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents:
307
diff
changeset
|
6010 |
|
4bbc8deffc8c
allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents:
307
diff
changeset
|
6011 |
"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
|
6012 |
"Modified: 27.1.1996 / 18:25:40 / cg" |
197 | 6013 |
! ! |
6014 |
||
120 | 6015 |
!DialogBox methodsFor:'queries'! |
118 | 6016 |
|
121 | 6017 |
accepted |
128 | 6018 |
"after the box has closed: |
6019 |
return true if accepted, false if canceled" |
|
125 | 6020 |
|
128 | 6021 |
^ acceptValue value |
121 | 6022 |
! |
6023 |
||
120 | 6024 |
positionOffset |
6025 |
"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
|
6026 |
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
|
6027 |
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
|
6028 |
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
|
6029 |
use my superclasses offset." |
050fba15277a
DialogBoxes positionOffset now handles all common cases
Claus Gittinger <cg@exept.de>
parents:
950
diff
changeset
|
6030 |
|
050fba15277a
DialogBoxes positionOffset now handles all common cases
Claus Gittinger <cg@exept.de>
parents:
950
diff
changeset
|
6031 |
|idx butt buttons| |
050fba15277a
DialogBoxes positionOffset now handles all common cases
Claus Gittinger <cg@exept.de>
parents:
950
diff
changeset
|
6032 |
|
050fba15277a
DialogBoxes positionOffset now handles all common cases
Claus Gittinger <cg@exept.de>
parents:
950
diff
changeset
|
6033 |
buttonPanel notNil ifTrue:[ |
1401 | 6034 |
buttons := buttonPanel subViews. |
6035 |
buttons size > 0 ifTrue:[ |
|
6036 |
idx := buttons findFirst:[:b | b isReturnButton]. |
|
6037 |
idx ~~ 0 ifTrue:[ |
|
6038 |
butt := buttons at:idx. |
|
6039 |
||
6040 |
"get our size (preferredExtent) and compute |
|
6041 |
origin and extent of buttonPanel and okButton. |
|
6042 |
This is normally done on view realization." |
|
6043 |
||
6044 |
self resize. |
|
6045 |
buttonPanel pixelOrigin:buttonPanel computeOrigin. |
|
6046 |
buttonPanel pixelExtent:buttonPanel computeExtent. |
|
6047 |
buttonPanel setChildPositionsIfChanged. |
|
6048 |
||
6049 |
^ (butt originRelativeTo:self) + (butt extent // 2) |
|
6050 |
] |
|
6051 |
] |
|
118 | 6052 |
]. |
913 | 6053 |
|
953
050fba15277a
DialogBoxes positionOffset now handles all common cases
Claus Gittinger <cg@exept.de>
parents:
950
diff
changeset
|
6054 |
^ super positionOffset |
912
310c4970e613
Fix #positionOffset to show 'senders' box with cursor on ok-button.
Stefan Vogel <sv@exept.de>
parents:
884
diff
changeset
|
6055 |
|
913 | 6056 |
"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
|
6057 |
"Modified: 16.1.1997 / 22:00:23 / cg" |
118 | 6058 |
! |
6059 |
||
130 | 6060 |
preferredExtent |
132 | 6061 |
"return my preferred extent. |
6062 |
That is the max component width, or my current width (default); |
|
6063 |
whichever is larger, by the sum of the components heights." |
|
118 | 6064 |
|
120 | 6065 |
|w h p| |
118 | 6066 |
|
797 | 6067 |
"/ If I have an explicit preferredExtent .. |
6068 |
||
713
0c38ad51016d
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
680
diff
changeset
|
6069 |
preferredExtent notNil ifTrue:[ |
1401 | 6070 |
^ preferredExtent |
713
0c38ad51016d
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
680
diff
changeset
|
6071 |
]. |
0c38ad51016d
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
680
diff
changeset
|
6072 |
|
120 | 6073 |
addedComponents notNil ifTrue:[ |
1401 | 6074 |
w := addedComponents |
6075 |
inject:0 |
|
6076 |
into:[:max :element | |
|
6077 |
|eExt prefWidth scale rel relX| |
|
6078 |
||
6079 |
prefWidth := element preferredExtent x. |
|
6080 |
||
6081 |
"/ special (for your convenience) |
|
6082 |
"/ if the element has been added with a relative width, |
|
6083 |
"/ scale it to get at least its preferred width |
|
6084 |
||
6085 |
(rel := element relativeExtent) notNil ifTrue:[ |
|
6086 |
relX := rel x. |
|
6087 |
(relX isNil or:[relX isInteger]) ifFalse:[ |
|
6088 |
prefWidth := (prefWidth * (1 / relX)) rounded |
|
6089 |
]. |
|
6090 |
]. |
|
6091 |
eExt := prefWidth + (element borderWidth * 2). "/ max:element extent x. |
|
6092 |
max max:(eExt + element leftInset + element rightInset)]. |
|
120 | 6093 |
] ifFalse:[ |
1401 | 6094 |
w := super preferredExtent x. |
120 | 6095 |
]. |
132 | 6096 |
w := w max:width. |
310
4bbc8deffc8c
allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents:
307
diff
changeset
|
6097 |
h := yPosition + ViewSpacing. |
118 | 6098 |
|
130 | 6099 |
buttonPanel subViews size ~~ 0 ifTrue:[ |
1401 | 6100 |
p := buttonPanel preferredExtent. |
6101 |
w := w max:p x. |
|
6102 |
h := h |
|
6103 |
+ p y |
|
6104 |
+ ViewSpacing. |
|
120 | 6105 |
]. |
118 | 6106 |
|
120 | 6107 |
"/ okButton isNil ifTrue:[ |
130 | 6108 |
"/ ^ super preferredExtent |
120 | 6109 |
"/ ]. |
130 | 6110 |
"/ p := buttonPanel preferredExtent. |
120 | 6111 |
"/ w := p x. |
6112 |
"/ h := ViewSpacing |
|
6113 |
"/ + p y |
|
6114 |
"/ + ViewSpacing. |
|
6115 |
"/ |
|
6116 |
^ w @ h |
|
310
4bbc8deffc8c
allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents:
307
diff
changeset
|
6117 |
|
797 | 6118 |
"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
|
6119 |
! ! |
4bbc8deffc8c
allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents:
307
diff
changeset
|
6120 |
|
197 | 6121 |
!DialogBox methodsFor:'user actions'! |
76 | 6122 |
|
197 | 6123 |
abortPressed |
6124 |
"sent by the cancel button; user pressed abort button |
|
6125 |
- hide myself and evaluate okAction" |
|
121 | 6126 |
|
197 | 6127 |
abortButton turnOffWithoutRedraw. |
6128 |
acceptValue value:false. |
|
121 | 6129 |
|
197 | 6130 |
"/ actually, only hides if I have been opened modal |
6131 |
self hideAndEvaluate:abortAction |
|
121 | 6132 |
! |
6133 |
||
197 | 6134 |
doAccept |
6135 |
"let all components accept (i.e. update their model from the values), |
|
6136 |
then set my accept value to true. |
|
6137 |
This is confusing: this method was originally called #accept, |
|
6138 |
but renamed for compatibility with ST-80, where #accept returns the |
|
6139 |
accept-valueHolder (which looks like a bad name to me ...)." |
|
76 | 6140 |
|
469
1d86f97ab2e5
autoAccept as default; configurable
Claus Gittinger <cg@exept.de>
parents:
436
diff
changeset
|
6141 |
autoAccept ifTrue:[ |
1401 | 6142 |
addedComponents notNil ifTrue:[ |
6143 |
addedComponents do:[:aComponent | |
|
6144 |
(aComponent respondsTo:#accept) ifTrue:[ |
|
6145 |
aComponent accept |
|
6146 |
] |
|
6147 |
] |
|
6148 |
]. |
|
197 | 6149 |
]. |
6150 |
acceptValue value:true. |
|
469
1d86f97ab2e5
autoAccept as default; configurable
Claus Gittinger <cg@exept.de>
parents:
436
diff
changeset
|
6151 |
|
1d86f97ab2e5
autoAccept as default; configurable
Claus Gittinger <cg@exept.de>
parents:
436
diff
changeset
|
6152 |
"Modified: 4.3.1996 / 12:14:56 / cg" |
128 | 6153 |
! |
6154 |
||
197 | 6155 |
keyPress:aKey x:x y:y |
6156 |
"return-key dublicates ok-function if acceptReturnAsOK is true" |
|
76 | 6157 |
|
490 | 6158 |
<resource: #keyboard (#Return)> |
6159 |
||
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
|
6160 |
(aKey == #Return) ifTrue:[ |
1401 | 6161 |
(okButton notNil and:[okButton isReturnButton]) ifTrue:[ |
6162 |
^ self okPressed |
|
6163 |
]. |
|
6164 |
(abortButton notNil and:[abortButton isReturnButton]) ifTrue:[ |
|
6165 |
^ self abortPressed |
|
6166 |
]. |
|
197 | 6167 |
]. |
6168 |
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
|
6169 |
|
490 | 6170 |
"Modified: 7.3.1996 / 13:15:09 / cg" |
76 | 6171 |
! |
6172 |
||
197 | 6173 |
lastFieldLeft |
6174 |
"if the dialog involves input fields, this is called |
|
6175 |
when the last field is left by Return-key or NextField-key" |
|
120 | 6176 |
|
197 | 6177 |
acceptOnLeave ifTrue:[ |
1401 | 6178 |
acceptReturnAsOK ifTrue:[ |
6179 |
focusToOKOnLeave ifTrue:[ |
|
6180 |
self focusOnOk. |
|
6181 |
^ self. |
|
6182 |
]. |
|
6183 |
self okPressed |
|
6184 |
] |
|
197 | 6185 |
]. |
280
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
6186 |
inputFieldGroup activateFirst |
357
732f59def851
care for acceptReturnAsOK being false and return being pressed
Claus Gittinger <cg@exept.de>
parents:
356
diff
changeset
|
6187 |
|
551
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
6188 |
"Modified: 19.4.1996 / 17:09:02 / cg" |
76 | 6189 |
! |
6190 |
||
197 | 6191 |
okPressed |
6192 |
"sent by the okButton; user pressed ok-button |
|
6193 |
- make myself invisible and if an action was specified do it" |
|
128 | 6194 |
|
197 | 6195 |
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
|
6196 |
|
197 | 6197 |
self doAccept. |
6198 |
||
280
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
6199 |
acceptCheck notNil ifTrue:[ |
302 | 6200 |
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
|
6201 |
]. |
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
6202 |
|
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
6203 |
hideOnAccept ifTrue:[ |
302 | 6204 |
"/ actually, only hides if I have been opened modal |
6205 |
self hideAndEvaluate:okAction. |
|
280
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
6206 |
] ifFalse:[ |
302 | 6207 |
okAction value |
280
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
6208 |
] |
128 | 6209 |
! ! |
240 | 6210 |
|
846
75c5dc601522
added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents:
831
diff
changeset
|
6211 |
!DialogBox class methodsFor:'documentation'! |
240 | 6212 |
|
6213 |
version |
|
2106 | 6214 |
^ '$Header: /cvs/stx/stx/libwidg/DialogBox.st,v 1.140 2000-01-27 12:01:59 cg Exp $' |
240 | 6215 |
! ! |
498 | 6216 |
DialogBox initialize! |