author | Claus Gittinger <cg@exept.de> |
Thu, 15 Apr 1999 14:33:52 +0200 | |
changeset 1843 | b868964a554e |
parent 1780 | bfc30a82aae3 |
child 1877 | a46bf520f9c6 |
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 |
||
498 | 1220 |
confirm:aString title:title yesLabel:yesText noLabel:noText |
253
f071ff350cd5
added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents:
241
diff
changeset
|
1221 |
"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
|
1222 |
return true for yes, false for no. |
f071ff350cd5
added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents:
241
diff
changeset
|
1223 |
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
|
1224 |
|
881 | 1225 |
|box answer t| |
253
f071ff350cd5
added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents:
241
diff
changeset
|
1226 |
|
f071ff350cd5
added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents:
241
diff
changeset
|
1227 |
box := YesNoBox title:aString. |
498 | 1228 |
yesText notNil ifTrue:[ |
1488
630b308c4295
ESC returns false in #confirm-dialog
Claus Gittinger <cg@exept.de>
parents:
1401
diff
changeset
|
1229 |
box yesLabel:yesText. |
498 | 1230 |
]. |
1231 |
noText notNil ifTrue:[ |
|
1488
630b308c4295
ESC returns false in #confirm-dialog
Claus Gittinger <cg@exept.de>
parents:
1401
diff
changeset
|
1232 |
box noLabel:noText. |
498 | 1233 |
]. |
1488
630b308c4295
ESC returns false in #confirm-dialog
Claus Gittinger <cg@exept.de>
parents:
1401
diff
changeset
|
1234 |
answer := false. |
630b308c4295
ESC returns false in #confirm-dialog
Claus Gittinger <cg@exept.de>
parents:
1401
diff
changeset
|
1235 |
box yesAction:[answer := true]. |
498 | 1236 |
title notNil ifTrue:[ |
1488
630b308c4295
ESC returns false in #confirm-dialog
Claus Gittinger <cg@exept.de>
parents:
1401
diff
changeset
|
1237 |
t := title |
881 | 1238 |
] ifFalse:[ |
1488
630b308c4295
ESC returns false in #confirm-dialog
Claus Gittinger <cg@exept.de>
parents:
1401
diff
changeset
|
1239 |
t := self classResources string:'confirm' |
498 | 1240 |
]. |
1488
630b308c4295
ESC returns false in #confirm-dialog
Claus Gittinger <cg@exept.de>
parents:
1401
diff
changeset
|
1241 |
|
881 | 1242 |
box label:t. |
253
f071ff350cd5
added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents:
241
diff
changeset
|
1243 |
box showAtPointer. |
f071ff350cd5
added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents:
241
diff
changeset
|
1244 |
box yesAction:nil noAction:nil. |
719
574be1981be0
destroy boxes from standard dialogs
Claus Gittinger <cg@exept.de>
parents:
718
diff
changeset
|
1245 |
box destroy. |
253
f071ff350cd5
added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents:
241
diff
changeset
|
1246 |
^ answer |
f071ff350cd5
added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents:
241
diff
changeset
|
1247 |
|
f071ff350cd5
added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents:
241
diff
changeset
|
1248 |
" |
498 | 1249 |
Dialog |
1488
630b308c4295
ESC returns false in #confirm-dialog
Claus Gittinger <cg@exept.de>
parents:
1401
diff
changeset
|
1250 |
confirm:'really ?' |
630b308c4295
ESC returns false in #confirm-dialog
Claus Gittinger <cg@exept.de>
parents:
1401
diff
changeset
|
1251 |
title:'fooBar' |
630b308c4295
ESC returns false in #confirm-dialog
Claus Gittinger <cg@exept.de>
parents:
1401
diff
changeset
|
1252 |
yesLabel:'oh well' |
630b308c4295
ESC returns false in #confirm-dialog
Claus Gittinger <cg@exept.de>
parents:
1401
diff
changeset
|
1253 |
noLabel:'nope' |
498 | 1254 |
" |
1255 |
||
881 | 1256 |
" |
1257 |
Dialog |
|
1488
630b308c4295
ESC returns false in #confirm-dialog
Claus Gittinger <cg@exept.de>
parents:
1401
diff
changeset
|
1258 |
confirm:'really ?' |
630b308c4295
ESC returns false in #confirm-dialog
Claus Gittinger <cg@exept.de>
parents:
1401
diff
changeset
|
1259 |
title:nil |
630b308c4295
ESC returns false in #confirm-dialog
Claus Gittinger <cg@exept.de>
parents:
1401
diff
changeset
|
1260 |
yesLabel:'oh well' |
630b308c4295
ESC returns false in #confirm-dialog
Claus Gittinger <cg@exept.de>
parents:
1401
diff
changeset
|
1261 |
noLabel:'nope' |
881 | 1262 |
" |
1263 |
||
1264 |
" |
|
1265 |
Dialog |
|
1488
630b308c4295
ESC returns false in #confirm-dialog
Claus Gittinger <cg@exept.de>
parents:
1401
diff
changeset
|
1266 |
confirm:'really ?' |
630b308c4295
ESC returns false in #confirm-dialog
Claus Gittinger <cg@exept.de>
parents:
1401
diff
changeset
|
1267 |
title:'' |
630b308c4295
ESC returns false in #confirm-dialog
Claus Gittinger <cg@exept.de>
parents:
1401
diff
changeset
|
1268 |
yesLabel:'oh well' |
630b308c4295
ESC returns false in #confirm-dialog
Claus Gittinger <cg@exept.de>
parents:
1401
diff
changeset
|
1269 |
noLabel:'nope' |
630b308c4295
ESC returns false in #confirm-dialog
Claus Gittinger <cg@exept.de>
parents:
1401
diff
changeset
|
1270 |
" |
630b308c4295
ESC returns false in #confirm-dialog
Claus Gittinger <cg@exept.de>
parents:
1401
diff
changeset
|
1271 |
|
630b308c4295
ESC returns false in #confirm-dialog
Claus Gittinger <cg@exept.de>
parents:
1401
diff
changeset
|
1272 |
"Created: / 21.2.1996 / 01:10:14 / cg" |
630b308c4295
ESC returns false in #confirm-dialog
Claus Gittinger <cg@exept.de>
parents:
1401
diff
changeset
|
1273 |
"Modified: / 18.4.1998 / 19:25:21 / cg" |
498 | 1274 |
! |
1275 |
||
1276 |
confirm:aString yesLabel:yesText noLabel:noText |
|
1277 |
"launch a Dialog, which allows user to enter yes or no. |
|
1278 |
return true for yes, false for no. |
|
1279 |
The yes/no buttons labels are defined by yesText/noText." |
|
1280 |
||
1281 |
^ self confirm:aString title:nil yesLabel:yesText noLabel:noText |
|
1282 |
||
1283 |
" |
|
253
f071ff350cd5
added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents:
241
diff
changeset
|
1284 |
Dialog confirm:'really ?' yesLabel:'oh well' noLabel:'nope' |
f071ff350cd5
added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents:
241
diff
changeset
|
1285 |
" |
f071ff350cd5
added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents:
241
diff
changeset
|
1286 |
|
374 | 1287 |
"Created: 21.2.1996 / 01:10:14 / cg" |
498 | 1288 |
"Modified: 8.3.1996 / 21:15:06 / cg" |
253
f071ff350cd5
added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents:
241
diff
changeset
|
1289 |
! |
f071ff350cd5
added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents:
241
diff
changeset
|
1290 |
|
197 | 1291 |
confirmWithCancel:aString |
1292 |
"launch a Dialog, which allows user to enter yes, no and cancel. |
|
1293 |
return true for 'yes', false for 'no', nil for 'cancel'" |
|
1294 |
||
1004 | 1295 |
^ self confirmWithCancel:aString default:nil |
1296 |
||
846
75c5dc601522
added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents:
831
diff
changeset
|
1297 |
" |
75c5dc601522
added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents:
831
diff
changeset
|
1298 |
Dialog confirmWithCancel:'really ?' |
75c5dc601522
added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents:
831
diff
changeset
|
1299 |
" |
75c5dc601522
added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents:
831
diff
changeset
|
1300 |
|
75c5dc601522
added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents:
831
diff
changeset
|
1301 |
" |
75c5dc601522
added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents:
831
diff
changeset
|
1302 |
Transcript showCR:( |
1401 | 1303 |
Dialog confirmWithCancel:'really ?' |
846
75c5dc601522
added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents:
831
diff
changeset
|
1304 |
) |
75c5dc601522
added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents:
831
diff
changeset
|
1305 |
" |
75c5dc601522
added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents:
831
diff
changeset
|
1306 |
|
75c5dc601522
added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents:
831
diff
changeset
|
1307 |
"Modified: 18.10.1996 / 14:51:51 / cg" |
75c5dc601522
added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents:
831
diff
changeset
|
1308 |
! |
75c5dc601522
added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents:
831
diff
changeset
|
1309 |
|
1004 | 1310 |
confirmWithCancel:aString default:default |
1311 |
"launch a Dialog, which allows user to enter yes, no and cancel. |
|
1312 |
return true for 'yes', false for 'no', nil for 'cancel'. |
|
1313 |
The default argument marks the return-button; it may be one of nil, false or true" |
|
1314 |
||
1315 |
^ self |
|
1401 | 1316 |
confirmWithCancel:aString |
1317 |
labels:(self |
|
1318 |
classResources |
|
1319 |
array: |
|
1320 |
#('cancel' |
|
1321 |
'no' |
|
1322 |
'yes') |
|
1323 |
) |
|
1324 |
default:(#(nil false true) indexOf:default ifAbsent:nil) |
|
1004 | 1325 |
" |
1326 |
Dialog confirmWithCancel:'really ?' default:false |
|
1327 |
" |
|
1328 |
! |
|
1329 |
||
1624
bc716c00b226
added #confirmWithCancel:labels:
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
1330 |
confirmWithCancel:aString labels:labelArray |
bc716c00b226
added #confirmWithCancel:labels:
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
1331 |
"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
|
1332 |
Return true for 'yes', false for 'no', nil for 'cancel'. |
bc716c00b226
added #confirmWithCancel:labels:
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
1333 |
The default is yes. |
bc716c00b226
added #confirmWithCancel:labels:
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
1334 |
The buttons labels are given in labelArray" |
bc716c00b226
added #confirmWithCancel:labels:
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
1335 |
|
bc716c00b226
added #confirmWithCancel:labels:
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
1336 |
^ self |
bc716c00b226
added #confirmWithCancel:labels:
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
1337 |
confirmWithCancel:aString |
bc716c00b226
added #confirmWithCancel:labels:
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
1338 |
labels:(self |
bc716c00b226
added #confirmWithCancel:labels:
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
1339 |
classResources |
bc716c00b226
added #confirmWithCancel:labels:
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
1340 |
array:labelArray |
bc716c00b226
added #confirmWithCancel:labels:
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
1341 |
) |
bc716c00b226
added #confirmWithCancel:labels:
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
1342 |
default:3 |
bc716c00b226
added #confirmWithCancel:labels:
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
1343 |
" |
bc716c00b226
added #confirmWithCancel:labels:
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
1344 |
Dialog confirmWithCancel:'really ?' labels:#( 'oops' 'nope' 'yea') |
bc716c00b226
added #confirmWithCancel:labels:
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
1345 |
" |
bc716c00b226
added #confirmWithCancel:labels:
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
1346 |
|
bc716c00b226
added #confirmWithCancel:labels:
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
1347 |
"Modified: / 28.7.1998 / 21:40:40 / cg" |
bc716c00b226
added #confirmWithCancel:labels:
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
1348 |
! |
bc716c00b226
added #confirmWithCancel:labels:
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
1349 |
|
846
75c5dc601522
added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents:
831
diff
changeset
|
1350 |
confirmWithCancel:aString labels:buttonLabels default:default |
75c5dc601522
added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents:
831
diff
changeset
|
1351 |
"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
|
1352 |
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
|
1353 |
The strings for cancel, no and yes are to be passed in |
1004 | 1354 |
buttonLabels; |
1355 |
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
|
1356 |
return button (1 to 3)" |
75c5dc601522
added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents:
831
diff
changeset
|
1357 |
|
1707 | 1358 |
^ self |
1359 |
confirmWithCancel:aString |
|
1360 |
labels:buttonLabels |
|
1361 |
values:#(nil false true) |
|
1362 |
default:default |
|
1363 |
||
1364 |
" |
|
1365 |
Transcript showCR:( |
|
1366 |
Dialog |
|
1367 |
confirmWithCancel:'really ?' |
|
1368 |
labels:#('mhmh' 'maybe' 'definitely') |
|
1369 |
default:3 |
|
1370 |
) |
|
1371 |
" |
|
1372 |
||
1373 |
"Created: / 18.10.1996 / 14:50:51 / cg" |
|
1374 |
"Modified: / 21.10.1998 / 15:49:16 / cg" |
|
1375 |
! |
|
1376 |
||
1377 |
confirmWithCancel:aString labels:buttonLabels values:buttonValues default:default |
|
1378 |
"launch a Dialog, which allows user to click on any button. |
|
1379 |
Return the corresponding value from the values array. |
|
1380 |
The labels for for the buttons are to be passed in |
|
1381 |
buttonLabels; |
|
1382 |
The default argument (if non-nil) defines the index of the |
|
1383 |
return button (1 to n)" |
|
1384 |
||
1748
88215be18503
+ confirmWithCancel:labels:values:default:boxLabel:
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
1385 |
^ self |
88215be18503
+ confirmWithCancel:labels:values:default:boxLabel:
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
1386 |
confirmWithCancel:aString |
88215be18503
+ confirmWithCancel:labels:values:default:boxLabel:
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
1387 |
labels:buttonLabels |
88215be18503
+ confirmWithCancel:labels:values:default:boxLabel:
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
1388 |
values:buttonValues |
88215be18503
+ confirmWithCancel:labels:values:default:boxLabel:
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
1389 |
default:default |
88215be18503
+ confirmWithCancel:labels:values:default:boxLabel:
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
1390 |
boxLabel:nil |
88215be18503
+ confirmWithCancel:labels:values:default:boxLabel:
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
1391 |
|
88215be18503
+ confirmWithCancel:labels:values:default:boxLabel:
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
1392 |
" |
88215be18503
+ confirmWithCancel:labels:values:default:boxLabel:
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
1393 |
Transcript showCR:( |
88215be18503
+ confirmWithCancel:labels:values:default:boxLabel:
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
1394 |
Dialog |
88215be18503
+ confirmWithCancel:labels:values:default:boxLabel:
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
1395 |
confirmWithCancel:'really ?' |
88215be18503
+ confirmWithCancel:labels:values:default:boxLabel:
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
1396 |
labels:#('mhmh' 'maybe' 'definitely') |
88215be18503
+ confirmWithCancel:labels:values:default:boxLabel:
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
1397 |
values:#(1 2 3) |
88215be18503
+ confirmWithCancel:labels:values:default:boxLabel:
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
1398 |
default:3 |
88215be18503
+ confirmWithCancel:labels:values:default:boxLabel:
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
1399 |
) |
88215be18503
+ confirmWithCancel:labels:values:default:boxLabel:
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
1400 |
" |
88215be18503
+ confirmWithCancel:labels:values:default:boxLabel:
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
1401 |
|
88215be18503
+ confirmWithCancel:labels:values:default:boxLabel:
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
1402 |
"Created: / 18.10.1996 / 14:50:51 / cg" |
88215be18503
+ confirmWithCancel:labels:values:default:boxLabel:
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
1403 |
"Modified: / 21.10.1998 / 17:14:14 / cg" |
88215be18503
+ confirmWithCancel:labels:values:default:boxLabel:
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
1404 |
! |
88215be18503
+ confirmWithCancel:labels:values:default:boxLabel:
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
1405 |
|
88215be18503
+ confirmWithCancel:labels:values:default:boxLabel:
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
1406 |
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
|
1407 |
"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
|
1408 |
Return the corresponding value from the values array. |
88215be18503
+ confirmWithCancel:labels:values:default:boxLabel:
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
1409 |
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
|
1410 |
buttonLabels; |
88215be18503
+ confirmWithCancel:labels:values:default:boxLabel:
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
1411 |
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
|
1412 |
return button (1 to n)" |
88215be18503
+ confirmWithCancel:labels:values:default:boxLabel:
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
1413 |
|
197 | 1414 |
|box answer| |
1415 |
||
1708
dc23c5ca439e
fixed button-creation in confirmWithCancel.
Claus Gittinger <cg@exept.de>
parents:
1707
diff
changeset
|
1416 |
box := OptionBox title:aString numberOfOptions:buttonLabels size. |
846
75c5dc601522
added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents:
831
diff
changeset
|
1417 |
box buttonTitles:buttonLabels |
1707 | 1418 |
actions:(buttonValues collect:[:v | [answer := v]]). |
1419 |
||
846
75c5dc601522
added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents:
831
diff
changeset
|
1420 |
default notNil ifTrue:[box defaultButtonIndex:default]. |
1748
88215be18503
+ confirmWithCancel:labels:values:default:boxLabel:
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
1421 |
box label:(boxLabelOrNil ? (self classResources string:'confirm')). |
197 | 1422 |
box showAtPointer. |
1423 |
box actions:nil. |
|
719
574be1981be0
destroy boxes from standard dialogs
Claus Gittinger <cg@exept.de>
parents:
718
diff
changeset
|
1424 |
box destroy. |
197 | 1425 |
^ answer |
1426 |
||
1427 |
" |
|
1707 | 1428 |
Transcript showCR:( |
1429 |
Dialog |
|
1430 |
confirmWithCancel:'really ?' |
|
1748
88215be18503
+ confirmWithCancel:labels:values:default:boxLabel:
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
1431 |
labels:#('mhmh' 'maybe' 'definitely') |
88215be18503
+ confirmWithCancel:labels:values:default:boxLabel:
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
1432 |
values:#(1 2 3) |
88215be18503
+ confirmWithCancel:labels:values:default:boxLabel:
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
1433 |
default:3 |
88215be18503
+ confirmWithCancel:labels:values:default:boxLabel:
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
1434 |
boxLabel:'hello there' |
1707 | 1435 |
) |
1436 |
" |
|
1437 |
||
1438 |
"Created: / 18.10.1996 / 14:50:51 / cg" |
|
1708
dc23c5ca439e
fixed button-creation in confirmWithCancel.
Claus Gittinger <cg@exept.de>
parents:
1707
diff
changeset
|
1439 |
"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
|
1440 |
! ! |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
1441 |
|
846
75c5dc601522
added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents:
831
diff
changeset
|
1442 |
!DialogBox class methodsFor:'defaults'! |
573 | 1443 |
|
1444 |
defaultLabel |
|
1445 |
"return the boxes default window title." |
|
1446 |
||
1447 |
^ 'Dialog' |
|
1448 |
||
1449 |
"Created: 23.4.1996 / 17:13:10 / cg" |
|
1757 | 1450 |
! |
1451 |
||
1452 |
updateStyleCache |
|
1453 |
"extract values from the styleSheet and cache them in class variables" |
|
1454 |
||
1455 |
<resource: #style (#'dialogBox.returnShiftsFocusToOK')> |
|
1456 |
||
1457 |
DefaultFocusToOKOnLeave := StyleSheet at:'dialogBox.returnShiftsFocusToOK' default:false. |
|
1458 |
||
573 | 1459 |
! ! |
1460 |
||
846
75c5dc601522
added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents:
831
diff
changeset
|
1461 |
!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
|
1462 |
|
549
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1463 |
requestDirectoryName |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1464 |
"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
|
1465 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1466 |
^ self |
1401 | 1467 |
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
|
1468 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1469 |
" |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1470 |
Dialog requestDirectoryName |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1471 |
" |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1472 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1473 |
"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
|
1474 |
"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
|
1475 |
! |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1476 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1477 |
requestDirectoryName:title |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1478 |
"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
|
1479 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1480 |
^ self |
1401 | 1481 |
requestDirectoryName:title |
1482 |
default:nil |
|
1483 |
ifFail:'' |
|
549
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1484 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1485 |
" |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1486 |
Dialog |
1401 | 1487 |
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
|
1488 |
" |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1489 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1490 |
"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
|
1491 |
"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
|
1492 |
! |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1493 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1494 |
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
|
1495 |
"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
|
1496 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1497 |
^ self |
1740
0160c5afae9c
care for default-dir in #requestDirectoryName:..
Claus Gittinger <cg@exept.de>
parents:
1736
diff
changeset
|
1498 |
requestDirectoryName:title |
0160c5afae9c
care for default-dir in #requestDirectoryName:..
Claus Gittinger <cg@exept.de>
parents:
1736
diff
changeset
|
1499 |
default:aFileName |
0160c5afae9c
care for default-dir in #requestDirectoryName:..
Claus Gittinger <cg@exept.de>
parents:
1736
diff
changeset
|
1500 |
ifFail:'' |
549
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1501 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1502 |
" |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1503 |
Dialog |
1740
0160c5afae9c
care for default-dir in #requestDirectoryName:..
Claus Gittinger <cg@exept.de>
parents:
1736
diff
changeset
|
1504 |
requestDirectoryName:'which directory ?' |
0160c5afae9c
care for default-dir in #requestDirectoryName:..
Claus Gittinger <cg@exept.de>
parents:
1736
diff
changeset
|
1505 |
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
|
1506 |
" |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1507 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1508 |
"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
|
1509 |
"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
|
1510 |
! |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1511 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1512 |
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
|
1513 |
"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
|
1514 |
|
1740
0160c5afae9c
care for default-dir in #requestDirectoryName:..
Claus Gittinger <cg@exept.de>
parents:
1736
diff
changeset
|
1515 |
|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
|
1516 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1517 |
fileBox := FileSelectionBox |
1740
0160c5afae9c
care for default-dir in #requestDirectoryName:..
Claus Gittinger <cg@exept.de>
parents:
1736
diff
changeset
|
1518 |
title:title |
0160c5afae9c
care for default-dir in #requestDirectoryName:..
Claus Gittinger <cg@exept.de>
parents:
1736
diff
changeset
|
1519 |
okText:'ok' |
0160c5afae9c
care for default-dir in #requestDirectoryName:..
Claus Gittinger <cg@exept.de>
parents:
1736
diff
changeset
|
1520 |
abortText:'cancel' |
0160c5afae9c
care for default-dir in #requestDirectoryName:..
Claus Gittinger <cg@exept.de>
parents:
1736
diff
changeset
|
1521 |
action:[:fileName | enteredName := fileName]. |
0160c5afae9c
care for default-dir in #requestDirectoryName:..
Claus Gittinger <cg@exept.de>
parents:
1736
diff
changeset
|
1522 |
|
0160c5afae9c
care for default-dir in #requestDirectoryName:..
Claus Gittinger <cg@exept.de>
parents:
1736
diff
changeset
|
1523 |
fN := aFileName. |
1780
bfc30a82aae3
dont get confused with a nil default
Claus Gittinger <cg@exept.de>
parents:
1764
diff
changeset
|
1524 |
dirF := (aFileName ? '.') asFilename. |
1740
0160c5afae9c
care for default-dir in #requestDirectoryName:..
Claus Gittinger <cg@exept.de>
parents:
1736
diff
changeset
|
1525 |
dirF name = dirF baseName ifFalse:[ |
0160c5afae9c
care for default-dir in #requestDirectoryName:..
Claus Gittinger <cg@exept.de>
parents:
1736
diff
changeset
|
1526 |
dir := dirF directoryName. |
0160c5afae9c
care for default-dir in #requestDirectoryName:..
Claus Gittinger <cg@exept.de>
parents:
1736
diff
changeset
|
1527 |
fN := dirF baseName. |
0160c5afae9c
care for default-dir in #requestDirectoryName:..
Claus Gittinger <cg@exept.de>
parents:
1736
diff
changeset
|
1528 |
] ifTrue:[ |
0160c5afae9c
care for default-dir in #requestDirectoryName:..
Claus Gittinger <cg@exept.de>
parents:
1736
diff
changeset
|
1529 |
dir := FileSelectionBox lastFileSelectionDirectory. |
0160c5afae9c
care for default-dir in #requestDirectoryName:..
Claus Gittinger <cg@exept.de>
parents:
1736
diff
changeset
|
1530 |
]. |
1360
ede30cea2827
also remember last directory in requestFileName dialogs
Claus Gittinger <cg@exept.de>
parents:
1355
diff
changeset
|
1531 |
dir notNil ifTrue:[ |
1740
0160c5afae9c
care for default-dir in #requestDirectoryName:..
Claus Gittinger <cg@exept.de>
parents:
1736
diff
changeset
|
1532 |
fileBox directory:dir. |
1360
ede30cea2827
also remember last directory in requestFileName dialogs
Claus Gittinger <cg@exept.de>
parents:
1355
diff
changeset
|
1533 |
]. |
549
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1534 |
|
1740
0160c5afae9c
care for default-dir in #requestDirectoryName:..
Claus Gittinger <cg@exept.de>
parents:
1736
diff
changeset
|
1535 |
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
|
1536 |
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
|
1537 |
fileBox showAtPointer. |
719
574be1981be0
destroy boxes from standard dialogs
Claus Gittinger <cg@exept.de>
parents:
718
diff
changeset
|
1538 |
fileBox destroy. |
1360
ede30cea2827
also remember last directory in requestFileName dialogs
Claus Gittinger <cg@exept.de>
parents:
1355
diff
changeset
|
1539 |
|
ede30cea2827
also remember last directory in requestFileName dialogs
Claus Gittinger <cg@exept.de>
parents:
1355
diff
changeset
|
1540 |
(enteredName isNil |
ede30cea2827
also remember last directory in requestFileName dialogs
Claus Gittinger <cg@exept.de>
parents:
1355
diff
changeset
|
1541 |
or:[enteredName isEmpty]) ifTrue:[ |
1740
0160c5afae9c
care for default-dir in #requestDirectoryName:..
Claus Gittinger <cg@exept.de>
parents:
1736
diff
changeset
|
1542 |
^ failBlock value |
1360
ede30cea2827
also remember last directory in requestFileName dialogs
Claus Gittinger <cg@exept.de>
parents:
1355
diff
changeset
|
1543 |
]. |
ede30cea2827
also remember last directory in requestFileName dialogs
Claus Gittinger <cg@exept.de>
parents:
1355
diff
changeset
|
1544 |
|
ede30cea2827
also remember last directory in requestFileName dialogs
Claus Gittinger <cg@exept.de>
parents:
1355
diff
changeset
|
1545 |
FileSelectionBox lastFileSelectionDirectory:(enteredName asFilename directoryName). |
ede30cea2827
also remember last directory in requestFileName dialogs
Claus Gittinger <cg@exept.de>
parents:
1355
diff
changeset
|
1546 |
|
ede30cea2827
also remember last directory in requestFileName dialogs
Claus Gittinger <cg@exept.de>
parents:
1355
diff
changeset
|
1547 |
^ enteredName |
549
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 |
" |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1550 |
Dialog |
1740
0160c5afae9c
care for default-dir in #requestDirectoryName:..
Claus Gittinger <cg@exept.de>
parents:
1736
diff
changeset
|
1551 |
requestDirectoryName:'which directory ?' |
0160c5afae9c
care for default-dir in #requestDirectoryName:..
Claus Gittinger <cg@exept.de>
parents:
1736
diff
changeset
|
1552 |
default:'/etc' |
0160c5afae9c
care for default-dir in #requestDirectoryName:..
Claus Gittinger <cg@exept.de>
parents:
1736
diff
changeset
|
1553 |
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
|
1554 |
" |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1555 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1556 |
"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
|
1557 |
"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
|
1558 |
! |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1559 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1560 |
requestFileName |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1561 |
"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
|
1562 |
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
|
1563 |
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
|
1564 |
|
549
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1565 |
^ self |
1401 | 1566 |
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
|
1567 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1568 |
" |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1569 |
Dialog requestFileName |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1570 |
" |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1571 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1572 |
"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
|
1573 |
"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
|
1574 |
! |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1575 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1576 |
requestFileName:titleString |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1577 |
"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
|
1578 |
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
|
1579 |
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
|
1580 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1581 |
^ self |
1401 | 1582 |
requestFileName:titleString |
1583 |
default:'file.ext' |
|
183 | 1584 |
|
197 | 1585 |
" |
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
|
1586 |
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
|
1587 |
Dialog requestFileName:'enter a fileName:' |
183 | 1588 |
" |
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
|
1589 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
1590 |
"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
|
1591 |
"Modified: 19.4.1996 / 13:53:17 / cg" |
118 | 1592 |
! |
1593 |
||
100 | 1594 |
requestFileName:titleString default:defaultName |
1595 |
"launch a Dialog, which allows user to enter a filename. |
|
1596 |
The box will not allow pressing 'ok' without an entered string. |
|
1597 |
Return the pathname string consisting of the full pathname of the filename, |
|
1598 |
or an empty string (if cancel was pressed)." |
|
1599 |
||
549
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1600 |
^ self |
1401 | 1601 |
requestFileName:titleString |
1602 |
default:defaultName |
|
1603 |
version:nil |
|
1604 |
ifFail:'' |
|
100 | 1605 |
|
1606 |
" |
|
1607 |
Dialog requestFileName:'enter a fileName:' default:'' |
|
1608 |
Dialog requestFileName:'enter a fileName:' default:'Makefile.bak' |
|
1609 |
" |
|
549
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1610 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1611 |
"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
|
1612 |
! |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1613 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1614 |
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
|
1615 |
"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
|
1616 |
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
|
1617 |
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
|
1618 |
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
|
1619 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1620 |
^ self |
1401 | 1621 |
requestFileName:titleString |
1622 |
default:defaultName |
|
1623 |
version:nil |
|
1624 |
ifFail:'' |
|
1625 |
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
|
1626 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1627 |
" |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1628 |
Dialog |
1401 | 1629 |
requestFileName:'enter a fileName:' |
1630 |
default:'Makefile.bak' |
|
1631 |
fromDirectory:'..' |
|
549
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1632 |
" |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1633 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1634 |
"Modified: 19.4.1996 / 14:27:31 / cg" |
100 | 1635 |
! |
1636 |
||
1736 | 1637 |
requestFileName:titleString default:defaultName ifFail:failReturn pattern:pattern fromDirectory:dir |
1638 |
"launch a Dialog, which allows user to enter a filename. |
|
1639 |
The files presented initially are those from dir. |
|
1640 |
The box will show ok/cancel in its buttons. |
|
1641 |
The matchPattern is set to pattern initially. |
|
1642 |
Return the string or failReturn if cancel was pressed." |
|
1643 |
||
1644 |
^ self |
|
1645 |
requestFileName:titleString |
|
1646 |
default:defaultName |
|
1647 |
version:nil |
|
1648 |
ifFail:failReturn |
|
1649 |
pattern:pattern |
|
1650 |
fromDirectory:dir |
|
1651 |
||
1652 |
! |
|
1653 |
||
197 | 1654 |
requestFileName:titleString default:defaultName ok:okText abort:abortText pattern:pattern |
1655 |
"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
|
1656 |
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
|
1657 |
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
|
1658 |
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
|
1659 |
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
|
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 |
ok:okText |
|
1665 |
abort:abortText |
|
1666 |
pattern:pattern |
|
1667 |
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
|
1668 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1669 |
" |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1670 |
Dialog |
1401 | 1671 |
requestFileName:'enter a fileName:' |
1672 |
default:'' |
|
1673 |
ok:'yeah' |
|
1674 |
abort:'oh, no' |
|
1675 |
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
|
1676 |
" |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1677 |
|
1029
ddc27f751b3d
allow path as default in requestFileName;
Claus Gittinger <cg@exept.de>
parents:
1004
diff
changeset
|
1678 |
"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
|
1679 |
! |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1680 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1681 |
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
|
1682 |
"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
|
1683 |
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
|
1684 |
current directory (if a nil path is given). |
197 | 1685 |
The box will show okText in its okButton, abortText in the abortButton. |
1686 |
The matchPattern is set to pattern initially. |
|
719
574be1981be0
destroy boxes from standard dialogs
Claus Gittinger <cg@exept.de>
parents:
718
diff
changeset
|
1687 |
Return the string, or nil if cancel was pressed." |
197 | 1688 |
|
1360
ede30cea2827
also remember last directory in requestFileName dialogs
Claus Gittinger <cg@exept.de>
parents:
1355
diff
changeset
|
1689 |
|box defaultDir defaultNm dir enteredName| |
1029
ddc27f751b3d
allow path as default in requestFileName;
Claus Gittinger <cg@exept.de>
parents:
1004
diff
changeset
|
1690 |
|
ddc27f751b3d
allow path as default in requestFileName;
Claus Gittinger <cg@exept.de>
parents:
1004
diff
changeset
|
1691 |
defaultNm := defaultName. |
ddc27f751b3d
allow path as default in requestFileName;
Claus Gittinger <cg@exept.de>
parents:
1004
diff
changeset
|
1692 |
defaultDir := aDirectoryPath. |
ddc27f751b3d
allow path as default in requestFileName;
Claus Gittinger <cg@exept.de>
parents:
1004
diff
changeset
|
1693 |
defaultDir isNil ifTrue:[ |
1401 | 1694 |
defaultNm notNil ifTrue:[ |
1695 |
defaultDir := defaultName asFilename directoryName. |
|
1696 |
defaultNm := defaultNm asFilename baseName. |
|
1697 |
defaultDir = Filename currentDirectory name ifTrue:[ |
|
1698 |
defaultName asFilename isExplicitRelative ifFalse:[ |
|
1699 |
defaultDir := nil |
|
1700 |
] |
|
1701 |
] |
|
1702 |
]. |
|
1029
ddc27f751b3d
allow path as default in requestFileName;
Claus Gittinger <cg@exept.de>
parents:
1004
diff
changeset
|
1703 |
]. |
197 | 1704 |
|
1705 |
box := FileSelectionBox |
|
1401 | 1706 |
title:titleString |
1707 |
okText:okText |
|
1708 |
abortText:abortText |
|
1709 |
action:[:fileName | enteredName := fileName]. |
|
1360
ede30cea2827
also remember last directory in requestFileName dialogs
Claus Gittinger <cg@exept.de>
parents:
1355
diff
changeset
|
1710 |
|
ede30cea2827
also remember last directory in requestFileName dialogs
Claus Gittinger <cg@exept.de>
parents:
1355
diff
changeset
|
1711 |
defaultDir notNil ifTrue:[ |
1401 | 1712 |
box directory:defaultDir |
1360
ede30cea2827
also remember last directory in requestFileName dialogs
Claus Gittinger <cg@exept.de>
parents:
1355
diff
changeset
|
1713 |
] ifFalse:[ |
1401 | 1714 |
dir := FileSelectionBox lastFileSelectionDirectory. |
1715 |
dir notNil ifTrue:[ |
|
1716 |
box directory:dir. |
|
1717 |
]. |
|
1360
ede30cea2827
also remember last directory in requestFileName dialogs
Claus Gittinger <cg@exept.de>
parents:
1355
diff
changeset
|
1718 |
]. |
197 | 1719 |
box pattern:pattern. |
1029
ddc27f751b3d
allow path as default in requestFileName;
Claus Gittinger <cg@exept.de>
parents:
1004
diff
changeset
|
1720 |
box initialText:defaultNm. |
197 | 1721 |
box showAtPointer. |
1722 |
box action:nil. |
|
719
574be1981be0
destroy boxes from standard dialogs
Claus Gittinger <cg@exept.de>
parents:
718
diff
changeset
|
1723 |
box destroy. |
1360
ede30cea2827
also remember last directory in requestFileName dialogs
Claus Gittinger <cg@exept.de>
parents:
1355
diff
changeset
|
1724 |
|
ede30cea2827
also remember last directory in requestFileName dialogs
Claus Gittinger <cg@exept.de>
parents:
1355
diff
changeset
|
1725 |
(enteredName notNil |
ede30cea2827
also remember last directory in requestFileName dialogs
Claus Gittinger <cg@exept.de>
parents:
1355
diff
changeset
|
1726 |
and:[enteredName notEmpty]) ifTrue:[ |
1401 | 1727 |
FileSelectionBox lastFileSelectionDirectory:(enteredName asFilename directoryName). |
1360
ede30cea2827
also remember last directory in requestFileName dialogs
Claus Gittinger <cg@exept.de>
parents:
1355
diff
changeset
|
1728 |
]. |
ede30cea2827
also remember last directory in requestFileName dialogs
Claus Gittinger <cg@exept.de>
parents:
1355
diff
changeset
|
1729 |
|
ede30cea2827
also remember last directory in requestFileName dialogs
Claus Gittinger <cg@exept.de>
parents:
1355
diff
changeset
|
1730 |
^ enteredName |
197 | 1731 |
|
1732 |
" |
|
549
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1733 |
Dialog |
1401 | 1734 |
requestFileName:'enter a fileName:' |
1735 |
default:'' |
|
1736 |
ok:'yeah' |
|
1737 |
abort:'oh, no' |
|
1738 |
pattern:'rc*' |
|
1739 |
fromDirectory:'/etc' |
|
197 | 1740 |
" |
549
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1741 |
|
1360
ede30cea2827
also remember last directory in requestFileName dialogs
Claus Gittinger <cg@exept.de>
parents:
1355
diff
changeset
|
1742 |
"Modified: 23.10.1997 / 19:59:01 / cg" |
197 | 1743 |
! |
1744 |
||
1030 | 1745 |
requestFileName:titleString default:defaultName pattern:pattern |
1746 |
"launch a Dialog, which allows user to enter a filename. |
|
1747 |
The files presented initially are those from the current directory. |
|
1748 |
The box will show ok/cancel in its buttons. |
|
1749 |
The matchPattern is set to pattern initially. |
|
1750 |
Return the string or nil if cancel was pressed." |
|
1751 |
||
1752 |
^ self |
|
1401 | 1753 |
requestFileName:titleString |
1754 |
default:defaultName |
|
1755 |
ok:(self classResources string:'ok') |
|
1756 |
abort:(self classResources string:'cancel') |
|
1757 |
pattern:pattern |
|
1758 |
fromDirectory:nil |
|
1030 | 1759 |
|
1760 |
" |
|
1761 |
Dialog |
|
1401 | 1762 |
requestFileName:'enter a fileName:' |
1763 |
default:'' |
|
1764 |
pattern:'*.st' |
|
1030 | 1765 |
" |
1766 |
" |
|
1767 |
Dialog |
|
1401 | 1768 |
requestFileName:'enter a fileName:' |
1769 |
default:'' |
|
1770 |
pattern:'*.st;*.h' |
|
1030 | 1771 |
" |
1772 |
||
1773 |
"Created: 21.2.1997 / 11:16:52 / cg" |
|
1774 |
"Modified: 21.2.1997 / 11:18:40 / cg" |
|
1775 |
! |
|
1776 |
||
100 | 1777 |
requestFileName:titleString default:defaultName version:versionSymbol |
1778 |
"launch a Dialog, which allows user to enter a filename. |
|
1779 |
The box will not allow pressing 'ok' without an entered string. |
|
1780 |
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
|
1781 |
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
|
1782 |
it may be any of: |
1401 | 1783 |
#mustBeNew - fail (return empty string) if the file exists |
1784 |
#new - confirm if the file exists |
|
1785 |
#mustBeOld - fail if the file does not exist |
|
1786 |
#old - confirm if the file does not exist |
|
1787 |
#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
|
1788 |
" |
100 | 1789 |
|
549
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1790 |
^ self |
1401 | 1791 |
requestFileName:titleString |
1792 |
default:defaultName |
|
1793 |
version:versionSymbol |
|
1794 |
ifFail:'' |
|
100 | 1795 |
|
1796 |
" |
|
1797 |
Dialog requestFileName:'enter a fileName:' |
|
1401 | 1798 |
default:'' |
1799 |
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
|
1800 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
1801 |
Dialog requestFileName:'enter a fileName:' |
1401 | 1802 |
default:'' |
1803 |
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
|
1804 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
1805 |
Dialog requestFileName:'enter a fileName:' |
1401 | 1806 |
default:'' |
1807 |
version:#new |
|
100 | 1808 |
" |
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
|
1809 |
|
549
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1810 |
"Modified: 19.4.1996 / 13:53:58 / cg" |
100 | 1811 |
! |
1812 |
||
1813 |
requestFileName:titleString default:defaultName version:versionSymbol ifFail:failBlock |
|
1814 |
"launch a Dialog, which allows user to enter a filename. |
|
1815 |
The box will not allow pressing 'ok' without an entered string. |
|
1816 |
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
|
1817 |
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
|
1818 |
it may be any of: |
1401 | 1819 |
#mustBeNew - fail (return empty string) if the file exists |
1820 |
#new - confirm if the file exists |
|
1821 |
#mustBeOld - fail if the file does not exist |
|
1822 |
#old - confirm if the file does not exist |
|
1823 |
#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
|
1824 |
" |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1825 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1826 |
^ self |
1401 | 1827 |
requestFileName:titleString |
1828 |
default:defaultName |
|
1829 |
version:versionSymbol |
|
1830 |
ifFail:failBlock |
|
1831 |
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
|
1832 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1833 |
" |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1834 |
Dialog |
1401 | 1835 |
requestFileName:'enter a fileName:' |
1836 |
default:'' |
|
1837 |
version:nil |
|
1838 |
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
|
1839 |
" |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1840 |
" |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1841 |
Dialog |
1401 | 1842 |
requestFileName:'enter a fileName:' |
1843 |
default:'' |
|
1844 |
version:#old |
|
1845 |
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
|
1846 |
" |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1847 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1848 |
"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
|
1849 |
! |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1850 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1851 |
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
|
1852 |
"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
|
1853 |
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
|
1854 |
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
|
1855 |
it may be any of: |
1736 | 1856 |
#mustBeNew - fail (return empty string) if the file exists |
1857 |
#new - confirm if the file exists |
|
1858 |
#mustBeOld - fail if the file does not exist |
|
1859 |
#old - confirm if the file does not exist |
|
1860 |
#any (other) - no validation |
|
1861 |
" |
|
1862 |
||
1863 |
^ self |
|
1864 |
requestFileName:titleString |
|
1865 |
default:defaultName |
|
1866 |
version:versionSymbol |
|
1867 |
ifFail:failBlock |
|
1868 |
pattern:nil |
|
1869 |
fromDirectory:aDirectoryPath |
|
1031 | 1870 |
|
1871 |
" |
|
1872 |
Dialog |
|
1736 | 1873 |
requestFileName:'enter a fileName:' |
1874 |
default:'' |
|
1875 |
version:nil |
|
1876 |
ifFail:['none'] |
|
1877 |
fromDirectory:'/etc' |
|
1031 | 1878 |
" |
1879 |
" |
|
1880 |
Dialog |
|
1736 | 1881 |
requestFileName:'enter a fileName:' |
1882 |
default:'' |
|
1883 |
version:#old |
|
1884 |
ifFail:['none'] |
|
1885 |
fromDirectory:'/etc' |
|
1031 | 1886 |
" |
1887 |
" |
|
1888 |
Dialog |
|
1736 | 1889 |
requestFileName:'enter a fileName:' |
1890 |
default:'' |
|
1891 |
version:#mustBeNew |
|
1892 |
ifFail:['none'] |
|
1893 |
fromDirectory:'/etc' |
|
1031 | 1894 |
" |
1895 |
||
1896 |
"Modified: 20.2.1997 / 18:12:28 / cg" |
|
1897 |
"Modified: 21.2.1997 / 14:27:27 / stefan" |
|
1898 |
! |
|
1899 |
||
1900 |
requestFileName:titleString default:defaultName version:versionSymbol ifFail:failBlock pattern:pattern fromDirectory:aDirectoryPath |
|
1901 |
"launch a Dialog, which allows user to enter a filename. |
|
1902 |
Return the string or the value of failBlock if cancel was pressed. |
|
1903 |
The version argument allows validation of the files existance; |
|
1904 |
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
|
1905 |
#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
|
1906 |
#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
|
1907 |
#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
|
1908 |
#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
|
1909 |
#any (other) - no validation |
1031 | 1910 |
" |
1911 |
||
1029
ddc27f751b3d
allow path as default in requestFileName;
Claus Gittinger <cg@exept.de>
parents:
1004
diff
changeset
|
1912 |
|box defaultDir defaultNm| |
ddc27f751b3d
allow path as default in requestFileName;
Claus Gittinger <cg@exept.de>
parents:
1004
diff
changeset
|
1913 |
|
ddc27f751b3d
allow path as default in requestFileName;
Claus Gittinger <cg@exept.de>
parents:
1004
diff
changeset
|
1914 |
defaultNm := defaultName. |
ddc27f751b3d
allow path as default in requestFileName;
Claus Gittinger <cg@exept.de>
parents:
1004
diff
changeset
|
1915 |
defaultDir := aDirectoryPath. |
ddc27f751b3d
allow path as default in requestFileName;
Claus Gittinger <cg@exept.de>
parents:
1004
diff
changeset
|
1916 |
defaultDir isNil ifTrue:[ |
1575
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
1917 |
defaultNm notNil ifTrue:[ |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
1918 |
defaultName asFilename withoutSuffix baseName = '*' ifTrue:[ |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
1919 |
defaultDir := FileSelectionBox lastFileSelectionDirectory. |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
1920 |
defaultNm := ''. |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
1921 |
] ifFalse:[ |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
1922 |
defaultDir := defaultName asFilename directoryName. |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
1923 |
defaultNm := defaultNm asFilename baseName. |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
1924 |
] |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
1925 |
]. |
1029
ddc27f751b3d
allow path as default in requestFileName;
Claus Gittinger <cg@exept.de>
parents:
1004
diff
changeset
|
1926 |
]. |
100 | 1927 |
|
1928 |
box := FileSelectionBox title:titleString. |
|
1029
ddc27f751b3d
allow path as default in requestFileName;
Claus Gittinger <cg@exept.de>
parents:
1004
diff
changeset
|
1929 |
defaultDir notNil ifTrue:[box directory:defaultDir]. |
1031 | 1930 |
pattern notNil ifTrue:[box pattern:pattern]. |
1029
ddc27f751b3d
allow path as default in requestFileName;
Claus Gittinger <cg@exept.de>
parents:
1004
diff
changeset
|
1931 |
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
|
1932 |
box action:[:name | |
1575
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
1933 |
versionSymbol == #mustBeNew ifTrue:[ |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
1934 |
"/ file may not exist |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
1935 |
name asFilename exists ifTrue:[^ '']. |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
1936 |
]. |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
1937 |
versionSymbol == #new ifTrue:[ |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
1938 |
"/ file may not exist |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
1939 |
name asFilename exists ifTrue:[ |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
1940 |
(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
|
1941 |
ifFalse:[^ '']. |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
1942 |
]. |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
1943 |
]. |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
1944 |
versionSymbol == #mustBeOld ifTrue:[ |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
1945 |
name asFilename exists ifFalse:[^ '']. |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
1946 |
]. |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
1947 |
versionSymbol == #old ifTrue:[ |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
1948 |
"/ file may not exist |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
1949 |
name asFilename exists ifFalse:[ |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
1950 |
(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
|
1951 |
ifFalse:[^ '']. |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
1952 |
]. |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
1953 |
]. |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
1954 |
FileSelectionBox lastFileSelectionDirectory:box directory. |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
1955 |
box destroy. |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
1956 |
^ 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
|
1957 |
]. |
100 | 1958 |
box showAtPointer. |
1959 |
box action:nil. |
|
719
574be1981be0
destroy boxes from standard dialogs
Claus Gittinger <cg@exept.de>
parents:
718
diff
changeset
|
1960 |
box destroy. |
100 | 1961 |
^ failBlock value |
1962 |
||
1963 |
" |
|
549
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1964 |
Dialog |
1575
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
1965 |
requestFileName:'enter a fileName:' |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
1966 |
default:'' |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
1967 |
version:nil |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
1968 |
ifFail:['none'] |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
1969 |
pattern:'*.conf' |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
1970 |
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
|
1971 |
" |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1972 |
" |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1973 |
Dialog |
1575
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
1974 |
requestFileName:'enter a fileName:' |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
1975 |
default:'' |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
1976 |
version:#old |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
1977 |
ifFail:['none'] |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
1978 |
pattern:'*.conf' |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
1979 |
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
|
1980 |
" |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
1981 |
" |
549
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1982 |
Dialog |
1575
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
1983 |
requestFileName:'enter a fileName:' |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
1984 |
default:'' |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
1985 |
version:#mustBeNew |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
1986 |
ifFail:['none'] |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
1987 |
pattern:'*.conf' |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
1988 |
fromDirectory:'/etc' |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
1989 |
" |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
1990 |
|
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
1991 |
"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
|
1992 |
"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
|
1993 |
"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
|
1994 |
! |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1995 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1996 |
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
|
1997 |
"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
|
1998 |
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
|
1999 |
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
|
2000 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2001 |
^ self |
1401 | 2002 |
requestFileName:titleString |
2003 |
default:'file.ext' |
|
2004 |
version:nil |
|
2005 |
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
|
2006 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2007 |
" |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2008 |
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
|
2009 |
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
|
2010 |
" |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2011 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2012 |
"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
|
2013 |
"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
|
2014 |
! |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2015 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2016 |
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
|
2017 |
"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
|
2018 |
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
|
2019 |
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
|
2020 |
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
|
2021 |
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
|
2022 |
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
|
2023 |
|
1736 | 2024 |
^ self |
2025 |
requestFileName:titleString |
|
2026 |
default:defaultName |
|
2027 |
version:#new |
|
2028 |
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
|
2029 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2030 |
" |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2031 |
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
|
2032 |
" |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2033 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2034 |
"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
|
2035 |
! ! |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2036 |
|
846
75c5dc601522
added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents:
831
diff
changeset
|
2037 |
!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
|
2038 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2039 |
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
|
2040 |
"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
|
2041 |
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
|
2042 |
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
|
2043 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2044 |
^ self |
1401 | 2045 |
request:aString |
2046 |
displayAt:nil |
|
2047 |
centered:false |
|
2048 |
action:nil |
|
2049 |
initialAnswer:'' |
|
2050 |
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
|
2051 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2052 |
" |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2053 |
Dialog |
1401 | 2054 |
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
|
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 |
|
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2057 |
"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
|
2058 |
! |
d3fe810390cb
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 |
|
d3fe810390cb
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 |
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
|
2061 |
"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
|
2062 |
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
|
2063 |
that point. |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2064 |
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
|
2065 |
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
|
2066 |
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
|
2067 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2068 |
^ self |
1401 | 2069 |
request:aString |
2070 |
displayAt:aPoint |
|
2071 |
centered:centered |
|
2072 |
action:resultAction |
|
2073 |
initialAnswer:initial |
|
2074 |
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
|
2075 |
|
d3fe810390cb
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 |
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
|
2078 |
|
1401 | 2079 |
Dialog |
2080 |
request:'enter a string:' |
|
2081 |
displayAt:200@200 |
|
2082 |
centered:true |
|
2083 |
action:[:result | result printNewline] |
|
2084 |
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
|
2085 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2086 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2087 |
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
|
2088 |
|
1401 | 2089 |
Dialog |
2090 |
request:'enter a string:' |
|
2091 |
displayAt:200@200 |
|
2092 |
centered:false |
|
2093 |
action:[:result | result printNewline] |
|
2094 |
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
|
2095 |
|
d3fe810390cb
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 |
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
|
2097 |
|
1401 | 2098 |
Dialog |
2099 |
request:'enter a string:' |
|
2100 |
displayAt:nil |
|
2101 |
centered:false |
|
2102 |
action:[:result | result printNewline] |
|
2103 |
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
|
2104 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2105 |
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
|
2106 |
|
1401 | 2107 |
Dialog |
2108 |
request:'enter a string:' |
|
2109 |
displayAt:nil |
|
2110 |
centered:true |
|
2111 |
action:[:result | result printNewline] |
|
2112 |
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
|
2113 |
" |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2114 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2115 |
"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
|
2116 |
"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
|
2117 |
! |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2118 |
|
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2119 |
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
|
2120 |
"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
|
2121 |
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
|
2122 |
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
|
2123 |
screen center (if centered is true). |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2124 |
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
|
2125 |
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
|
2126 |
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
|
2127 |
|
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2128 |
^ self |
1401 | 2129 |
request:aString |
2130 |
displayAt:aPoint |
|
2131 |
centered:centered |
|
2132 |
action:resultAction |
|
2133 |
initialAnswer:initial |
|
2134 |
okLabel:okLabel |
|
2135 |
cancelLabel:cancelLabel |
|
2136 |
title:nil |
|
2137 |
onCancel:cancelValue |
|
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2138 |
|
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2139 |
" |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2140 |
at topLeft (centering is suppressed, to make the box fully visible) |
1401 | 2141 |
Dialog |
2142 |
request:'enter a string:' |
|
2143 |
displayAt:0@0 |
|
2144 |
centered:true |
|
2145 |
action:[:result | result printNewline] |
|
2146 |
initialAnswer:'the default' |
|
2147 |
okLabel:'yes' |
|
2148 |
cancelLabel:'no' |
|
2149 |
onCancel:#foo |
|
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2150 |
|
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2151 |
centered around 200@200: |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2152 |
|
1401 | 2153 |
Dialog |
2154 |
request:'enter a string:' |
|
2155 |
displayAt:200@200 |
|
2156 |
centered:true |
|
2157 |
action:[:result | result printNewline] |
|
2158 |
initialAnswer:'the default' |
|
2159 |
okLabel:'yes' |
|
2160 |
cancelLabel:'no' |
|
2161 |
onCancel:#foo |
|
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2162 |
|
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2163 |
topLeft of box at 200@200: |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2164 |
|
1401 | 2165 |
Dialog |
2166 |
request:'enter a string:' |
|
2167 |
displayAt:200@200 |
|
2168 |
centered:false |
|
2169 |
action:[:result | result printNewline] |
|
2170 |
initialAnswer:'the default' |
|
2171 |
okLabel:'yes' |
|
2172 |
cancelLabel:'no' |
|
2173 |
onCancel:#foo |
|
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2174 |
|
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2175 |
under mouse pointer: |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2176 |
|
1401 | 2177 |
Dialog |
2178 |
request:'enter a string:' |
|
2179 |
displayAt:nil |
|
2180 |
centered:false |
|
2181 |
action:[:result | result printNewline] |
|
2182 |
initialAnswer:'the default' |
|
2183 |
okLabel:'yes' |
|
2184 |
cancelLabel:'no' |
|
2185 |
onCancel:#foo |
|
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2186 |
|
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2187 |
centered on the screen: |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2188 |
|
1401 | 2189 |
Dialog |
2190 |
request:'enter a string:' |
|
2191 |
displayAt:nil |
|
2192 |
centered:true |
|
2193 |
action:[:result | result printNewline] |
|
2194 |
initialAnswer:'the default' |
|
2195 |
okLabel:'yes' |
|
2196 |
cancelLabel:'no' |
|
2197 |
onCancel:#foo |
|
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2198 |
" |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2199 |
|
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2200 |
"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
|
2201 |
"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
|
2202 |
! |
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 |
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
|
2205 |
"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
|
2206 |
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
|
2207 |
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
|
2208 |
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
|
2209 |
screen center (if centered is true). |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2210 |
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
|
2211 |
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
|
2212 |
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
|
2213 |
|
1705
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2214 |
^ self |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2215 |
request:aString |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2216 |
displayAt:aPoint |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2217 |
centered:centered |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2218 |
action:resultAction |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2219 |
initialAnswer:initial |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2220 |
okLabel:okLabel |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2221 |
cancelLabel:cancelLabel |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2222 |
title:titleString |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2223 |
onCancel:cancelValue |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2224 |
list:nil |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2225 |
|
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2226 |
! |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2227 |
|
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2228 |
request:aString displayAt:aPoint centered:centered action:resultAction initialAnswer:initial okLabel:okLabel cancelLabel:cancelLabel title:titleString onCancel:cancelValue list:listToSelectFrom |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2229 |
"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
|
2230 |
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
|
2231 |
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
|
2232 |
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
|
2233 |
screen center (if centered is true). |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2234 |
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
|
2235 |
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
|
2236 |
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
|
2237 |
|
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2238 |
|box| |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2239 |
|
1705
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2240 |
listToSelectFrom isNil ifTrue:[ |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2241 |
box := EnterBox title:aString. |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2242 |
] ifFalse:[ |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2243 |
box := EnterBoxWithList title:aString. |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2244 |
box list:listToSelectFrom. |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2245 |
]. |
1401 | 2246 |
box initialText:initial printString. |
719
574be1981be0
destroy boxes from standard dialogs
Claus Gittinger <cg@exept.de>
parents:
718
diff
changeset
|
2247 |
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
|
2248 |
okLabel notNil ifTrue:[ |
1705
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2249 |
box okText:okLabel. |
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2250 |
]. |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2251 |
cancelLabel notNil ifTrue:[ |
1705
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2252 |
box abortText:cancelLabel |
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2253 |
]. |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2254 |
resultAction isNil ifTrue:[ |
1705
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2255 |
box action:[:val | box destroy. ^ val] |
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2256 |
] ifFalse:[ |
1705
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2257 |
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
|
2258 |
]. |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2259 |
titleString notNil ifTrue:[ |
1705
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2260 |
box label:titleString |
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2261 |
]. |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2262 |
|
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2263 |
aPoint notNil ifTrue:[ |
1705
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2264 |
box showAt:aPoint center:centered |
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2265 |
] ifFalse:[ |
1705
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2266 |
centered ifTrue:[ |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2267 |
box showAtCenter |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2268 |
] ifFalse:[ |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2269 |
box showAtPointer |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2270 |
] |
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2271 |
]. |
719
574be1981be0
destroy boxes from standard dialogs
Claus Gittinger <cg@exept.de>
parents:
718
diff
changeset
|
2272 |
box destroy. |
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2273 |
^ cancelValue value. |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2274 |
|
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2275 |
" |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2276 |
centered around 200@200: |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2277 |
|
1705
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2278 |
Dialog |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2279 |
request:'enter a string:' |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2280 |
displayAt:200@200 |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2281 |
centered:true |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2282 |
action:[:result | result printNewline] |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2283 |
initialAnswer:'the default' |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2284 |
okLabel:'yes' |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2285 |
cancelLabel:'no' |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2286 |
title:'foo' |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2287 |
onCancel:#foo |
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2288 |
|
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2289 |
under mouse pointer: |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2290 |
|
1705
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2291 |
Dialog |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2292 |
request:'enter a string:' |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2293 |
displayAt:nil |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2294 |
centered:false |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2295 |
action:[:result | result printNewline] |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2296 |
initialAnswer:'the default' |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2297 |
okLabel:'yes' |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2298 |
cancelLabel:'no' |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2299 |
title:'foo' |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2300 |
onCancel:#foo |
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2301 |
|
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2302 |
centered on the screen: |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2303 |
|
1705
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2304 |
Dialog |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2305 |
request:'enter a string:' |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2306 |
displayAt:nil |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2307 |
centered:true |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2308 |
action:[:result | result printNewline] |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2309 |
initialAnswer:'the default' |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2310 |
okLabel:'yes' |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2311 |
cancelLabel:'no' |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2312 |
title:'foo' |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2313 |
onCancel:#foo |
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2314 |
" |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2315 |
|
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2316 |
"Created: 29.5.1996 / 14:35:04 / cg" |
719
574be1981be0
destroy boxes from standard dialogs
Claus Gittinger <cg@exept.de>
parents:
718
diff
changeset
|
2317 |
"Modified: 29.5.1996 / 15:26:34 / 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
|
2318 |
! |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2319 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2320 |
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
|
2321 |
"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
|
2322 |
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
|
2323 |
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
|
2324 |
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
|
2325 |
|
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2326 |
^ self |
1401 | 2327 |
request:aString |
2328 |
displayAt:aPoint |
|
2329 |
centered:centered |
|
2330 |
action:resultAction |
|
2331 |
initialAnswer:initial |
|
2332 |
okLabel:nil |
|
2333 |
cancelLabel:nil |
|
2334 |
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
|
2335 |
|
100 | 2336 |
" |
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
|
2337 |
at topLeft (centering is suppressed, to make the box fully visible) |
1401 | 2338 |
Dialog |
2339 |
request:'enter a string:' |
|
2340 |
displayAt:0@0 |
|
2341 |
centered:true |
|
2342 |
action:[:result | result printNewline] |
|
2343 |
initialAnswer:'the default' |
|
2344 |
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
|
2345 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2346 |
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
|
2347 |
|
1401 | 2348 |
Dialog |
2349 |
request:'enter a string:' |
|
2350 |
displayAt:200@200 |
|
2351 |
centered:true |
|
2352 |
action:[:result | result printNewline] |
|
2353 |
initialAnswer:'the default' |
|
2354 |
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
|
2355 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2356 |
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
|
2357 |
|
1401 | 2358 |
Dialog |
2359 |
request:'enter a string:' |
|
2360 |
displayAt:200@200 |
|
2361 |
centered:false |
|
2362 |
action:[:result | result printNewline] |
|
2363 |
initialAnswer:'the default' |
|
2364 |
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
|
2365 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2366 |
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
|
2367 |
|
1401 | 2368 |
Dialog |
2369 |
request:'enter a string:' |
|
2370 |
displayAt:nil |
|
2371 |
centered:false |
|
2372 |
action:[:result | result printNewline] |
|
2373 |
initialAnswer:'the default' |
|
2374 |
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
|
2375 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2376 |
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
|
2377 |
|
1401 | 2378 |
Dialog |
2379 |
request:'enter a string:' |
|
2380 |
displayAt:nil |
|
2381 |
centered:true |
|
2382 |
action:[:result | result printNewline] |
|
2383 |
initialAnswer:'the default' |
|
2384 |
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
|
2385 |
" |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2386 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2387 |
"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
|
2388 |
"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
|
2389 |
! |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2390 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2391 |
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
|
2392 |
"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
|
2393 |
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
|
2394 |
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
|
2395 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2396 |
^ self |
1401 | 2397 |
request:aString |
2398 |
displayAt:aPoint |
|
2399 |
centered:false |
|
2400 |
action:nil |
|
2401 |
initialAnswer:initial |
|
2402 |
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
|
2403 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2404 |
" |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2405 |
Dialog |
1401 | 2406 |
request:'enter a string:' |
2407 |
displayAt:(250 @ 250) |
|
2408 |
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
|
2409 |
" |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2410 |
|
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2411 |
"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
|
2412 |
! |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2413 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2414 |
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
|
2415 |
"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
|
2416 |
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
|
2417 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2418 |
^ self |
1401 | 2419 |
request:aString |
2420 |
displayAt:nil |
|
2421 |
centered:false |
|
2422 |
action:nil |
|
2423 |
initialAnswer:initial |
|
2424 |
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
|
2425 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2426 |
" |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2427 |
Dialog |
1401 | 2428 |
request:'enter a string:' |
2429 |
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
|
2430 |
" |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2431 |
|
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2432 |
"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
|
2433 |
! |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2434 |
|
718
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
2435 |
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
|
2436 |
"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
|
2437 |
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
|
2438 |
or cancelValue (if cancel was pressed)" |
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
2439 |
|
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
2440 |
^ self |
1401 | 2441 |
request:aString |
2442 |
displayAt:nil |
|
2443 |
centered:false |
|
2444 |
action:nil |
|
2445 |
initialAnswer:initial |
|
2446 |
okLabel:okLabel |
|
2447 |
cancelLabel:nil |
|
2448 |
title:titleString |
|
2449 |
onCancel:cancelAction |
|
718
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
2450 |
|
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
2451 |
" |
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
2452 |
Dialog |
1401 | 2453 |
request:'enter a string:' |
2454 |
initialAnswer:'the default' |
|
2455 |
onCancel:['foooo'] |
|
718
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
2456 |
" |
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
2457 |
|
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
2458 |
"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
|
2459 |
"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
|
2460 |
! |
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
2461 |
|
1705
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2462 |
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
|
2463 |
"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
|
2464 |
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
|
2465 |
or cancelValue (if cancel was pressed)" |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2466 |
|
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2467 |
^ self |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2468 |
request:aString |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2469 |
displayAt:nil |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2470 |
centered:false |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2471 |
action:nil |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2472 |
initialAnswer:initial |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2473 |
okLabel:okLabel |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2474 |
cancelLabel:nil |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2475 |
title:titleString |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2476 |
onCancel:cancelAction |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2477 |
list:listOfChoices |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2478 |
|
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2479 |
" |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2480 |
Dialog |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2481 |
request:'enter a string:' |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2482 |
initialAnswer:'the default' |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2483 |
okLabel:'ok' |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2484 |
title:'demo' |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2485 |
onCancel:nil |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2486 |
list:#('foo' 'bar' 'baz') |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2487 |
" |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2488 |
|
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2489 |
"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
|
2490 |
"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
|
2491 |
! |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2492 |
|
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
|
2493 |
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
|
2494 |
"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
|
2495 |
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
|
2496 |
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
|
2497 |
|
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2498 |
^ self |
1401 | 2499 |
request:aString |
2500 |
displayAt:nil |
|
2501 |
centered:false |
|
2502 |
action:nil |
|
2503 |
initialAnswer:initial |
|
2504 |
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
|
2505 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2506 |
" |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2507 |
Dialog |
1401 | 2508 |
request:'enter a string:' |
2509 |
initialAnswer:'the default' |
|
2510 |
onCancel:['foooo'] |
|
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2511 |
" |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2512 |
|
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2513 |
"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
|
2514 |
! |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2515 |
|
1705
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2516 |
request:aString list:listOfChoices |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2517 |
"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
|
2518 |
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
|
2519 |
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
|
2520 |
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
|
2521 |
|
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2522 |
^ self |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2523 |
request:aString |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2524 |
displayAt:nil |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2525 |
centered:false |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2526 |
action:nil |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2527 |
initialAnswer:'' |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2528 |
okLabel:nil |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2529 |
cancelLabel:nil |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2530 |
title:nil |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2531 |
onCancel:nil |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2532 |
list:listOfChoices |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2533 |
|
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2534 |
" |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2535 |
Dialog |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2536 |
request:'enter a string:' |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2537 |
list:#('foo' 'bar' 'baz') |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2538 |
" |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2539 |
|
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2540 |
"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
|
2541 |
! |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
2542 |
|
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2543 |
request:aString okLabel:okLabel |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2544 |
"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
|
2545 |
The okButton is labelled as okLabel. |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2546 |
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
|
2547 |
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
|
2548 |
|
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2549 |
^ self |
1401 | 2550 |
request:aString |
2551 |
displayAt:nil |
|
2552 |
centered:false |
|
2553 |
action:nil |
|
2554 |
initialAnswer:'' |
|
2555 |
okLabel:okLabel |
|
2556 |
cancelLabel:nil |
|
2557 |
onCancel:'' |
|
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2558 |
|
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2559 |
" |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2560 |
Dialog |
1401 | 2561 |
request:'enter a string:' |
2562 |
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
|
2563 |
" |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2564 |
|
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2565 |
"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
|
2566 |
"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
|
2567 |
! |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2568 |
|
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2569 |
request:aString okLabel:okLabel onCancel:cancelValue |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2570 |
"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
|
2571 |
The okButton is labelled as okLabel. |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2572 |
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
|
2573 |
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
|
2574 |
|
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2575 |
^ self |
1401 | 2576 |
request:aString |
2577 |
displayAt:nil |
|
2578 |
centered:false |
|
2579 |
action:nil |
|
2580 |
initialAnswer:'' |
|
2581 |
okLabel:okLabel |
|
2582 |
cancelLabel:nil |
|
2583 |
onCancel:cancelValue |
|
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2584 |
|
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2585 |
" |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2586 |
Dialog |
1401 | 2587 |
request:'enter a string:' |
2588 |
okLabel:'yes' |
|
2589 |
onCancel:nil |
|
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2590 |
" |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2591 |
|
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2592 |
"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
|
2593 |
! |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2594 |
|
718
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
2595 |
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
|
2596 |
"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
|
2597 |
The okButton is labelled as okLabel. |
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
2598 |
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
|
2599 |
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
|
2600 |
|
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
2601 |
^ self |
1401 | 2602 |
request:aString |
2603 |
displayAt:nil |
|
2604 |
centered:false |
|
2605 |
action:nil |
|
2606 |
initialAnswer:'' |
|
2607 |
okLabel:okLabel |
|
2608 |
cancelLabel:nil |
|
2609 |
title:titleString |
|
2610 |
onCancel:cancelValue |
|
718
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
2611 |
|
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
2612 |
" |
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
2613 |
Dialog |
1401 | 2614 |
request:'enter a string:' |
2615 |
okLabel:'yes' |
|
2616 |
title:'foo' |
|
2617 |
onCancel:nil |
|
718
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
2618 |
" |
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
2619 |
|
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
2620 |
"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
|
2621 |
"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
|
2622 |
! |
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
2623 |
|
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
|
2624 |
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
|
2625 |
"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
|
2626 |
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
|
2627 |
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
|
2628 |
|
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2629 |
^ self |
1401 | 2630 |
request:aString |
2631 |
displayAt:nil |
|
2632 |
centered:false |
|
2633 |
action:nil |
|
2634 |
initialAnswer:'' |
|
2635 |
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
|
2636 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2637 |
" |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2638 |
Dialog |
1401 | 2639 |
request:'enter a string:' |
2640 |
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
|
2641 |
" |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2642 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2643 |
"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
|
2644 |
"Modified: 29.5.1996 / 14:28:59 / cg" |
100 | 2645 |
! |
2646 |
||
197 | 2647 |
requestPassword:aString |
2648 |
"launch a Dialog, which allows user to enter something invisibly. |
|
2649 |
Return the entered string (may be empty string) |
|
2650 |
or nil (if cancel was pressed)" |
|
100 | 2651 |
|
197 | 2652 |
^ EnterBox requestPassword:aString |
133 | 2653 |
|
2654 |
" |
|
2655 |
Dialog |
|
197 | 2656 |
requestPassword:'enter secret:' |
133 | 2657 |
" |
197 | 2658 |
|
2659 |
"Created: 17.11.1995 / 09:45:21 / 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
|
2660 |
! ! |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2661 |
|
846
75c5dc601522
added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents:
831
diff
changeset
|
2662 |
!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
|
2663 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2664 |
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
|
2665 |
"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
|
2666 |
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
|
2667 |
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
|
2668 |
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
|
2669 |
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
|
2670 |
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
|
2671 |
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
|
2672 |
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
|
2673 |
|
1284 | 2674 |
|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
|
2675 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2676 |
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
|
2677 |
(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
|
2678 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2679 |
list notNil ifTrue:[ |
1401 | 2680 |
maxLines > list size ifTrue:[ |
2681 |
listView := ScrollableView for:SelectionInListView. |
|
2682 |
] ifFalse:[ |
|
2683 |
listView := SelectionInListView new. |
|
2684 |
listView level:-1. |
|
2685 |
]. |
|
2686 |
listView list:list. |
|
2687 |
listView doubleClickAction:[:line | box hide. ^ listValues at:line]. |
|
2688 |
box addComponent:listView indent:(ViewSpacing // 2) withHeight:(listView heightForLines:maxLines). |
|
2689 |
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
|
2690 |
]. |
d3fe810390cb
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 |
|
d3fe810390cb
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 |
buttonLabels notNil ifTrue:[ |
1401 | 2693 |
panel := HorizontalPanelView new. |
2694 |
panel horizontalLayout:#fitSpace. |
|
2695 |
buttonLabels keysAndValuesDo:[:index :label | |
|
2696 |
|b| |
|
2697 |
||
2698 |
b := Button label:label. |
|
2699 |
b action:[box hide. ^ buttonValues at:index]. |
|
2700 |
panel add:b. |
|
2701 |
box makeTabable:b. |
|
2702 |
]. |
|
2703 |
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
|
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 |
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
|
2706 |
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
|
2707 |
|
4bbc8deffc8c
allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents:
307
diff
changeset
|
2708 |
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
|
2709 |
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
|
2710 |
|
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
|
2711 |
box showAtPointer. |
719
574be1981be0
destroy boxes from standard dialogs
Claus Gittinger <cg@exept.de>
parents:
718
diff
changeset
|
2712 |
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
|
2713 |
box accepted ifTrue:[ |
1401 | 2714 |
(answer := listView selection) notNil ifTrue:[ |
2715 |
^ listValues at:answer |
|
2716 |
] |
|
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
|
2717 |
]. |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2718 |
^ cancelBlock value |
197 | 2719 |
|
2720 |
" |
|
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
|
2721 |
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
|
2722 |
|
1401 | 2723 |
Transcript showCR:( |
2724 |
Dialog |
|
2725 |
choose:'choose any' |
|
2726 |
fromList:#('one' 'two' 'three' 'four') |
|
2727 |
values:#(1 2 3 4) |
|
2728 |
buttons:#('five' 'six' 'seven') |
|
2729 |
values:#(5 6 7) |
|
2730 |
lines:10 |
|
2731 |
cancel:nil |
|
2732 |
) |
|
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
|
2733 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2734 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2735 |
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
|
2736 |
|
1401 | 2737 |
Transcript showCR:( |
2738 |
Dialog |
|
2739 |
choose:'choose any' |
|
2740 |
fromList:#('one' 'two' 'three' 'four') |
|
2741 |
values:#(1 2 3 4) |
|
2742 |
buttons:nil |
|
2743 |
values:nil |
|
2744 |
lines:4 |
|
2745 |
cancel:nil |
|
2746 |
) |
|
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
|
2747 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2748 |
|
558 | 2749 |
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
|
2750 |
|
1401 | 2751 |
Transcript showCR:( |
2752 |
Dialog |
|
2753 |
choose:'choose any' |
|
2754 |
fromList:nil |
|
2755 |
values:nil |
|
2756 |
buttons:#('one' 'two' 'three' 'four') |
|
2757 |
values:#(1 2 3 4) |
|
2758 |
lines:nil |
|
2759 |
cancel:nil |
|
2760 |
) |
|
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 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2763 |
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
|
2764 |
|
1401 | 2765 |
Transcript showCR:( |
2766 |
Dialog |
|
2767 |
choose:'choose example' |
|
2768 |
fromList:#('one' 'two' 'three' 'four') |
|
2769 |
values:#(1 2 3 4) |
|
2770 |
buttons:#('five' 'six' 'seven') |
|
2771 |
values:#(5 6 7) |
|
2772 |
lines:4 |
|
2773 |
cancel:[Transcript flash. #aborted] |
|
2774 |
) |
|
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
|
2775 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2776 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2777 |
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
|
2778 |
|
1401 | 2779 |
Transcript showCR:( |
2780 |
Dialog |
|
2781 |
choose:'choose any' |
|
2782 |
fromList:nil |
|
2783 |
values:nil |
|
2784 |
buttons:nil |
|
2785 |
values:nil |
|
2786 |
lines:nil |
|
2787 |
cancel:nil |
|
2788 |
) |
|
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
|
2789 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2790 |
|
133 | 2791 |
" |
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
|
2792 |
|
719
574be1981be0
destroy boxes from standard dialogs
Claus Gittinger <cg@exept.de>
parents:
718
diff
changeset
|
2793 |
"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
|
2794 |
! |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2795 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2796 |
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
|
2797 |
"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
|
2798 |
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
|
2799 |
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
|
2800 |
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
|
2801 |
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
|
2802 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2803 |
^ self |
314
705185e7001d
no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents:
312
diff
changeset
|
2804 |
choose:aString |
705185e7001d
no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents:
312
diff
changeset
|
2805 |
fromList:list |
705185e7001d
no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents:
312
diff
changeset
|
2806 |
values:listValues |
705185e7001d
no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents:
312
diff
changeset
|
2807 |
buttons:nil |
705185e7001d
no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents:
312
diff
changeset
|
2808 |
values:nil |
705185e7001d
no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents:
312
diff
changeset
|
2809 |
lines:maxLines |
705185e7001d
no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents:
312
diff
changeset
|
2810 |
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
|
2811 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2812 |
" |
655 | 2813 |
Transcript showCR:( |
314
705185e7001d
no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents:
312
diff
changeset
|
2814 |
Dialog |
705185e7001d
no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents:
312
diff
changeset
|
2815 |
choose:'choose any' |
705185e7001d
no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents:
312
diff
changeset
|
2816 |
fromList:#('one' 'two' 'three' 'four') |
705185e7001d
no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents:
312
diff
changeset
|
2817 |
values:#(1 2 3 4) |
705185e7001d
no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents:
312
diff
changeset
|
2818 |
lines:4 |
705185e7001d
no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents:
312
diff
changeset
|
2819 |
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
|
2820 |
) |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2821 |
|
655 | 2822 |
Transcript showCR:( |
314
705185e7001d
no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents:
312
diff
changeset
|
2823 |
Dialog |
705185e7001d
no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents:
312
diff
changeset
|
2824 |
choose:'choose example' |
705185e7001d
no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents:
312
diff
changeset
|
2825 |
fromList:#('one' 'two' 'three' 'four') |
705185e7001d
no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents:
312
diff
changeset
|
2826 |
values:#(1 2 3 4) |
705185e7001d
no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents:
312
diff
changeset
|
2827 |
lines:4 |
705185e7001d
no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents:
312
diff
changeset
|
2828 |
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
|
2829 |
) |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2830 |
" |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2831 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2832 |
"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
|
2833 |
! |
d3fe810390cb
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 |
|
803 | 2835 |
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
|
2836 |
"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
|
2837 |
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
|
2838 |
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
|
2839 |
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
|
2840 |
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
|
2841 |
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
|
2842 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2843 |
|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
|
2844 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2845 |
box := OptionBox title:aString numberOfOptions:buttonLabels size. |
803 | 2846 |
windowLabel notNil ifTrue:[ |
1401 | 2847 |
box label:windowLabel |
803 | 2848 |
]. |
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
|
2849 |
box buttonTitles:(self classResources array:buttonLabels) |
1401 | 2850 |
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
|
2851 |
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
|
2852 |
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
|
2853 |
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
|
2854 |
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
|
2855 |
box showAtPointer. |
719
574be1981be0
destroy boxes from standard dialogs
Claus Gittinger <cg@exept.de>
parents:
718
diff
changeset
|
2856 |
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
|
2857 |
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
|
2858 |
^ 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
|
2859 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2860 |
"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
|
2861 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2862 |
Dialog |
1401 | 2863 |
choose:'choose any' |
2864 |
labels:#('one' 'two' 'three' 'four') |
|
2865 |
values:#(1 2 3 4) |
|
2866 |
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
|
2867 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2868 |
Dialog |
1401 | 2869 |
choose:'choose any' |
2870 |
labels:#('cancel' 'foo' 'bar' 'baz') |
|
2871 |
values:#(nil foo bar baz) |
|
2872 |
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
|
2873 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2874 |
Dialog |
1401 | 2875 |
choose:'choose any' |
2876 |
labels:#('one' 'two' 'three' 'four') |
|
2877 |
values:#(1 2 3 4) |
|
2878 |
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
|
2879 |
" |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2880 |
|
719
574be1981be0
destroy boxes from standard dialogs
Claus Gittinger <cg@exept.de>
parents:
718
diff
changeset
|
2881 |
"Modified: 29.5.1996 / 15:27:32 / cg" |
803 | 2882 |
"Created: 22.7.1996 / 11:44:27 / cg" |
2883 |
! |
|
2884 |
||
2885 |
choose:aString labels:buttonLabels values:values default:default |
|
2886 |
"launch a Dialog, which allows user to enter any of buttonLabels. |
|
2887 |
Returning a corresponding value from the values-array. |
|
2888 |
The default entries button is marked as a return button and entering |
|
2889 |
return will choose that value. |
|
2890 |
For a good userInterface style, we recommend this being the last |
|
2891 |
entry (to make the right-most button the default button)." |
|
2892 |
||
2893 |
^ self |
|
1401 | 2894 |
choose:aString |
2895 |
label:nil |
|
2896 |
labels:buttonLabels |
|
2897 |
values:values |
|
2898 |
default:default |
|
803 | 2899 |
|
2900 |
||
2901 |
"no good style (default button is not the rightmost one) |
|
2902 |
||
2903 |
Dialog |
|
1401 | 2904 |
choose:'choose any' |
2905 |
labels:#('one' 'two' 'three' 'four') |
|
2906 |
values:#(1 2 3 4) |
|
2907 |
default:2 |
|
803 | 2908 |
|
2909 |
Dialog |
|
1401 | 2910 |
choose:'choose any' |
2911 |
labels:#('cancel' 'foo' 'bar' 'baz') |
|
2912 |
values:#(nil foo bar baz) |
|
2913 |
default:#baz |
|
803 | 2914 |
|
2915 |
Dialog |
|
1401 | 2916 |
choose:'choose any' |
2917 |
labels:#('one' 'two' 'three' 'four') |
|
2918 |
values:#(1 2 3 4) |
|
2919 |
default:nil |
|
803 | 2920 |
" |
2921 |
||
2922 |
"Modified: 22.7.1996 / 11:46:09 / cg" |
|
100 | 2923 |
! ! |
2924 |
||
1573
63a7b74f45be
added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
1488
diff
changeset
|
2925 |
!DialogBox class methodsFor:'queries'! |
63a7b74f45be
added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
1488
diff
changeset
|
2926 |
|
63a7b74f45be
added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
1488
diff
changeset
|
2927 |
defaultParentWindow |
63a7b74f45be
added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
1488
diff
changeset
|
2928 |
"return a default parent (top-) window for the dialog. |
63a7b74f45be
added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
1488
diff
changeset
|
2929 |
Here, the currently active view is returned, if there |
63a7b74f45be
added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
1488
diff
changeset
|
2930 |
is one; otherwise, the first encountered topView is |
63a7b74f45be
added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
1488
diff
changeset
|
2931 |
returned." |
63a7b74f45be
added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
1488
diff
changeset
|
2932 |
|
63a7b74f45be
added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
1488
diff
changeset
|
2933 |
|activeGroup| |
63a7b74f45be
added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
1488
diff
changeset
|
2934 |
|
63a7b74f45be
added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
1488
diff
changeset
|
2935 |
activeGroup := WindowGroup activeGroup. |
63a7b74f45be
added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
1488
diff
changeset
|
2936 |
activeGroup isNil ifTrue:[ |
63a7b74f45be
added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
1488
diff
changeset
|
2937 |
"/ mhmh - looks like I am a background process ... |
63a7b74f45be
added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
1488
diff
changeset
|
2938 |
activeGroup := Transcript windowGroup. |
63a7b74f45be
added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
1488
diff
changeset
|
2939 |
activeGroup isNil ifTrue:[^ nil]. |
63a7b74f45be
added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
1488
diff
changeset
|
2940 |
]. |
63a7b74f45be
added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
1488
diff
changeset
|
2941 |
^ activeGroup topViews first. |
63a7b74f45be
added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
1488
diff
changeset
|
2942 |
|
63a7b74f45be
added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
1488
diff
changeset
|
2943 |
" |
63a7b74f45be
added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
1488
diff
changeset
|
2944 |
self defaultParentWindow |
63a7b74f45be
added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
1488
diff
changeset
|
2945 |
" |
63a7b74f45be
added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
1488
diff
changeset
|
2946 |
|
63a7b74f45be
added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
1488
diff
changeset
|
2947 |
"Modified: / 16.6.1998 / 12:36:15 / cg" |
63a7b74f45be
added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
1488
diff
changeset
|
2948 |
! ! |
63a7b74f45be
added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
1488
diff
changeset
|
2949 |
|
197 | 2950 |
!DialogBox methodsFor:'accessing-behavior'! |
2951 |
||
2952 |
abortAction:aBlock |
|
2953 |
"define the action to be performed when abort is pressed" |
|
2954 |
||
2955 |
abortAction := aBlock |
|
125 | 2956 |
! |
2957 |
||
280
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
2958 |
acceptCheck:aBlock |
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
2959 |
"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
|
2960 |
accepted (ok-button or Return-key). If it returns true, the box is closed, |
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
2961 |
otherwise not." |
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
2962 |
|
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
2963 |
acceptCheck := aBlock |
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
2964 |
! |
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
2965 |
|
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
2966 |
acceptOnLeave:aBoolean |
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
2967 |
"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
|
2968 |
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
|
2969 |
|
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
2970 |
acceptOnLeave := aBoolean. |
551
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
2971 |
|
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
2972 |
"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
|
2973 |
! |
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
2974 |
|
197 | 2975 |
acceptReturnAsOK:aBoolean |
2976 |
"turn on/off interpretation of return-key as ok. |
|
2977 |
Default is on" |
|
2978 |
||
2979 |
acceptReturnAsOK := aBoolean. |
|
2980 |
okButton notNil ifTrue:[ |
|
2981 |
okButton isReturnButton:aBoolean. |
|
2982 |
] |
|
2983 |
! |
|
2984 |
||
2985 |
action:aBlock |
|
2986 |
"set the action to be performed when user presses ok-button; |
|
2987 |
aBlock must be nil or a block. This method simply |
|
2988 |
reuses okAction: and has been added for a consistent action-setting |
|
2989 |
protocol." |
|
76 | 2990 |
|
197 | 2991 |
self okAction:aBlock |
2992 |
! |
|
2993 |
||
280
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
2994 |
focusOnField:anInputField |
1646 | 2995 |
"arrange for the argument to get the focus (initially)" |
2996 |
||
280
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
2997 |
inputFieldGroup makeActive:anInputField |
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
2998 |
|
1646 | 2999 |
"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
|
3000 |
! |
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
3001 |
|
551
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
3002 |
focusToOKOnLeave:aBoolean |
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
3003 |
"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
|
3004 |
or cursor key. |
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
3005 |
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
|
3006 |
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
|
3007 |
the dialog is accepted & closed." |
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
3008 |
|
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
3009 |
focusToOKOnLeave := aBoolean. |
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
3010 |
|
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
3011 |
"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
|
3012 |
"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
|
3013 |
! |
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
3014 |
|
280
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
3015 |
hideOnAccept:aBoolean |
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
3016 |
"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
|
3017 |
The default is true" |
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
3018 |
|
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
3019 |
hideOnAccept := aBoolean |
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
3020 |
! |
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
3021 |
|
593 | 3022 |
makeTabable:aComponentOrSubcomponent |
3023 |
"add a component (usually a subcomponent, of which the dialog |
|
3024 |
does not know) to the list of tabable ones (i.e. those, that can be |
|
3025 |
stepped through via FocusNext/FocusPrevious). |
|
3026 |
Toplevel tabable components are usually added with #addComponent:tabable:" |
|
3027 |
||
3028 |
tabableElements isNil ifTrue:[ |
|
1401 | 3029 |
tabableElements := OrderedCollection new |
593 | 3030 |
]. |
739
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
3031 |
(tabableElements includesIdentical:aComponentOrSubcomponent) ifFalse:[ |
1401 | 3032 |
tabableElements add:aComponentOrSubcomponent. |
3033 |
||
3034 |
(aComponentOrSubcomponent isInputField) ifTrue:[ |
|
3035 |
self addToInputFieldGroup:aComponentOrSubcomponent |
|
3036 |
]. |
|
593 | 3037 |
]. |
3038 |
||
739
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
3039 |
"Modified: 31.5.1996 / 21:22:13 / cg" |
593 | 3040 |
! |
3041 |
||
1843 | 3042 |
makeTabable:aComponentOrSubcomponent after:anotherComponent |
3043 |
"add a component (usually a subcomponent, of which the dialog |
|
3044 |
does not know) to the list of tabable ones (i.e. those, that can be |
|
3045 |
stepped through via FocusNext/FocusPrevious). |
|
3046 |
Toplevel tabable components are usually added with #addComponent:tabable:" |
|
3047 |
||
3048 |
tabableElements isNil ifTrue:[ |
|
3049 |
tabableElements := OrderedCollection new |
|
3050 |
]. |
|
3051 |
tabableElements removeIdentical:aComponentOrSubcomponent ifAbsent:nil. |
|
3052 |
||
3053 |
anotherComponent isNil ifTrue:[ |
|
3054 |
tabableElements addLast:aComponentOrSubcomponent |
|
3055 |
] ifFalse:[ |
|
3056 |
tabableElements add:aComponentOrSubcomponent after:anotherComponent. |
|
3057 |
]. |
|
3058 |
||
3059 |
(aComponentOrSubcomponent isInputField) ifTrue:[ |
|
3060 |
self addToInputFieldGroup:aComponentOrSubcomponent after:anotherComponent |
|
3061 |
]. |
|
3062 |
||
3063 |
"Modified: 18.10.1997 / 03:08:20 / cg" |
|
3064 |
! |
|
3065 |
||
593 | 3066 |
makeTabable:aComponentOrSubcomponent before:anotherComponent |
3067 |
"add a component (usually a subcomponent, of which the dialog |
|
3068 |
does not know) to the list of tabable ones (i.e. those, that can be |
|
3069 |
stepped through via FocusNext/FocusPrevious). |
|
3070 |
Toplevel tabable components are usually added with #addComponent:tabable:" |
|
3071 |
||
3072 |
tabableElements isNil ifTrue:[ |
|
1843 | 3073 |
tabableElements := OrderedCollection new |
593 | 3074 |
]. |
989
ca2cdf005359
use #removeIdentical: - its faster.
Claus Gittinger <cg@exept.de>
parents:
953
diff
changeset
|
3075 |
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
|
3076 |
|
593 | 3077 |
anotherComponent isNil ifTrue:[ |
1843 | 3078 |
tabableElements addFirst:aComponentOrSubcomponent |
593 | 3079 |
] ifFalse:[ |
1843 | 3080 |
tabableElements add:aComponentOrSubcomponent before:anotherComponent. |
593 | 3081 |
]. |
3082 |
||
3083 |
(aComponentOrSubcomponent isInputField) ifTrue:[ |
|
1843 | 3084 |
self addToInputFieldGroup:aComponentOrSubcomponent before:anotherComponent |
593 | 3085 |
]. |
3086 |
||
1355 | 3087 |
"Modified: 18.10.1997 / 03:08:20 / cg" |
3088 |
! |
|
3089 |
||
3090 |
makeUntabable:aComponentOrSubcomponent |
|
3091 |
(tabableElements includesIdentical:aComponentOrSubcomponent) ifFalse:[ |
|
1401 | 3092 |
tabableElements removeIdentical:aComponentOrSubcomponent. |
3093 |
||
3094 |
(aComponentOrSubcomponent isInputField) ifTrue:[ |
|
3095 |
self removeFromInputFieldGroup:aComponentOrSubcomponent |
|
3096 |
]. |
|
1355 | 3097 |
]. |
3098 |
||
3099 |
"Modified: 18.10.1997 / 02:50:05 / cg" |
|
593 | 3100 |
! |
3101 |
||
197 | 3102 |
okAction:aBlock |
3103 |
"define the action to be performed when ok is pressed" |
|
133 | 3104 |
|
197 | 3105 |
okAction := aBlock |
3106 |
! ! |
|
3107 |
||
3108 |
!DialogBox methodsFor:'accessing-components'! |
|
3109 |
||
3110 |
abortButton |
|
3111 |
"return the abortButton - this access is provided to allow |
|
3112 |
setting the buttons look (for example: colors or font)" |
|
3113 |
||
3114 |
^ abortButton |
|
76 | 3115 |
! |
3116 |
||
197 | 3117 |
okButton |
3118 |
"return the okButton - this access is provided to allow |
|
3119 |
setting the buttons look (for example: colors or font)" |
|
76 | 3120 |
|
197 | 3121 |
^ okButton |
3122 |
! ! |
|
155 | 3123 |
|
197 | 3124 |
!DialogBox methodsFor:'accessing-elements'! |
3125 |
||
3126 |
componentAt:name |
|
680 | 3127 |
"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
|
3128 |
named previously with #name:as:" |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3129 |
|
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3130 |
namedComponents isNil ifTrue:[^ nil]. |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3131 |
^ namedComponents at:name ifAbsent:nil |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3132 |
|
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3133 |
"Modified: 16.1.1997 / 11:40:50 / cg" |
76 | 3134 |
! |
3135 |
||
280
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
3136 |
inputFieldGroup |
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
3137 |
^ inputFieldGroup |
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
3138 |
! |
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
3139 |
|
197 | 3140 |
name:element as:name |
680 | 3141 |
"assign a name to a component. This can be done during construction, |
3142 |
to allow later access to the components (i.e. without a need to |
|
3143 |
remember them in some instVars)" |
|
3144 |
||
950
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3145 |
namedComponents isNil ifTrue:[ |
1401 | 3146 |
namedComponents := Dictionary new. |
197 | 3147 |
]. |
950
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3148 |
namedComponents at:name put:element |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3149 |
|
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3150 |
"Modified: 16.1.1997 / 11:41:03 / cg" |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3151 |
! ! |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3152 |
|
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3153 |
!DialogBox methodsFor:'accessing-look'! |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3154 |
|
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3155 |
abortText:aString |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3156 |
"define the label in the abort-button" |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3157 |
|
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3158 |
|oldSize| |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3159 |
|
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3160 |
aString ~= abortButton label ifTrue:[ |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3161 |
oldSize := abortButton extent. |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3162 |
abortButton label:aString. |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3163 |
abortButton resize. |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3164 |
abortButton extent ~= oldSize ifTrue:[ |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3165 |
shown ifTrue:[self resize] |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3166 |
] |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3167 |
] |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3168 |
! |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3169 |
|
1702 | 3170 |
hideButtons |
3171 |
"hides the buttonPanel (i.e. the ok and cancel buttons if any)" |
|
3172 |
||
3173 |
buttonPanel notNil ifTrue:[buttonPanel beInvisible] |
|
3174 |
! |
|
3175 |
||
950
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3176 |
okText:aString |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3177 |
"define the text in the ok-button" |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3178 |
|
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3179 |
|oldSize| |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3180 |
|
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3181 |
aString ~= okButton label ifTrue:[ |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3182 |
oldSize := okButton extent. |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3183 |
okButton label:aString. |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3184 |
okButton resize. |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3185 |
okButton extent ~= oldSize ifTrue:[ |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3186 |
shown ifTrue:[self resize] |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3187 |
] |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3188 |
] |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3189 |
! |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3190 |
|
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3191 |
okText:okString abortText:abortString |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3192 |
"set both texts displayed in the buttons" |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3193 |
|
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3194 |
(abortString ~= abortButton label |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3195 |
or:[okString ~= okButton label]) ifTrue:[ |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3196 |
okButton label:okString. |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3197 |
abortButton label:abortString. |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3198 |
okButton resize. |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3199 |
abortButton resize. |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3200 |
shown ifTrue:[self resize] |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3201 |
] |
197 | 3202 |
! ! |
3203 |
||
3204 |
!DialogBox methodsFor:'accessing-models'! |
|
76 | 3205 |
|
197 | 3206 |
accept |
3207 |
"return the valueHolder holding true when the box |
|
3208 |
is accepted, false if closed via the windowManager or |
|
3209 |
the cancel button. |
|
3210 |
This is confusing: this method was originally called #acceptValue, |
|
3211 |
but renamed for compatibility with ST-80. |
|
3212 |
This looks like a bad name to me, since in most other situations, #accept |
|
3213 |
is used to force an accept, not to return some valueHolder ...)." |
|
3214 |
||
3215 |
^ acceptValue |
|
280
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
3216 |
! |
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
3217 |
|
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
3218 |
acceptChannel:aValueHolder |
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
3219 |
"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
|
3220 |
is accepted" |
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
3221 |
|
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
3222 |
acceptValue := aValueHolder |
950
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3223 |
! |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3224 |
|
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3225 |
aspectAt:anAspectSymbol put:aDataModel |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3226 |
"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
|
3227 |
requires that a corresponding dataModel has been set (usually during |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3228 |
initialization) via the #aspectAt:put: message. |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3229 |
Allows users of boxes to access individual values - especially useful, |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3230 |
in multi-field dialogs." |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3231 |
|
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3232 |
bindings isNil ifTrue:[bindings := IdentityDictionary new]. |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3233 |
bindings at:anAspectSymbol put:aDataModel |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3234 |
|
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3235 |
"Created: 16.1.1997 / 11:38:46 / cg" |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3236 |
"Modified: 16.1.1997 / 11:41:28 / cg" |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3237 |
! |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3238 |
|
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3239 |
aspectFor:anAspectSymbol |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3240 |
"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
|
3241 |
requires that a corresponding dataModel has been set (usually during |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3242 |
initialization) via the #aspectAt:put: message. |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3243 |
Allows users of boxes to access individual values - especially useful, |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3244 |
in multi-field dialogs." |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3245 |
|
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3246 |
bindings isNil ifTrue:[^ nil]. |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3247 |
^ bindings at:anAspectSymbol ifAbsent:nil |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3248 |
|
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3249 |
"Modified: 16.1.1997 / 11:41:34 / cg" |
76 | 3250 |
! ! |
3251 |
||
120 | 3252 |
!DialogBox methodsFor:'construction-adding'! |
3253 |
||
593 | 3254 |
addComponent:aComponent |
3255 |
"add any component with its preferred height and full width. |
|
3256 |
Returns the component." |
|
3257 |
||
3258 |
^ self addComponent:aComponent indent:nil tabable:false |
|
3259 |
||
3260 |
"Modified: 9.2.1996 / 22:22:41 / cg" |
|
3261 |
! |
|
3262 |
||
3263 |
addComponent:aComponent indent:indent |
|
3264 |
"add any component with its preferred height and full width. |
|
3265 |
The indent is temporarily changed to indent. |
|
3266 |
Returns the component." |
|
3267 |
||
3268 |
^ self addComponent:aComponent indent:indent tabable:false |
|
3269 |
||
3270 |
"Modified: 9.2.1996 / 22:22:44 / cg" |
|
3271 |
! |
|
3272 |
||
3273 |
addComponent:aComponent indent:indent tabable:tabable |
|
3274 |
"add any component with its preferred height and full width. |
|
3275 |
The indent is temporarily changed to indent. |
|
3276 |
Returns the component." |
|
3277 |
||
3278 |
|oldLeft oldRight result| |
|
3279 |
||
3280 |
oldLeft := leftIndent. |
|
3281 |
oldRight := rightIndent. |
|
3282 |
indent notNil ifTrue:[ |
|
1401 | 3283 |
leftIndent := rightIndent := indent. |
593 | 3284 |
]. |
3285 |
result := self addComponent:aComponent tabable:tabable tabbedComponent:aComponent. |
|
3286 |
leftIndent := oldLeft. |
|
3287 |
rightIndent := oldRight. |
|
3288 |
^ result |
|
3289 |
||
3290 |
"Modified: 9.2.1996 / 22:22:50 / cg" |
|
3291 |
! |
|
3292 |
||
3293 |
addComponent:aComponent indent:indent withExtent:ext |
|
3294 |
"add any component with some given extent. |
|
3295 |
Returns the component." |
|
3296 |
||
3297 |
|fullSize lI rI| |
|
3298 |
||
3299 |
indent isNil ifTrue:[ |
|
1401 | 3300 |
lI := leftIndent. |
3301 |
rI := rightIndent. |
|
593 | 3302 |
] ifFalse:[ |
1401 | 3303 |
lI := rI := indent |
593 | 3304 |
]. |
3305 |
||
3306 |
self basicAddComponent:aComponent. |
|
3307 |
fullSize := ext + (lI + rI @ 0). |
|
3308 |
aComponent extent:fullSize. |
|
3309 |
aComponent origin:0.0@yPosition; |
|
1401 | 3310 |
leftInset:lI; |
3311 |
rightInset:rI. |
|
593 | 3312 |
yPosition := yPosition + aComponent height + ViewSpacing. |
3313 |
width := fullSize x max:width. |
|
3314 |
needResize := true. |
|
3315 |
^ aComponent |
|
3316 |
||
3317 |
"Modified: 9.2.1996 / 22:22:54 / cg" |
|
3318 |
! |
|
3319 |
||
3320 |
addComponent:aComponent indent:indent withHeight:height |
|
3321 |
"add any component with some given height and full width. |
|
3322 |
Returns the component." |
|
3323 |
||
3324 |
|lI rI| |
|
3325 |
||
3326 |
indent isNil ifTrue:[ |
|
1401 | 3327 |
lI := leftIndent. |
3328 |
rI := rightIndent. |
|
593 | 3329 |
] ifFalse:[ |
1401 | 3330 |
lI := rI := indent |
593 | 3331 |
]. |
3332 |
self basicAddComponent:aComponent. |
|
3333 |
aComponent height:height. |
|
3334 |
aComponent origin:0.0@yPosition; |
|
1401 | 3335 |
width:1.0; |
3336 |
leftInset:lI; |
|
3337 |
rightInset:rI. |
|
593 | 3338 |
yPosition := yPosition + "aComponent" height + ViewSpacing. |
3339 |
needResize := true. |
|
3340 |
^ aComponent |
|
3341 |
||
3342 |
"Modified: 9.2.1996 / 22:22:58 / cg" |
|
3343 |
! |
|
3344 |
||
3345 |
addComponent:aComponent tabable:tabable |
|
3346 |
"add any component with its preferred height and full width. |
|
3347 |
Returns the component." |
|
3348 |
||
3349 |
^ self addComponent:aComponent tabable:tabable tabbedComponent:aComponent |
|
3350 |
||
3351 |
"Modified: 9.2.1996 / 22:23:04 / cg" |
|
3352 |
! |
|
3353 |
||
3354 |
addComponent:aComponent tabable:tabable tabbedComponent:subComponent |
|
3355 |
"add any component with its preferred height and full width. |
|
3356 |
Returns the component." |
|
3357 |
||
3358 |
tabable ifTrue:[ |
|
1401 | 3359 |
tabableElements isNil ifTrue:[ |
3360 |
tabableElements := OrderedCollection new |
|
3361 |
]. |
|
3362 |
tabableElements add:subComponent |
|
593 | 3363 |
]. |
3364 |
^ self addComponent:aComponent |
|
1401 | 3365 |
withHeight:(aComponent preferredExtent y). |
593 | 3366 |
|
3367 |
"Modified: 9.2.1996 / 22:23:07 / cg" |
|
3368 |
! |
|
3369 |
||
3370 |
addComponent:aComponent withExtent:ext |
|
3371 |
"add any component with some given extent. |
|
3372 |
Returns the component." |
|
3373 |
||
3374 |
^ self addComponent:aComponent indent:nil withExtent:ext |
|
3375 |
||
3376 |
"Modified: 9.2.1996 / 22:23:11 / cg" |
|
3377 |
! |
|
3378 |
||
3379 |
addComponent:aComponent withHeight:height |
|
3380 |
"add any component with some given height and full width. |
|
3381 |
Returns the component." |
|
3382 |
||
3383 |
^ self addComponent:aComponent indent:nil withHeight:height |
|
3384 |
||
3385 |
"Modified: 9.2.1996 / 22:23:15 / cg" |
|
3386 |
! |
|
3387 |
||
745
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3388 |
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
|
3389 |
"add a label and some view side-by-side. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3390 |
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
|
3391 |
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
|
3392 |
The inputField gets model as its model. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3393 |
Return the inputField." |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3394 |
|
795 | 3395 |
^ self |
1401 | 3396 |
addLabelledField:aView |
3397 |
label:labelString |
|
3398 |
adjust:labelAdjust |
|
3399 |
tabable:tabable |
|
3400 |
from:leftX to:rightX separateAtX:relativeX |
|
3401 |
nameAs:nil |
|
745
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3402 |
|
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3403 |
" |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3404 |
|dialog model field| |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3405 |
|
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3406 |
model := '' asValue. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3407 |
|
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3408 |
dialog := DialogBox new. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3409 |
|
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3410 |
field := dialog |
1401 | 3411 |
addLabelledField:(EditField on:model) label:'input here:' |
3412 |
adjust:#left |
|
3413 |
tabable:true |
|
3414 |
separateAtX:0.3. |
|
745
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3415 |
|
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3416 |
dialog addAbortButton; addOkButton. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3417 |
dialog open. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3418 |
dialog accepted ifTrue:[Transcript showCR:model value]. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3419 |
" |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3420 |
|
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3421 |
" |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3422 |
|dialog model field| |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3423 |
|
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3424 |
model := SelectionInList new. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3425 |
model list:#('foo' 'bar' 'baz'). |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3426 |
model selectionIndex:2. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3427 |
|
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3428 |
dialog := DialogBox new. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3429 |
|
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3430 |
field := dialog |
1401 | 3431 |
addLabelledField:(PopUpList on:model) label:'select here:' |
3432 |
adjust:#left |
|
3433 |
tabable:true |
|
3434 |
separateAtX:0.3. |
|
745
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3435 |
|
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3436 |
dialog addAbortButton; addOkButton. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3437 |
dialog open. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3438 |
dialog accepted ifTrue:[Transcript showCR:model value]. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3439 |
" |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3440 |
|
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3441 |
"Created: 3.6.1996 / 11:03:24 / cg" |
795 | 3442 |
"Modified: 17.7.1996 / 15:04:07 / cg" |
3443 |
! |
|
3444 |
||
3445 |
addLabelledField:aView label:labelString adjust:labelAdjust tabable:tabable from:leftX to:rightX separateAtX:relativeX nameAs:aName |
|
3446 |
"add a label and some view side-by-side. |
|
3447 |
The labels goes from 0.0 to relativeX; the inputField from relativeX to 1.0. |
|
3448 |
The labels string is defined by labelString and adjusted according to labelAdjust. |
|
3449 |
The inputField gets model as its model. |
|
3450 |
Return the inputField." |
|
3451 |
||
3452 |
|y lbl max relW| |
|
3453 |
||
3454 |
y := self yPosition. |
|
3455 |
lbl := Label label:labelString. |
|
3456 |
max := lbl preferredExtent y max:(aView preferredExtent y). |
|
3457 |
||
3458 |
relW := rightX - leftX. |
|
3459 |
||
3460 |
self addComponent:lbl indent:leftIndent withHeight:max. |
|
3461 |
lbl rightInset:0. |
|
3462 |
lbl |
|
1401 | 3463 |
width:(relW*relativeX); |
3464 |
left:leftX; |
|
3465 |
adjust:labelAdjust; borderWidth:0. |
|
795 | 3466 |
|
3467 |
self yPosition:y. |
|
3468 |
self addComponent:aView tabable:tabable. |
|
3469 |
aView |
|
1401 | 3470 |
leftInset:ViewSpacing; |
3471 |
rightInset:ViewSpacing. |
|
795 | 3472 |
|
3473 |
aView |
|
1401 | 3474 |
width:relW*(1.0 - relativeX); |
3475 |
left:leftX+(relW*relativeX). |
|
795 | 3476 |
|
3477 |
aView isInputField ifTrue:[ |
|
1401 | 3478 |
self addToInputFieldGroup:aView |
795 | 3479 |
]. |
3480 |
||
3481 |
aName notNil ifTrue:[ |
|
1401 | 3482 |
self name:lbl as:(aName , '.label'). |
3483 |
self name:aView as:aName |
|
795 | 3484 |
]. |
3485 |
^ aView |
|
3486 |
||
3487 |
" |
|
3488 |
|dialog model field| |
|
3489 |
||
3490 |
model := '' asValue. |
|
3491 |
||
3492 |
dialog := DialogBox new. |
|
3493 |
||
3494 |
field := dialog |
|
1401 | 3495 |
addLabelledField:(EditField on:model) |
3496 |
label:'input here:' |
|
3497 |
adjust:#left |
|
3498 |
tabable:true |
|
3499 |
separateAtX:0.3. |
|
807 | 3500 |
|
3501 |
dialog addAbortButton; addOkButton. |
|
3502 |
dialog open. |
|
3503 |
dialog accepted ifTrue:[Transcript showCR:model value]. |
|
3504 |
" |
|
3505 |
||
3506 |
" |
|
3507 |
|dialog model field| |
|
3508 |
||
3509 |
model := '' asValue. |
|
3510 |
||
3511 |
dialog := DialogBox new. |
|
3512 |
||
3513 |
field := dialog |
|
1401 | 3514 |
addLabelledField:((ComboListView on:model) list:#('foo' 'bar' 'baz')) |
3515 |
label:'select foo:' |
|
3516 |
adjust:#left |
|
3517 |
tabable:true |
|
3518 |
separateAtX:0.3. |
|
795 | 3519 |
|
3520 |
dialog addAbortButton; addOkButton. |
|
3521 |
dialog open. |
|
3522 |
dialog accepted ifTrue:[Transcript showCR:model value]. |
|
3523 |
" |
|
3524 |
||
3525 |
" |
|
3526 |
|dialog model field| |
|
3527 |
||
3528 |
model := SelectionInList new. |
|
3529 |
model list:#('foo' 'bar' 'baz'). |
|
3530 |
model selectionIndex:2. |
|
3531 |
||
3532 |
dialog := DialogBox new. |
|
3533 |
||
3534 |
field := dialog |
|
1401 | 3535 |
addLabelledField:(PopUpList on:model) |
3536 |
label:'select here:' |
|
3537 |
adjust:#left |
|
3538 |
tabable:true |
|
3539 |
separateAtX:0.3. |
|
795 | 3540 |
|
3541 |
dialog addAbortButton; addOkButton. |
|
3542 |
dialog open. |
|
3543 |
dialog accepted ifTrue:[Transcript showCR:model value]. |
|
3544 |
" |
|
3545 |
||
3546 |
"Created: 17.7.1996 / 15:03:32 / cg" |
|
807 | 3547 |
"Modified: 26.7.1996 / 18:11:12 / cg" |
745
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3548 |
! |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3549 |
|
593 | 3550 |
addLabelledField:aView label:labelString adjust:labelAdjust tabable:tabable separateAtX:relativeX |
3551 |
"add a label and some view side-by-side. |
|
3552 |
The labels goes from 0.0 to relativeX; the inputField from relativeX to 1.0. |
|
3553 |
The labels string is defined by labelString and adjusted according to labelAdjust. |
|
3554 |
The inputField gets model as its model. |
|
3555 |
Return the inputField." |
|
3556 |
||
745
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3557 |
^ self |
1401 | 3558 |
addLabelledField:aView |
3559 |
label:labelString |
|
3560 |
adjust:labelAdjust |
|
3561 |
tabable:tabable |
|
3562 |
from:0.0 to:1.0 |
|
3563 |
separateAtX:relativeX |
|
745
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3564 |
|
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3565 |
"/ |y lbl max| |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3566 |
"/ |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3567 |
"/ y := self yPosition. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3568 |
"/ lbl := Label label:labelString. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3569 |
"/ max := lbl preferredExtent y max:(aView preferredExtent y). |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3570 |
"/ |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3571 |
"/ self addComponent:lbl indent:leftIndent withHeight:max. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3572 |
"/ lbl rightInset:0. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3573 |
"/ lbl width:relativeX; adjust:labelAdjust; borderWidth:0. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3574 |
"/ |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3575 |
"/ self yPosition:y. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3576 |
"/ self addComponent:aView tabable:tabable. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3577 |
"/ aView leftInset:ViewSpacing; rightInset:ViewSpacing. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3578 |
"/ aView width:(1.0 - relativeX); left:relativeX. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3579 |
"/ |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3580 |
"/ aView isInputField ifTrue:[ |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3581 |
"/ self addToInputFieldGroup:aView |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3582 |
"/ ]. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3583 |
"/ |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3584 |
"/ ^ aView |
593 | 3585 |
|
3586 |
" |
|
3587 |
|dialog model field| |
|
3588 |
||
3589 |
model := '' asValue. |
|
3590 |
||
3591 |
dialog := DialogBox new. |
|
3592 |
||
3593 |
field := dialog |
|
1401 | 3594 |
addLabelledField:(EditField on:model) label:'input here:' |
3595 |
adjust:#left |
|
3596 |
tabable:true |
|
3597 |
separateAtX:0.3. |
|
593 | 3598 |
|
3599 |
dialog addAbortButton; addOkButton. |
|
3600 |
dialog open. |
|
655 | 3601 |
dialog accepted ifTrue:[Transcript showCR:model value]. |
593 | 3602 |
" |
3603 |
||
3604 |
" |
|
3605 |
|dialog model field| |
|
3606 |
||
3607 |
model := SelectionInList new. |
|
3608 |
model list:#('foo' 'bar' 'baz'). |
|
3609 |
model selectionIndex:2. |
|
3610 |
||
3611 |
dialog := DialogBox new. |
|
3612 |
||
3613 |
field := dialog |
|
1401 | 3614 |
addLabelledField:(PopUpList on:model) label:'select here:' |
3615 |
adjust:#left |
|
3616 |
tabable:true |
|
3617 |
separateAtX:0.3. |
|
593 | 3618 |
|
3619 |
dialog addAbortButton; addOkButton. |
|
3620 |
dialog open. |
|
655 | 3621 |
dialog accepted ifTrue:[Transcript showCR:model value]. |
593 | 3622 |
" |
3623 |
||
3624 |
"Created: 13.4.1996 / 13:41:31 / cg" |
|
745
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
3625 |
"Modified: 3.6.1996 / 18:48:49 / cg" |
593 | 3626 |
! |
3627 |
||
3628 |
addTextLabel:aString |
|
3629 |
"create a text label - the name has been choosen for ST-80 compatibility; |
|
3630 |
however, ST/X labels allow image labels too. |
|
3631 |
Returns the label." |
|
3632 |
||
3633 |
|l| |
|
3634 |
||
3635 |
l := Label new label:aString. |
|
3636 |
l borderWidth:0. |
|
3637 |
self addComponent:l. |
|
3638 |
^ l |
|
3639 |
||
3640 |
" |
|
3641 |
|b| |
|
3642 |
||
3643 |
b := DialogBox new. |
|
3644 |
b addTextLabel:'hello'. |
|
3645 |
b showAtPointer |
|
3646 |
" |
|
3647 |
" |
|
3648 |
|b| |
|
3649 |
||
3650 |
b := DialogBox new. |
|
3651 |
b leftIndent:100. |
|
3652 |
b addTextLabel:'hello'. |
|
3653 |
b leftIndent:0. |
|
3654 |
b addTextLabel:'world'. |
|
3655 |
b showAtPointer |
|
3656 |
" |
|
3657 |
" |
|
3658 |
|b| |
|
3659 |
||
3660 |
b := DialogBox new. |
|
3661 |
b addTextLabel:'hello'. |
|
3662 |
b addTextLabel:'world'. |
|
3663 |
b addOkButton. |
|
3664 |
b showAtPointer |
|
3665 |
" |
|
3666 |
" |
|
3667 |
|b| |
|
3668 |
||
3669 |
b := DialogBox new. |
|
3670 |
b addTextLabel:'hello'. |
|
3671 |
(b addTextLabel:'world') foregroundColor:Color red. |
|
3672 |
b addOkButton. |
|
3673 |
b showAtPointer |
|
3674 |
" |
|
3675 |
" |
|
3676 |
|b| |
|
3677 |
||
3678 |
b := DialogBox new. |
|
3679 |
b addTextLabel:'hello world\\How about this ?' withCRs. |
|
3680 |
b addOkButton. |
|
3681 |
b showAtPointer |
|
3682 |
" |
|
3683 |
" |
|
3684 |
|b| |
|
3685 |
||
3686 |
b := DialogBox new. |
|
3687 |
b addTextLabel:'hello world\\How about this ?' withCRs. |
|
3688 |
b addTextLabel:'not bad'. |
|
3689 |
b addAbortButton. |
|
3690 |
b addOkButton. |
|
3691 |
b showAtPointer |
|
3692 |
" |
|
3693 |
! |
|
3694 |
||
3695 |
addToInputFieldGroup:aComponentOrSubcomponent |
|
3696 |
"add a component to the input group. |
|
3697 |
The argument, aComponentOrSubcomponent may even be a nested subcomponent of |
|
3698 |
a topLevel component." |
|
3699 |
||
1355 | 3700 |
self |
1401 | 3701 |
addToInputFieldGroup:aComponentOrSubcomponent before:nil |
1355 | 3702 |
|
3703 |
"Modified: 18.10.1997 / 03:09:17 / cg" |
|
3704 |
! |
|
3705 |
||
3706 |
addToInputFieldGroup:aComponentOrSubcomponent before:anotherComponent |
|
3707 |
"add a component to the input group. |
|
3708 |
The argument, aComponentOrSubcomponent may even be a nested subcomponent of |
|
3709 |
a topLevel component." |
|
3710 |
||
593 | 3711 |
inputFieldGroup isNil ifTrue:[ |
1759 | 3712 |
inputFieldGroup := EnterFieldGroup new. |
3713 |
inputFieldGroup leaveAction:[self lastFieldLeft]. |
|
3714 |
"/ |
|
3715 |
"/ the first inputField gets the focus initially |
|
3716 |
"/ |
|
3717 |
aComponentOrSubcomponent hasKeyboardFocus:true. |
|
593 | 3718 |
]. |
1355 | 3719 |
inputFieldGroup add:aComponentOrSubcomponent before:anotherComponent. |
593 | 3720 |
self delegate:(KeyboardForwarder to:inputFieldGroup condition:#noFocus). |
3721 |
||
739
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
3722 |
"/ inputFields isNil ifTrue:[ |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
3723 |
"/ inputFields := OrderedCollection new. |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
3724 |
"/ |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
3725 |
"/ "/ 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
|
3726 |
"/ |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
3727 |
"/ aComponentOrSubcomponent showCursor. |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
3728 |
"/ aComponentOrSubcomponent hasKeyboardFocus:true. |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
3729 |
"/ ] ifFalse:[ |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
3730 |
"/ aComponentOrSubcomponent hideCursor. |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
3731 |
"/ aComponentOrSubcomponent hasKeyboardFocus:false. |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
3732 |
"/ ]. |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
3733 |
"/ inputFields add:aComponentOrSubcomponent |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
3734 |
|
1355 | 3735 |
"Modified: 18.10.1997 / 02:47:20 / cg" |
3736 |
"Created: 18.10.1997 / 03:08:51 / cg" |
|
3737 |
! |
|
3738 |
||
3739 |
removeFromInputFieldGroup:aComponentOrSubcomponent |
|
3740 |
"remove a component from the input group. |
|
3741 |
The argument, aComponentOrSubcomponent may even be a nested subcomponent of |
|
3742 |
a topLevel component." |
|
3743 |
||
3744 |
inputFieldGroup isNil ifTrue:[^ self]. |
|
3745 |
inputFieldGroup remove:aComponentOrSubcomponent. |
|
3746 |
||
3747 |
"Created: 18.10.1997 / 02:51:30 / cg" |
|
593 | 3748 |
! ! |
3749 |
||
3750 |
!DialogBox methodsFor:'construction-buttons'! |
|
3751 |
||
1763 | 3752 |
addAbortAndOkButtons |
3753 |
"create both abort- and Ok Buttons" |
|
3754 |
||
3755 |
self addAbortButton; addOkButton |
|
3756 |
! |
|
3757 |
||
197 | 3758 |
addAbortButton |
3759 |
"create an abortButton - to be sent from redefined initialize |
|
162 | 3760 |
methods in subclasses or when creating a box programmatically. |
3761 |
Returns the button." |
|
3762 |
||
197 | 3763 |
^ self addAbortButtonLabelled:nil |
122 | 3764 |
! |
120 | 3765 |
|
162 | 3766 |
addAbortButton:aButton |
3767 |
"add an already created abortButton - to be sent from redefined initialize |
|
3768 |
methods in subclasses or when creating a box programmatically. |
|
3769 |
Returns the button." |
|
3770 |
||
1764 | 3771 |
<resource: #style (#'dialogBox.okAtLeft')> |
3772 |
||
162 | 3773 |
abortButton := aButton. |
3774 |
aButton model:self; change:#abortPressed. |
|
1764 | 3775 |
(styleSheet at:'dialogBox.okAtLeft' default:false) ifTrue:[ |
1763 | 3776 |
self addButton:aButton after:nil. |
3777 |
] ifFalse:[ |
|
3778 |
self addButton:aButton before:nil. |
|
3779 |
]. |
|
3780 |
^ aButton. |
|
162 | 3781 |
|
3782 |
"Created: 17.9.1995 / 20:17:26 / claus" |
|
3783 |
! |
|
3784 |
||
122 | 3785 |
addAbortButtonLabelled:buttonLabel |
3786 |
"create an abortButton with a label - to be sent from redefined initialize |
|
3787 |
methods in subclasses or when creating a box programmatically. |
|
3788 |
A nil argument creates one with the default label. |
|
3789 |
Returns the button." |
|
3790 |
||
162 | 3791 |
|aButton| |
3792 |
||
3793 |
aButton := Button abortButton. |
|
3794 |
buttonLabel notNil ifTrue:[aButton label:buttonLabel]. |
|
3795 |
^ self addAbortButton:aButton |
|
3796 |
||
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
3797 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
3798 |
|dialog| |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
3799 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
3800 |
dialog := DialogBox new. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
3801 |
dialog addAbortButtonLabelled:'get out of here'. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
3802 |
dialog addOkButtonLabelled:'yes thats ok'. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
3803 |
dialog open. |
655 | 3804 |
dialog accepted ifTrue:[Transcript showCR:'yes']. |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
3805 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
3806 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
3807 |
"Modified: 9.2.1996 / 22:09:40 / cg" |
120 | 3808 |
! |
76 | 3809 |
|
197 | 3810 |
addButton:aButton |
3811 |
"add a button into the buttonPanel. |
|
122 | 3812 |
Returns the button." |
120 | 3813 |
|
197 | 3814 |
^ self addButton:aButton after:nil |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
3815 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
3816 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
3817 |
|dialog| |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
3818 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
3819 |
dialog := DialogBox new. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
3820 |
dialog addAbortButton. |
655 | 3821 |
dialog addButton:(Button label:'foo' action:[Transcript showCR:'foo']). |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
3822 |
dialog addOkButton. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
3823 |
dialog open. |
655 | 3824 |
dialog accepted ifTrue:[Transcript showCR:'yes']. |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
3825 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
3826 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
3827 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
3828 |
|dialog| |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
3829 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
3830 |
dialog := DialogBox new. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
3831 |
dialog addAbortButton. |
655 | 3832 |
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
|
3833 |
dialog addOkButton. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
3834 |
dialog open. |
655 | 3835 |
dialog accepted ifTrue:[Transcript showCR:'yes']. |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
3836 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
3837 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
3838 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
3839 |
|dialog| |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
3840 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
3841 |
dialog := DialogBox new. |
655 | 3842 |
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
|
3843 |
dialog addAbortButton. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
3844 |
dialog addOkButton. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
3845 |
dialog open. |
655 | 3846 |
dialog accepted ifTrue:[Transcript showCR:'yes']. |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
3847 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
3848 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
3849 |
"Modified: 9.2.1996 / 22:14:17 / cg" |
197 | 3850 |
! |
3851 |
||
3852 |
addButton:aButton after:someOtherButtonOrNil |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
3853 |
"add a button into the buttonPanel. |
197 | 3854 |
If the argument someOtherButtonOrNil is nil, the button is |
3855 |
added at the end." |
|
3856 |
||
3857 |
|h| |
|
3858 |
||
3859 |
buttonPanel addSubView:aButton after:someOtherButtonOrNil. |
|
3860 |
buttonPanel subViews size > 1 ifTrue:[ |
|
1843 | 3861 |
buttonPanel horizontalLayout:#fitSpace. |
197 | 3862 |
]. |
3863 |
(h := (aButton heightIncludingBorder + (ViewSpacing * 2))) > buttonPanel topInset ifTrue:[ |
|
1843 | 3864 |
buttonPanel topInset:h negated |
197 | 3865 |
]. |
310
4bbc8deffc8c
allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents:
307
diff
changeset
|
3866 |
needResize := true. |
197 | 3867 |
^ aButton |
310
4bbc8deffc8c
allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents:
307
diff
changeset
|
3868 |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
3869 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
3870 |
|dialog| |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
3871 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
3872 |
dialog := DialogBox new. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
3873 |
dialog addAbortButton. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
3874 |
dialog addOkButton. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
3875 |
dialog addButton:(Button |
1843 | 3876 |
label:'foo' |
3877 |
action:[dialog hide. Transcript showCR:'foo']) |
|
3878 |
after:(dialog okButton). |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
3879 |
dialog open. |
655 | 3880 |
dialog accepted ifTrue:[Transcript showCR:'yes']. |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
3881 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
3882 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
3883 |
|dialog| |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
3884 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
3885 |
dialog := DialogBox new. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
3886 |
dialog addAbortButton. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
3887 |
dialog addOkButton. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
3888 |
dialog addButton:(Button |
1843 | 3889 |
label:'foo' |
3890 |
action:[dialog hide. Transcript showCR:'foo']) |
|
3891 |
after:(dialog abortButton). |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
3892 |
dialog open. |
655 | 3893 |
dialog accepted ifTrue:[Transcript showCR:'yes']. |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
3894 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
3895 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
3896 |
|dialog| |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
3897 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
3898 |
dialog := DialogBox new. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
3899 |
dialog addAbortButton. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
3900 |
dialog addOkButton. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
3901 |
dialog addButton:(Button |
1843 | 3902 |
label:'foo' |
3903 |
action:[dialog hide. Transcript showCR:'foo']) |
|
3904 |
after:nil. |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
3905 |
dialog open. |
655 | 3906 |
dialog accepted ifTrue:[Transcript showCR:'yes']. |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
3907 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
3908 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
3909 |
"Modified: 9.2.1996 / 22:13:51 / cg" |
197 | 3910 |
! |
3911 |
||
353
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
3912 |
addButton:aButton before:someOtherButtonOrNil |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
3913 |
"add a button into the buttonPanel. |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
3914 |
If the argument someOtherButtonOrNil is nil, the button is |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
3915 |
added upFront." |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
3916 |
|
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
3917 |
|h| |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
3918 |
|
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
3919 |
buttonPanel addSubView:aButton before:someOtherButtonOrNil. |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
3920 |
buttonPanel subViews size > 1 ifTrue:[ |
1843 | 3921 |
buttonPanel horizontalLayout:#fitSpace. |
353
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
3922 |
]. |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
3923 |
(h := (aButton heightIncludingBorder + (ViewSpacing * 2))) > buttonPanel topInset ifTrue:[ |
1843 | 3924 |
buttonPanel topInset:h negated |
353
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
3925 |
]. |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
3926 |
needResize := true. |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
3927 |
^ aButton |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
3928 |
|
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
3929 |
" |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
3930 |
|dialog| |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
3931 |
|
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
3932 |
dialog := DialogBox new. |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
3933 |
dialog addAbortButton. |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
3934 |
dialog addOkButton. |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
3935 |
dialog addButton:(Button |
1843 | 3936 |
label:'foo' |
3937 |
action:[dialog hide. Transcript showCR:'foo']) |
|
3938 |
before:(dialog okButton). |
|
353
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
3939 |
dialog open. |
655 | 3940 |
dialog accepted ifTrue:[Transcript showCR:'yes']. |
353
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
3941 |
" |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
3942 |
" |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
3943 |
|dialog| |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
3944 |
|
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
3945 |
dialog := DialogBox new. |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
3946 |
dialog addAbortButton. |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
3947 |
dialog addOkButton. |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
3948 |
dialog addButton:(Button |
1843 | 3949 |
label:'foo' |
3950 |
action:[dialog hide. Transcript showCR:'foo']) |
|
3951 |
before:nil. |
|
353
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
3952 |
dialog open. |
655 | 3953 |
dialog accepted ifTrue:[Transcript showCR:'yes']. |
353
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
3954 |
" |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
3955 |
|
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
3956 |
"Modified: 9.2.1996 / 22:13:51 / cg" |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
3957 |
"Created: 10.2.1996 / 16:04:35 / cg" |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
3958 |
! |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
3959 |
|
593 | 3960 |
addHelpButtonFor:pathToHelpText |
3961 |
"add a help button to the buttonPanel. |
|
3962 |
The argument, pathToHelpText should specify the path to the help |
|
3963 |
text under either the doc/online/<language> or the help/<language> |
|
3964 |
directory." |
|
3965 |
||
1764 | 3966 |
<resource: #style (#'dialogBox.okAtLeft')> |
3967 |
||
593 | 3968 |
|helpButton| |
3969 |
||
3970 |
helpButton := Button label:(resources string:'help'). |
|
3971 |
helpButton action:[ |
|
1760
631f902aaabe
care for styleSheets right-to-left button order.
Claus Gittinger <cg@exept.de>
parents:
1759
diff
changeset
|
3972 |
self withWaitCursorDo:[HTMLDocumentView openFullOnHelpFile:pathToHelpText] |
631f902aaabe
care for styleSheets right-to-left button order.
Claus Gittinger <cg@exept.de>
parents:
1759
diff
changeset
|
3973 |
]. |
1764 | 3974 |
(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
|
3975 |
self addButton:helpButton after:nil. |
631f902aaabe
care for styleSheets right-to-left button order.
Claus Gittinger <cg@exept.de>
parents:
1759
diff
changeset
|
3976 |
] ifFalse:[ |
631f902aaabe
care for styleSheets right-to-left button order.
Claus Gittinger <cg@exept.de>
parents:
1759
diff
changeset
|
3977 |
self addButton:helpButton before:nil. |
631f902aaabe
care for styleSheets right-to-left button order.
Claus Gittinger <cg@exept.de>
parents:
1759
diff
changeset
|
3978 |
]. |
631f902aaabe
care for styleSheets right-to-left button order.
Claus Gittinger <cg@exept.de>
parents:
1759
diff
changeset
|
3979 |
^ helpButton |
593 | 3980 |
|
3981 |
" |
|
3982 |
|box| |
|
3983 |
||
3984 |
box := DialogBox new. |
|
3985 |
box |
|
1760
631f902aaabe
care for styleSheets right-to-left button order.
Claus Gittinger <cg@exept.de>
parents:
1759
diff
changeset
|
3986 |
addHelpButtonFor:'Launcher/compilerSettings.html'; |
631f902aaabe
care for styleSheets right-to-left button order.
Claus Gittinger <cg@exept.de>
parents:
1759
diff
changeset
|
3987 |
addAbortButton; |
631f902aaabe
care for styleSheets right-to-left button order.
Claus Gittinger <cg@exept.de>
parents:
1759
diff
changeset
|
3988 |
addOkButton. |
593 | 3989 |
|
3990 |
box open |
|
3991 |
" |
|
3992 |
||
659 | 3993 |
"Modified: 20.5.1996 / 20:30:55 / cg" |
831
8af010be0a02
Rename Launcher-->OldLauncher, NewLauncher-->Launcher.
Stefan Vogel <sv@exept.de>
parents:
807
diff
changeset
|
3994 |
"Modified: 9.9.1996 / 22:40:21 / stefan" |
593 | 3995 |
! |
3996 |
||
3997 |
addOkButton |
|
3998 |
"create an okButton - to be sent from redefined initialize |
|
3999 |
methods in subclasses or when creating a box programmatically. |
|
4000 |
Returns the button." |
|
4001 |
||
4002 |
^ self addOkButtonLabelled:nil |
|
4003 |
||
4004 |
" |
|
4005 |
|dialog| |
|
4006 |
||
4007 |
dialog := DialogBox new. |
|
4008 |
dialog addOkButton. |
|
4009 |
dialog open. |
|
655 | 4010 |
dialog accepted ifTrue:[Transcript showCR:'yes']. |
593 | 4011 |
" |
4012 |
||
4013 |
"Modified: 9.2.1996 / 21:37:02 / cg" |
|
4014 |
! |
|
4015 |
||
4016 |
addOkButton:aButton |
|
4017 |
"add an already created okButton - to be sent from redefined initialize |
|
4018 |
methods in subclasses or when creating a box programmatically. |
|
4019 |
Returns the button." |
|
4020 |
||
1764 | 4021 |
<resource: #style (#'dialogBox.okAtLeft')> |
4022 |
||
4023 |
"/ okButton isNil ifTrue:[ |
|
4024 |
okButton := aButton. |
|
4025 |
"/ ]. |
|
593 | 4026 |
aButton model:self; change:#okPressed. |
1764 | 4027 |
(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
|
4028 |
self addButton:aButton before:nil. |
631f902aaabe
care for styleSheets right-to-left button order.
Claus Gittinger <cg@exept.de>
parents:
1759
diff
changeset
|
4029 |
] ifFalse:[ |
631f902aaabe
care for styleSheets right-to-left button order.
Claus Gittinger <cg@exept.de>
parents:
1759
diff
changeset
|
4030 |
self addButton:aButton after:nil. |
631f902aaabe
care for styleSheets right-to-left button order.
Claus Gittinger <cg@exept.de>
parents:
1759
diff
changeset
|
4031 |
]. |
631f902aaabe
care for styleSheets right-to-left button order.
Claus Gittinger <cg@exept.de>
parents:
1759
diff
changeset
|
4032 |
^ aButton. |
593 | 4033 |
|
4034 |
" |
|
4035 |
|dialog b| |
|
4036 |
||
4037 |
b := Button label:((Image fromFile:'garfield.gif') magnifiedBy:0.5). |
|
4038 |
||
4039 |
dialog := DialogBox new. |
|
4040 |
dialog addOkButton:b. |
|
4041 |
dialog open. |
|
655 | 4042 |
dialog accepted ifTrue:[Transcript showCR:'yes']. |
593 | 4043 |
" |
4044 |
||
4045 |
"Modified: 17.9.1995 / 20:20:41 / claus" |
|
4046 |
"Modified: 9.2.1996 / 21:38:48 / cg" |
|
4047 |
! |
|
4048 |
||
4049 |
addOkButtonLabelled:buttonLabel |
|
4050 |
"create an okButton with a label - to be sent from redefined initialize |
|
4051 |
methods in subclasses or when creating a box programmatically. |
|
4052 |
A nil argument creates one with the default text. |
|
4053 |
Returns the button." |
|
4054 |
||
4055 |
|aButton| |
|
4056 |
||
4057 |
aButton := Button okButton. |
|
4058 |
buttonLabel notNil ifTrue:[aButton label:buttonLabel]. |
|
4059 |
aButton isReturnButton:acceptReturnAsOK. |
|
4060 |
^ self addOkButton:aButton. |
|
4061 |
||
4062 |
" |
|
4063 |
|dialog| |
|
4064 |
||
4065 |
dialog := DialogBox new. |
|
4066 |
dialog addOkButtonLabelled:'get out of here'. |
|
4067 |
dialog open. |
|
655 | 4068 |
dialog accepted ifTrue:[Transcript showCR:'yes']. |
593 | 4069 |
" |
4070 |
||
4071 |
"Modified: 9.2.1996 / 21:39:34 / cg" |
|
4072 |
! ! |
|
4073 |
||
4074 |
!DialogBox methodsFor:'construction-check & comboboxes'! |
|
4075 |
||
197 | 4076 |
addCheckBox:label on:aModel |
4077 |
"create a checkBox with label on aModel and add it. |
|
4078 |
Returns the box." |
|
4079 |
||
4080 |
^ self addCheckBox:label on:aModel tabable:true |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4081 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4082 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4083 |
|dialog check| |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4084 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4085 |
check := true asValue. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4086 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4087 |
dialog := DialogBox new. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4088 |
dialog addCheckBox:'on or off' on:check. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4089 |
dialog addOkButton. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4090 |
dialog open. |
655 | 4091 |
dialog accepted ifTrue:[Transcript showCR:check value]. |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4092 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4093 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4094 |
"Modified: 9.2.1996 / 22:15:38 / cg" |
197 | 4095 |
! |
4096 |
||
600 | 4097 |
addCheckBox:label on:aModel tabable:tabable |
4098 |
"create a checkBox with label on aModel and add it. |
|
4099 |
Returns the box." |
|
4100 |
||
4101 |
|b| |
|
4102 |
||
4103 |
b := CheckBox on:aModel. |
|
4104 |
b label:label. |
|
4105 |
self addComponent:b tabable:tabable. |
|
4106 |
^ b |
|
4107 |
||
4108 |
" |
|
4109 |
|dialog check1 check2 check3| |
|
4110 |
||
4111 |
check1 := true asValue. |
|
4112 |
check2 := false asValue. |
|
4113 |
check3 := true asValue. |
|
4114 |
||
4115 |
dialog := DialogBox new. |
|
4116 |
dialog addCheckBox:'on or off' on:check1 tabable:false. |
|
4117 |
dialog addHorizontalLine. |
|
4118 |
||
4119 |
dialog addCheckBox:'on or off' on:check2 tabable:true. |
|
4120 |
dialog addCheckBox:'on or off' on:check3 tabable:true. |
|
4121 |
dialog addOkButton. |
|
4122 |
dialog open. |
|
4123 |
" |
|
4124 |
||
4125 |
"Modified: 9.2.1996 / 22:16:49 / cg" |
|
4126 |
! |
|
4127 |
||
593 | 4128 |
addComboBoxOn:aModel |
4129 |
"create a comboBoxView on aModel and add it. |
|
4130 |
Returns the comboBoxView." |
|
4131 |
||
4132 |
^ self addComboBoxOn:aModel tabable:true |
|
4133 |
||
4134 |
" |
|
4135 |
without a list, the comboBox is disabled: |
|
4136 |
||
4137 |
|box val| |
|
4138 |
||
4139 |
val := 'some input' asValue. |
|
4140 |
||
4141 |
box := Dialog new. |
|
4142 |
||
4143 |
(box addTextLabel:'combo box example') adjust:#left. |
|
4144 |
box addVerticalSpace. |
|
4145 |
(box addComboBoxOn:val). |
|
4146 |
box addOkButton. |
|
4147 |
box open. |
|
4148 |
box accepted ifTrue:[ |
|
1401 | 4149 |
Transcript showCR:val value |
593 | 4150 |
]. |
4151 |
" |
|
4152 |
||
4153 |
"with a list, it can be pulled: |
|
4154 |
||
4155 |
|box val| |
|
4156 |
||
4157 |
val := '' asValue. |
|
4158 |
||
4159 |
box := Dialog new. |
|
4160 |
||
4161 |
(box addTextLabel:'combo box example') adjust:#left. |
|
4162 |
box addVerticalSpace. |
|
4163 |
(box addComboBoxOn:val) list:#('one' 'two' 'three' 'four'). |
|
4164 |
box addOkButton. |
|
4165 |
box open. |
|
4166 |
box accepted ifTrue:[ |
|
1401 | 4167 |
Transcript showCR:val value |
593 | 4168 |
]. |
4169 |
" |
|
4170 |
||
4171 |
"Modified: 28.2.1996 / 15:17:39 / cg" |
|
4172 |
"Created: 4.3.1996 / 17:21:45 / cg" |
|
4173 |
! |
|
4174 |
||
4175 |
addComboBoxOn:aModel tabable:tabable |
|
4176 |
"create a comboBoxView on aModel and add it. |
|
4177 |
Returns the comboBoxView." |
|
4178 |
||
4179 |
|f| |
|
4180 |
||
4181 |
f := ComboBoxView new. |
|
4182 |
f model:aModel. |
|
4183 |
self addComponent:f tabable:tabable. |
|
4184 |
tabable ifTrue:[ |
|
1401 | 4185 |
self addToInputFieldGroup:f editor. |
593 | 4186 |
]. |
4187 |
^ f |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4188 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4189 |
" |
593 | 4190 |
without a list, the comboBox is disabled: |
4191 |
||
4192 |
|box val| |
|
4193 |
||
4194 |
val := 'some input' asValue. |
|
4195 |
||
4196 |
box := Dialog new. |
|
4197 |
||
4198 |
(box addTextLabel:'combo box example') adjust:#left. |
|
4199 |
box addVerticalSpace. |
|
4200 |
(box addComboBoxOn:val tabable:true). |
|
4201 |
box addOkButton. |
|
4202 |
box open. |
|
4203 |
box accepted ifTrue:[ |
|
1401 | 4204 |
Transcript showCR:val value |
593 | 4205 |
]. |
4206 |
" |
|
4207 |
||
4208 |
"with a list, it can be pulled: |
|
4209 |
||
4210 |
|box val| |
|
4211 |
||
4212 |
val := '' asValue. |
|
4213 |
||
4214 |
box := Dialog new. |
|
4215 |
||
4216 |
(box addTextLabel:'combo box example') adjust:#left. |
|
4217 |
box addVerticalSpace. |
|
4218 |
(box addComboBoxOn:val tabable:true) list:#('one' 'two' 'three' 'four'). |
|
4219 |
box addOkButton. |
|
4220 |
box open. |
|
4221 |
box accepted ifTrue:[ |
|
1401 | 4222 |
Transcript showCR:val value |
593 | 4223 |
]. |
4224 |
" |
|
4225 |
||
4226 |
"Modified: 4.3.1996 / 17:21:57 / cg" |
|
4227 |
! |
|
4228 |
||
4229 |
addComboListOn:aModel |
|
4230 |
"create a comboListView on aModel and add it. |
|
4231 |
Returns the comboListView." |
|
4232 |
||
4233 |
^ self addComboListOn:aModel tabable:true |
|
4234 |
||
4235 |
"without a list, the comboList is disabled: |
|
4236 |
||
4237 |
|box val| |
|
4238 |
||
4239 |
val := 'some input' asValue. |
|
4240 |
||
4241 |
box := Dialog new. |
|
4242 |
||
4243 |
(box addTextLabel:'combo list example') adjust:#left. |
|
4244 |
box addVerticalSpace. |
|
4245 |
(box addComboListOn:val). |
|
4246 |
box addOkButton. |
|
4247 |
box open. |
|
4248 |
box accepted ifTrue:[ |
|
1401 | 4249 |
Transcript showCR:val value |
593 | 4250 |
]. |
4251 |
" |
|
4252 |
||
4253 |
"with a list, it can be pulled: |
|
4254 |
||
4255 |
|box val| |
|
4256 |
||
4257 |
val := '' asValue. |
|
4258 |
||
4259 |
box := Dialog new. |
|
4260 |
||
4261 |
(box addTextLabel:'combo box example') adjust:#left. |
|
4262 |
box addVerticalSpace. |
|
4263 |
(box addComboListOn:val) list:#('one' 'two' 'three' 'four'). |
|
4264 |
box addOkButton. |
|
4265 |
box open. |
|
4266 |
box accepted ifTrue:[ |
|
1401 | 4267 |
Transcript showCR:val value |
593 | 4268 |
]. |
4269 |
" |
|
4270 |
||
4271 |
"Created: 28.2.1996 / 15:16:34 / cg" |
|
4272 |
"Modified: 4.3.1996 / 17:22:59 / cg" |
|
4273 |
! |
|
4274 |
||
4275 |
addComboListOn:aModel tabable:tabable |
|
4276 |
"create a comboListView on aModel and add it. |
|
4277 |
Returns the comboListView." |
|
4278 |
||
4279 |
|f| |
|
4280 |
||
4281 |
f := ComboListView new. |
|
4282 |
f model:aModel. |
|
4283 |
self addComponent:f tabable:tabable. |
|
4284 |
^ f |
|
4285 |
||
4286 |
"without a list, the comboList is disabled: |
|
4287 |
||
4288 |
|box val| |
|
4289 |
||
4290 |
val := 'some input' asValue. |
|
4291 |
||
4292 |
box := Dialog new. |
|
4293 |
||
4294 |
(box addTextLabel:'combo list example') adjust:#left. |
|
4295 |
box addVerticalSpace. |
|
4296 |
(box addComboListOn:val tabable:true). |
|
4297 |
box addOkButton. |
|
4298 |
box open. |
|
4299 |
box accepted ifTrue:[ |
|
1401 | 4300 |
Transcript showCR:val value |
593 | 4301 |
]. |
4302 |
" |
|
4303 |
||
4304 |
"with a list, it can be pulled: |
|
4305 |
||
4306 |
|box val| |
|
4307 |
||
4308 |
val := '' asValue. |
|
4309 |
||
4310 |
box := Dialog new. |
|
4311 |
||
4312 |
(box addTextLabel:'combo box example') adjust:#left. |
|
4313 |
box addVerticalSpace. |
|
4314 |
(box addComboListOn:val tabable:true) list:#('one' 'two' 'three' 'four'). |
|
4315 |
box addOkButton. |
|
4316 |
box open. |
|
4317 |
box accepted ifTrue:[ |
|
1401 | 4318 |
Transcript showCR:val value |
593 | 4319 |
]. |
4320 |
" |
|
4321 |
||
4322 |
"Created: 28.2.1996 / 15:16:34 / cg" |
|
4323 |
"Modified: 4.3.1996 / 17:23:38 / cg" |
|
4324 |
! ! |
|
4325 |
||
4326 |
!DialogBox methodsFor:'construction-inputfields'! |
|
4327 |
||
4328 |
addFilenameInputFieldOn:aModel in:aDirectory tabable:tabable |
|
4329 |
"create a fileName input field on aModel and add it. |
|
4330 |
Returns the field. This is much like a normal input field, |
|
4331 |
but supports filename completion." |
|
4332 |
||
4333 |
|f| |
|
4334 |
||
4335 |
f := FilenameEditField new. |
|
4336 |
aDirectory notNil ifTrue:[f directory:aDirectory]. |
|
4337 |
f model:aModel. |
|
4338 |
self addInputField:f tabable:tabable. |
|
4339 |
^ f |
|
4340 |
! |
|
4341 |
||
4342 |
addInputField:aField |
|
4343 |
"add an already created input field. |
|
4344 |
Returns the field." |
|
4345 |
||
4346 |
^ self addInputField:aField tabable:true |
|
4347 |
||
4348 |
"Modified: 9.2.1996 / 20:46:16 / cg" |
|
4349 |
! |
|
4350 |
||
4351 |
addInputField:aField tabable:tabable |
|
4352 |
"add an already created input field. |
|
4353 |
If tabable is true, the field is put into a group, to allow |
|
4354 |
stepping through the fields with #Cursor/#Return keys. |
|
4355 |
Returns the field." |
|
4356 |
||
4357 |
self addComponent:aField tabable:tabable. |
|
4358 |
tabable ifTrue:[ |
|
1401 | 4359 |
self addToInputFieldGroup:aField. |
593 | 4360 |
]. |
4361 |
^ aField |
|
4362 |
||
739
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
4363 |
"Modified: 31.5.1996 / 21:22:29 / cg" |
593 | 4364 |
! |
4365 |
||
4366 |
addInputFieldOn:aModel |
|
4367 |
"create an input field on aModel and add it. |
|
4368 |
Returns the field." |
|
4369 |
||
4370 |
^ self addInputFieldOn:aModel tabable:true |
|
4371 |
||
4372 |
" |
|
4373 |
|dialog model field| |
|
4374 |
||
4375 |
model := '' asValue. |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4376 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4377 |
dialog := DialogBox new. |
593 | 4378 |
(dialog addTextLabel:'enter a string') adjust:#left. |
4379 |
||
4380 |
field := dialog addInputFieldOn:model. |
|
4381 |
||
4382 |
dialog addAbortButton; addOkButton. |
|
4383 |
dialog open. |
|
655 | 4384 |
dialog accepted ifTrue:[Transcript showCR:model value]. |
593 | 4385 |
" |
4386 |
||
4387 |
"Modified: 9.2.1996 / 21:34:14 / cg" |
|
4388 |
! |
|
4389 |
||
4390 |
addInputFieldOn:aModel tabable:tabable |
|
4391 |
"create an input field on aModel and add it. |
|
4392 |
If tabable is false, the field cannot be tabbed into |
|
4393 |
and return does not close the box. |
|
4394 |
(pointer must be moved into it). |
|
4395 |
Returns the field." |
|
4396 |
||
4397 |
|f| |
|
4398 |
||
913 | 4399 |
f := EditField model:aModel. |
593 | 4400 |
self addInputField:f tabable:tabable. |
4401 |
^ f |
|
4402 |
||
4403 |
" a non-tabable field: |
|
4404 |
||
4405 |
|dialog model field| |
|
4406 |
||
4407 |
model := '' asValue. |
|
4408 |
||
4409 |
dialog := DialogBox new. |
|
4410 |
(dialog addTextLabel:'enter a string') adjust:#left. |
|
4411 |
||
4412 |
field := dialog addInputFieldOn:model tabable:false. |
|
4413 |
||
4414 |
dialog addAbortButton; addOkButton. |
|
4415 |
dialog open. |
|
655 | 4416 |
dialog accepted ifTrue:[Transcript showCR:model value]. |
593 | 4417 |
" |
4418 |
||
4419 |
"Modified: 9.2.1996 / 21:36:16 / cg" |
|
913 | 4420 |
"Modified: 3.1.1997 / 10:24:04 / stefan" |
593 | 4421 |
! |
4422 |
||
745
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
4423 |
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
|
4424 |
"add a label and an inputField side-by-side. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
4425 |
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
|
4426 |
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
|
4427 |
The inputField gets model as its model. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
4428 |
Return the inputField." |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
4429 |
|
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
4430 |
|
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
4431 |
^ self |
1401 | 4432 |
addLabelledField:(EditField on:model) label:labelString |
4433 |
adjust:labelAdjust |
|
4434 |
tabable:tabable |
|
4435 |
from:leftX to:rightX |
|
4436 |
separateAtX:relativeX. |
|
745
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
4437 |
|
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
4438 |
" |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
4439 |
|dialog model field| |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
4440 |
|
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
4441 |
model := '' asValue. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
4442 |
|
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
4443 |
dialog := DialogBox new. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
4444 |
|
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
4445 |
field := dialog |
1401 | 4446 |
addLabelledInputField:'enter a string' |
4447 |
adjust:#left |
|
4448 |
on:model |
|
4449 |
tabable:true |
|
4450 |
separateAtX:0.3. |
|
745
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
4451 |
|
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
4452 |
dialog addAbortButton; addOkButton. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
4453 |
dialog open. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
4454 |
dialog accepted ifTrue:[Transcript showCR:model value]. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
4455 |
" |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
4456 |
|
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
4457 |
" |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
4458 |
|dialog model1 model2 field| |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
4459 |
|
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
4460 |
model1 := '' asValue. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
4461 |
model2 := '' asValue. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
4462 |
|
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
4463 |
dialog := DialogBox new. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
4464 |
|
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
4465 |
dialog addTextLabel:'a two-input box'. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
4466 |
dialog addHorizontalLine. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
4467 |
|
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
4468 |
field := dialog |
1401 | 4469 |
addLabelledInputField:'string1:' |
4470 |
adjust:#right |
|
4471 |
on:model1 |
|
4472 |
tabable:true |
|
4473 |
separateAtX:0.4. |
|
745
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
4474 |
|
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
4475 |
field := dialog |
1401 | 4476 |
addLabelledInputField:'string2:' |
4477 |
adjust:#right |
|
4478 |
on:model2 |
|
4479 |
tabable:true |
|
4480 |
separateAtX:0.4. |
|
745
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
4481 |
|
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
4482 |
dialog addAbortButton; addOkButton. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
4483 |
dialog open. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
4484 |
dialog accepted ifTrue:[ |
1401 | 4485 |
Transcript showCR:model1 value. |
4486 |
Transcript showCR:model2 value. |
|
745
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
4487 |
]. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
4488 |
" |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
4489 |
|
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
4490 |
"Modified: 19.4.1996 / 17:39:46 / cg" |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
4491 |
"Created: 3.6.1996 / 11:04:23 / cg" |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
4492 |
! |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
4493 |
|
593 | 4494 |
addLabelledInputField:labelString adjust:labelAdjust on:model tabable:tabable separateAtX:relativeX |
4495 |
"add a label and an inputField side-by-side. |
|
4496 |
The labels goes from 0.0 to relativeX; the inputField from relativeX to 1.0. |
|
4497 |
The labels string is defined by labelString and adjusted according to labelAdjust. |
|
4498 |
The inputField gets model as its model. |
|
4499 |
Return the inputField." |
|
4500 |
||
4501 |
||
4502 |
^ self |
|
1401 | 4503 |
addLabelledField:(EditField on:model) label:labelString |
4504 |
adjust:labelAdjust |
|
4505 |
tabable:tabable |
|
4506 |
separateAtX:relativeX. |
|
593 | 4507 |
|
4508 |
" |
|
4509 |
|dialog model field| |
|
4510 |
||
4511 |
model := '' asValue. |
|
4512 |
||
4513 |
dialog := DialogBox new. |
|
4514 |
||
4515 |
field := dialog |
|
1401 | 4516 |
addLabelledInputField:'enter a string' |
4517 |
adjust:#left |
|
4518 |
on:model |
|
4519 |
tabable:true |
|
4520 |
separateAtX:0.3. |
|
593 | 4521 |
|
4522 |
dialog addAbortButton; addOkButton. |
|
4523 |
dialog open. |
|
655 | 4524 |
dialog accepted ifTrue:[Transcript showCR:model value]. |
593 | 4525 |
" |
4526 |
||
4527 |
" |
|
4528 |
|dialog model1 model2 field| |
|
4529 |
||
4530 |
model1 := '' asValue. |
|
4531 |
model2 := '' asValue. |
|
4532 |
||
4533 |
dialog := DialogBox new. |
|
4534 |
||
4535 |
dialog addTextLabel:'a two-input box'. |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4536 |
dialog addHorizontalLine. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4537 |
|
593 | 4538 |
field := dialog |
1401 | 4539 |
addLabelledInputField:'string1:' |
4540 |
adjust:#right |
|
4541 |
on:model1 |
|
4542 |
tabable:true |
|
4543 |
separateAtX:0.4. |
|
593 | 4544 |
|
4545 |
field := dialog |
|
1401 | 4546 |
addLabelledInputField:'string2:' |
4547 |
adjust:#right |
|
4548 |
on:model2 |
|
4549 |
tabable:true |
|
4550 |
separateAtX:0.4. |
|
593 | 4551 |
|
4552 |
dialog addAbortButton; addOkButton. |
|
4553 |
dialog open. |
|
4554 |
dialog accepted ifTrue:[ |
|
1401 | 4555 |
Transcript showCR:model1 value. |
4556 |
Transcript showCR:model2 value. |
|
593 | 4557 |
]. |
4558 |
" |
|
4559 |
||
4560 |
"Created: 13.4.1996 / 13:41:31 / cg" |
|
4561 |
"Modified: 19.4.1996 / 17:39:46 / cg" |
|
4562 |
! ! |
|
4563 |
||
4564 |
!DialogBox methodsFor:'construction-layout'! |
|
4565 |
||
4566 |
addHorizontalLine |
|
4567 |
"add a horizontal line as separator" |
|
4568 |
||
4569 |
^ self addComponent:(Separator new extent:1.0 @ 5). |
|
4570 |
||
4571 |
" |
|
4572 |
|dialog| |
|
4573 |
||
4574 |
dialog := DialogBox new. |
|
4575 |
dialog |
|
1401 | 4576 |
addTextLabel:'some title string'; |
4577 |
addHorizontalLine; |
|
4578 |
addTextLabel:'more text'; |
|
4579 |
addOkButton; |
|
4580 |
open. |
|
593 | 4581 |
" |
4582 |
||
4583 |
" |
|
4584 |
|dialog| |
|
4585 |
||
4586 |
dialog := DialogBox new. |
|
4587 |
dialog |
|
1401 | 4588 |
addTextLabel:'some title string'; |
4589 |
addHorizontalLine; |
|
4590 |
addTextLabel:'more text'. |
|
593 | 4591 |
(dialog addHorizontalLine) width:20. |
4592 |
dialog addTextLabel:'more text'. |
|
4593 |
(dialog addHorizontalLine) width:20. |
|
4594 |
dialog |
|
1401 | 4595 |
addTextLabel:'more text'; |
4596 |
addHorizontalLine; |
|
4597 |
addOkButton; |
|
4598 |
open. |
|
593 | 4599 |
" |
4600 |
||
4601 |
"Modified: 19.4.1996 / 15:11:30 / cg" |
|
4602 |
! |
|
4603 |
||
4604 |
addVerticalSpace |
|
4605 |
"add a default vertical space (1 mm)" |
|
4606 |
||
4607 |
self addVerticalSpace:(ViewSpacing). |
|
4608 |
||
4609 |
" |
|
4610 |
|dialog| |
|
4611 |
||
4612 |
dialog := DialogBox new. |
|
4613 |
dialog addTextLabel:'some title string'. |
|
4614 |
dialog addVerticalSpace. |
|
4615 |
dialog addTextLabel:'more text'. |
|
4616 |
||
4617 |
dialog addOkButton. |
|
4618 |
dialog open. |
|
4619 |
" |
|
4620 |
||
4621 |
"Modified: 9.2.1996 / 21:41:10 / cg" |
|
4622 |
! |
|
4623 |
||
4624 |
addVerticalSpace:nPixel |
|
4625 |
"add some pixels of space to the next component" |
|
4626 |
||
4627 |
yPosition := yPosition + nPixel. |
|
4628 |
needResize := true. |
|
4629 |
||
4630 |
" |
|
4631 |
|dialog| |
|
4632 |
||
4633 |
dialog := DialogBox new. |
|
4634 |
dialog addTextLabel:'some title string'. |
|
4635 |
dialog addVerticalSpace:50. |
|
4636 |
dialog addTextLabel:'more text'. |
|
4637 |
||
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4638 |
dialog addOkButton. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4639 |
dialog open. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4640 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4641 |
|
593 | 4642 |
"Modified: 9.2.1996 / 21:41:23 / cg" |
4643 |
! |
|
4644 |
||
4645 |
leftIndent |
|
4646 |
"return the current indent |
|
4647 |
(current x position - thats where the next component will be located)." |
|
4648 |
||
4649 |
^ leftIndent |
|
4650 |
||
4651 |
"Modified: 27.1.1996 / 18:21:31 / cg" |
|
4652 |
! |
|
4653 |
||
4654 |
leftIndent:aNumber |
|
4655 |
"set the left indent (current x position - thats where the next component |
|
4656 |
will be located)." |
|
4657 |
||
4658 |
leftIndent := aNumber. |
|
4659 |
needResize := true. |
|
4660 |
||
4661 |
" |
|
4662 |
|dialog| |
|
4663 |
||
4664 |
dialog := DialogBox new. |
|
4665 |
(dialog addTextLabel:'label1') adjust:#left. |
|
4666 |
dialog leftIndent:20. |
|
4667 |
(dialog addTextLabel:'label2') adjust:#left. |
|
4668 |
dialog leftIndent:40. |
|
4669 |
(dialog addTextLabel:'label3') adjust:#left. |
|
4670 |
dialog leftIndent:60. |
|
4671 |
(dialog addTextLabel:'label4') adjust:#left. |
|
4672 |
||
4673 |
dialog addOkButton. |
|
4674 |
dialog open. |
|
4675 |
" |
|
4676 |
||
4677 |
"Modified: 9.2.1996 / 21:42:20 / cg" |
|
4678 |
! |
|
4679 |
||
4680 |
rightIndent |
|
4681 |
"return the current right indent." |
|
4682 |
||
4683 |
^ rightIndent |
|
4684 |
||
4685 |
"Modified: 27.1.1996 / 18:21:31 / cg" |
|
4686 |
! |
|
4687 |
||
4688 |
rightIndent:aNumber |
|
4689 |
"set the right indent" |
|
4690 |
||
4691 |
rightIndent := aNumber. |
|
4692 |
needResize := true. |
|
4693 |
||
4694 |
" |
|
4695 |
|dialog| |
|
4696 |
||
4697 |
dialog := DialogBox new. |
|
4698 |
(dialog addTextLabel:'label1') adjust:#right. |
|
4699 |
dialog rightIndent:20. |
|
4700 |
(dialog addTextLabel:'label2') adjust:#right. |
|
4701 |
dialog rightIndent:40. |
|
4702 |
(dialog addTextLabel:'label3') adjust:#right. |
|
4703 |
dialog rightIndent:60. |
|
4704 |
(dialog addTextLabel:'label4') adjust:#right. |
|
4705 |
||
4706 |
dialog addOkButton. |
|
4707 |
dialog open. |
|
4708 |
" |
|
4709 |
||
4710 |
"Modified: 9.2.1996 / 21:42:46 / cg" |
|
4711 |
! |
|
4712 |
||
4713 |
stickAtBottomWithFixHeight:aComponent |
|
4714 |
"arrange for a component to be positioned at a constant offset |
|
4715 |
from the bottom of the box and its height to remain the same. |
|
4716 |
This will keep the component at a constant distance from the bottom |
|
4717 |
(without this setup, it would stay at a constant offset from the top)" |
|
4718 |
||
4719 |
self resize. |
|
4720 |
||
4721 |
aComponent |
|
4722 |
topInset:(self height - aComponent top) negated; |
|
4723 |
bottomInset:(self height - aComponent bottom); |
|
4724 |
origin:0.0 @ 1.0; corner:1.0 @ 1.0. |
|
4725 |
||
4726 |
" |
|
4727 |
compare the resizing behavior of: |
|
4728 |
||
4729 |
|box| |
|
4730 |
||
4731 |
box := Dialog new. |
|
4732 |
box addTextLabel:'hello'. |
|
4733 |
box addTextLabel:'hello2'. |
|
4734 |
box addOkButton. |
|
4735 |
box show |
|
4736 |
||
4737 |
with: |
|
4738 |
||
4739 |
|box l2| |
|
4740 |
||
4741 |
box := Dialog new. |
|
4742 |
box addTextLabel:'hello'. |
|
4743 |
l2 := box addTextLabel:'hello2'. |
|
4744 |
box addOkButton. |
|
4745 |
box stickAtBottomWithFixHeight:l2. |
|
4746 |
box show |
|
4747 |
" |
|
4748 |
||
4749 |
"Created: 27.1.1996 / 17:17:41 / cg" |
|
4750 |
"Modified: 27.1.1996 / 18:29:03 / cg" |
|
4751 |
! |
|
4752 |
||
4753 |
stickAtBottomWithVariableHeight:aComponent |
|
4754 |
"arrange for a component to be positioned at a constant offset |
|
4755 |
from the bottom of the box and its height to be adjusted. |
|
4756 |
This will resize the component for a constant distance from the top, |
|
4757 |
and the bottom. |
|
4758 |
(without this setup, its height would remain constant)" |
|
4759 |
||
4760 |
self resize. |
|
4761 |
||
4762 |
aComponent |
|
1401 | 4763 |
bottomInset:(self height - aComponent bottom); |
4764 |
corner:1.0@1.0. |
|
593 | 4765 |
|
4766 |
" |
|
4767 |
compare the resizing behavior of: |
|
4768 |
||
1401 | 4769 |
|box| |
4770 |
||
4771 |
box := Dialog new. |
|
4772 |
box addTextLabel:'hello'. |
|
4773 |
(box addComponent:(SelectionInListView new)) level:-1. |
|
4774 |
box addOkButton. |
|
4775 |
box show |
|
593 | 4776 |
|
4777 |
with: |
|
4778 |
||
1401 | 4779 |
|box list| |
4780 |
||
4781 |
box := Dialog new. |
|
4782 |
box addTextLabel:'hello'. |
|
4783 |
list := (box addComponent:(SelectionInListView new)) level:-1. |
|
4784 |
box addOkButton. |
|
4785 |
box stickAtBottomWithVariableHeight:list. |
|
4786 |
box show |
|
593 | 4787 |
" |
4788 |
||
4789 |
"Modified: 27.4.1996 / 18:34:20 / cg" |
|
4790 |
! |
|
4791 |
||
4792 |
yPosition |
|
4793 |
"return the current y position (thats where the next component |
|
4794 |
will be located)." |
|
4795 |
||
4796 |
^ yPosition |
|
120 | 4797 |
! |
4798 |
||
593 | 4799 |
yPosition:aNumber |
4800 |
"set the current y position (thats where the next component |
|
4801 |
will be located)." |
|
4802 |
||
4803 |
yPosition := aNumber. |
|
4804 |
needResize := true. |
|
4805 |
||
4806 |
" |
|
4807 |
|dialog pos| |
|
4808 |
||
4809 |
dialog := DialogBox new. |
|
4810 |
pos := dialog yPosition. |
|
4811 |
(dialog addTextLabel:'label1') width:0.5. |
|
4812 |
dialog yPosition:pos. |
|
4813 |
(dialog addTextLabel:'label2') width:0.5; left:0.5. |
|
4814 |
||
4815 |
dialog addOkButton. |
|
4816 |
dialog open. |
|
4817 |
" |
|
4818 |
||
4819 |
" |
|
4820 |
|dialog pos| |
|
4821 |
||
4822 |
dialog := DialogBox new. |
|
4823 |
pos := dialog yPosition. |
|
4824 |
#('one' 'two' 'three' 'four') |
|
4825 |
with:#(0.0 0.25 0.5 0.75) do:[:lbl :x | |
|
1401 | 4826 |
dialog yPosition:pos. |
4827 |
(dialog addComponent:(Button label:lbl) tabable:true) |
|
4828 |
width:0.25; left:x. |
|
593 | 4829 |
]. |
4830 |
||
4831 |
dialog addOkButton. |
|
4832 |
dialog open. |
|
4833 |
" |
|
4834 |
||
4835 |
"Modified: 9.2.1996 / 21:46:40 / cg" |
|
4836 |
! ! |
|
4837 |
||
4838 |
!DialogBox methodsFor:'construction-lists'! |
|
4839 |
||
4840 |
addListBoxOn:aModel |
|
4841 |
"add a selectionInListView to the box. |
|
4842 |
The listViews ScrollWrapper is returned" |
|
4843 |
||
4844 |
^ self |
|
1401 | 4845 |
addListBoxOn:aModel |
4846 |
withNumberOfLines:nil |
|
4847 |
hScrollable:false |
|
4848 |
vScrollable:true. |
|
593 | 4849 |
|
4850 |
" |
|
4851 |
|dialog model listView| |
|
4852 |
||
4853 |
model := SelectionInList new. |
|
4854 |
model list:#('one' 'two' 'three' 'four'). |
|
4855 |
model selectionIndex:2. |
|
4856 |
||
4857 |
dialog := DialogBox new. |
|
4858 |
(dialog addTextLabel:'select any') adjust:#left. |
|
4859 |
||
4860 |
listView := dialog addListBoxOn:model. |
|
4861 |
||
4862 |
dialog addAbortButton; addOkButton. |
|
4863 |
dialog open. |
|
4864 |
||
655 | 4865 |
dialog accepted ifTrue:[Transcript show:'selection is:'; showCR:model selection]. |
593 | 4866 |
" |
4867 |
||
4868 |
"Modified: 27.4.1996 / 18:27:58 / cg" |
|
4869 |
! |
|
4870 |
||
4871 |
addListBoxOn:aModel class:aListViewClass |
|
4872 |
"create & add an instance of aListViewClass to the box. |
|
4873 |
The listViews ScrollWrapper is returned" |
|
4874 |
||
4875 |
^ self |
|
1401 | 4876 |
addListBoxOn:aModel |
4877 |
class:aListViewClass |
|
4878 |
withNumberOfLines:nil |
|
4879 |
hScrollable:false |
|
4880 |
vScrollable:true. |
|
593 | 4881 |
|
4882 |
"Created: 19.4.1996 / 13:06:14 / cg" |
|
4883 |
"Modified: 27.4.1996 / 18:27:53 / cg" |
|
4884 |
! |
|
4885 |
||
4886 |
addListBoxOn:aModel class:aListViewClass withNumberOfLines:numLines |
|
4887 |
"create and add an instance of aListViewClass to the box. |
|
4888 |
The list has numLines (if nonNil) number of lines shown. |
|
4889 |
The listViews ScrollWrapper is returned" |
|
4890 |
||
4891 |
^ self |
|
1401 | 4892 |
addListBoxOn:aModel |
4893 |
class:aListViewClass |
|
4894 |
withNumberOfLines:numLines |
|
4895 |
hScrollable:false |
|
4896 |
vScrollable:true. |
|
593 | 4897 |
|
4898 |
"Created: 19.4.1996 / 13:05:05 / cg" |
|
4899 |
"Modified: 27.4.1996 / 18:27:48 / cg" |
|
4900 |
! |
|
4901 |
||
4902 |
addListBoxOn:aModel class:aListViewClass withNumberOfLines:numLines hScrollable:hs vScrollable:vs |
|
766 | 4903 |
"add an instance of aListViewClass (selectionInListView) to the box. |
593 | 4904 |
The list has numLines (if nonNil) number of lines shown. |
4905 |
If scrolled, the ScrollWrapper is returned - otherwise the listView." |
|
4906 |
||
766 | 4907 |
|l| |
4908 |
||
4909 |
l := self addTextBoxOn:aModel class:aListViewClass withNumberOfLines:numLines hScrollable:hs vScrollable:vs. |
|
593 | 4910 |
l doubleClickAction:[:name | self okPressed]. |
766 | 4911 |
^ l |
593 | 4912 |
|
4913 |
" |
|
4914 |
|dialog listView| |
|
4915 |
||
4916 |
dialog := DialogBox new. |
|
4917 |
(dialog addTextLabel:'select any') adjust:#left. |
|
4918 |
||
4919 |
listView := dialog |
|
1401 | 4920 |
addListBoxOn:nil |
4921 |
class:FileSelectionList |
|
4922 |
withNumberOfLines:10 |
|
4923 |
hScrollable:false |
|
4924 |
vScrollable:false. |
|
593 | 4925 |
|
4926 |
listView directory:'/etc'. |
|
4927 |
||
4928 |
dialog addAbortButton; addOkButton. |
|
4929 |
dialog open. |
|
4930 |
||
655 | 4931 |
dialog accepted ifTrue:[Transcript show:'selection is:'; showCR:listView selectionValue]. |
593 | 4932 |
" |
4933 |
||
4934 |
"Created: 22.2.1996 / 15:40:07 / cg" |
|
4935 |
"Modified: 27.4.1996 / 18:26:15 / cg" |
|
766 | 4936 |
"Modified: 15.6.1996 / 00:31:20 / stefan" |
593 | 4937 |
! |
4938 |
||
4939 |
addListBoxOn:aModel withNumberOfLines:numLines |
|
4940 |
"add a selectionInListView to the box. |
|
4941 |
The list has numLines (if nonNil) number of lines shown. |
|
4942 |
The listViews ScrollWrapper is returned" |
|
4943 |
||
4944 |
^ self |
|
1401 | 4945 |
addListBoxOn:aModel |
4946 |
withNumberOfLines:numLines |
|
4947 |
hScrollable:false |
|
4948 |
vScrollable:true. |
|
593 | 4949 |
|
4950 |
" |
|
4951 |
|dialog model listView| |
|
4952 |
||
4953 |
model := SelectionInList new. |
|
4954 |
model list:#('one' 'two' 'three' 'four'). |
|
4955 |
model selectionIndex:2. |
|
4956 |
||
4957 |
dialog := DialogBox new. |
|
4958 |
(dialog addTextLabel:'select any') adjust:#left. |
|
4959 |
||
4960 |
listView := dialog addListBoxOn:model withNumberOfLines:3. |
|
4961 |
||
4962 |
dialog addAbortButton; addOkButton. |
|
4963 |
dialog open. |
|
4964 |
||
655 | 4965 |
dialog accepted ifTrue:[Transcript show:'selection is:'; showCR:model selection]. |
593 | 4966 |
" |
4967 |
||
4968 |
"Created: 22.2.1996 / 15:40:07 / cg" |
|
4969 |
"Modified: 27.4.1996 / 18:27:42 / cg" |
|
4970 |
! |
|
4971 |
||
4972 |
addListBoxOn:aModel withNumberOfLines:numLines hScrollable:hs vScrollable:vs |
|
4973 |
"add a selectionInListView to the box. |
|
4974 |
The list has numLines (if nonNil) number of lines shown. |
|
4975 |
If scrolled, the ScrollWrapper is returned - otherwise the listView." |
|
4976 |
||
4977 |
^ self |
|
1401 | 4978 |
addListBoxOn:aModel |
4979 |
class:SelectionInListView |
|
4980 |
withNumberOfLines:numLines |
|
4981 |
hScrollable:hs |
|
4982 |
vScrollable:vs |
|
593 | 4983 |
|
4984 |
" |
|
4985 |
|dialog model listView| |
|
4986 |
||
4987 |
model := SelectionInList new. |
|
4988 |
model list:#('one' 'two' 'three' 'four'). |
|
4989 |
model selectionIndex:2. |
|
4990 |
||
4991 |
dialog := DialogBox new. |
|
4992 |
(dialog addTextLabel:'select any') adjust:#left. |
|
4993 |
||
4994 |
listView := dialog addListBoxOn:model withNumberOfLines:3 hScrollable:true vScrollable:true. |
|
4995 |
||
4996 |
dialog addAbortButton; addOkButton. |
|
4997 |
dialog open. |
|
4998 |
||
655 | 4999 |
dialog accepted ifTrue:[Transcript show:'selection is:'; showCR:model selection]. |
593 | 5000 |
" |
5001 |
||
5002 |
" |
|
5003 |
|dialog model listView| |
|
5004 |
||
5005 |
model := SelectionInList new. |
|
5006 |
model list:#('one' 'two' 'three' 'four'). |
|
5007 |
model selectionIndex:2. |
|
5008 |
||
5009 |
dialog := DialogBox new. |
|
5010 |
(dialog addTextLabel:'select any') adjust:#left. |
|
5011 |
||
5012 |
listView := dialog addListBoxOn:model withNumberOfLines:3 hScrollable:false vScrollable:false. |
|
5013 |
||
5014 |
dialog addAbortButton; addOkButton. |
|
5015 |
dialog open. |
|
5016 |
||
655 | 5017 |
dialog accepted ifTrue:[Transcript show:'selection is:'; showCR:model selection]. |
593 | 5018 |
" |
5019 |
||
5020 |
"Created: 22.2.1996 / 15:40:07 / cg" |
|
5021 |
"Modified: 27.4.1996 / 18:26:36 / cg" |
|
5022 |
! |
|
5023 |
||
5024 |
addPopUpList:labelString on:aModel |
|
5025 |
"create a popUpList with a label on aModel and add it. |
|
5026 |
Returns the box." |
|
5027 |
||
5028 |
^ self addPopUpList:labelString on:aModel tabable:true |
|
5029 |
! |
|
5030 |
||
5031 |
addPopUpList:labelString on:aModel tabable:tabable |
|
5032 |
"create a popUpList on aModel and add it. |
|
5033 |
Returns the popUpList." |
|
5034 |
||
5035 |
|p box l| |
|
5036 |
||
5037 |
p := PopUpList on:aModel. |
|
5038 |
p resize; sizeFixed:true. |
|
5039 |
labelString notNil ifTrue:[ |
|
1401 | 5040 |
box := HorizontalPanelView new. |
5041 |
box borderWidth:0; horizontalLayout:#rightSpace. |
|
5042 |
box add:(l := Label label:labelString). |
|
5043 |
l borderWidth:0. |
|
5044 |
box add:p. |
|
593 | 5045 |
] ifFalse:[ |
1401 | 5046 |
box := p. |
593 | 5047 |
]. |
5048 |
self addComponent:box tabable:tabable tabbedComponent:p. |
|
5049 |
^ p |
|
735
2552463a8f34
place popUp at right (without extra space)
Claus Gittinger <cg@exept.de>
parents:
719
diff
changeset
|
5050 |
|
739
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
5051 |
"Modified: 31.5.1996 / 21:25:17 / cg" |
593 | 5052 |
! |
5053 |
||
5054 |
addPopUpListOn:aModel |
|
5055 |
"create a popUpList on aModel and add it. |
|
5056 |
Returns the box." |
|
5057 |
||
5058 |
^ self addPopUpList:nil on:aModel tabable:true |
|
5059 |
! |
|
5060 |
||
5061 |
addPopUpListOn:aModel tabable:tabable |
|
5062 |
"create a popUpList on aModel and add it. |
|
5063 |
Returns the popUpList." |
|
5064 |
||
5065 |
^ self addPopUpList:nil on:aModel tabable:tabable |
|
766 | 5066 |
! |
5067 |
||
5068 |
addTextBoxOn:aModel class:aListViewClass withNumberOfLines:numLines hScrollable:hs vScrollable:vs |
|
5069 |
"add an instance of aListViewClass to the box. |
|
5070 |
The list has numLines (if nonNil) number of lines shown. |
|
5071 |
If scrolled, the ScrollWrapper is returned - otherwise the listView." |
|
5072 |
||
5073 |
|l scr h dH| |
|
5074 |
||
5075 |
l := aListViewClass new. |
|
5076 |
l model:aModel. |
|
5077 |
||
877 | 5078 |
(vs or:[hs]) ifTrue:[ |
1401 | 5079 |
hs ifTrue:[ |
5080 |
scr := HVScrollableView forView:l miniScrollerH:true . |
|
5081 |
] ifFalse:[ |
|
5082 |
scr := ScrollableView forView:l |
|
5083 |
]. |
|
5084 |
scr resize. |
|
5085 |
"/ Transcript show:scr height; show:' '; showCR:l height. |
|
5086 |
dH := scr height - l height. |
|
766 | 5087 |
] ifFalse:[ |
1401 | 5088 |
l level:-1. |
5089 |
scr := l. |
|
5090 |
dH := 0. |
|
766 | 5091 |
]. |
5092 |
||
5093 |
numLines notNil ifTrue:[ |
|
1401 | 5094 |
h := l heightForLines:numLines. |
766 | 5095 |
] ifFalse:[ |
1401 | 5096 |
h := l preferredExtent y |
766 | 5097 |
]. |
5098 |
self addComponent:scr withHeight:(h + dH). |
|
5099 |
^ scr |
|
5100 |
||
5101 |
" |
|
5102 |
|dialog listView| |
|
5103 |
||
5104 |
dialog := DialogBox new. |
|
5105 |
(dialog addTextLabel:'select any') adjust:#left. |
|
5106 |
||
5107 |
listView := dialog |
|
1401 | 5108 |
addTextBoxOn:nil |
5109 |
class:EditTextView |
|
5110 |
withNumberOfLines:10 |
|
5111 |
hScrollable:true |
|
5112 |
vScrollable:true. |
|
766 | 5113 |
|
5114 |
||
5115 |
dialog addAbortButton; addOkButton. |
|
5116 |
dialog open. |
|
5117 |
||
5118 |
dialog accepted ifTrue:[Transcript show:'selection is:'; showCR:listView contents]. |
|
5119 |
" |
|
5120 |
||
5121 |
"Created: 14.6.1996 / 23:33:47 / stefan" |
|
877 | 5122 |
"Modified: 8.11.1996 / 15:31:15 / cg" |
593 | 5123 |
! ! |
5124 |
||
5125 |
!DialogBox methodsFor:'construction-rows & columns'! |
|
5126 |
||
130 | 5127 |
addColumn:aRow fromX:leftX toX:rightX collect:aBlock |
5128 |
"add some elements in a vertical column. |
|
5129 |
Equally space elements as returned from aBlock." |
|
5130 |
||
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5131 |
self |
1401 | 5132 |
addColumn:aRow |
5133 |
fromX:leftX toX:rightX |
|
5134 |
collect:aBlock |
|
5135 |
tabable:false |
|
130 | 5136 |
|
5137 |
" |
|
5138 |
|dialog| |
|
5139 |
||
5140 |
dialog := Dialog new. |
|
5141 |
dialog |
|
1401 | 5142 |
addColumn:#('label1' 'label2' 'lbl3' 'l4' 'label5') |
5143 |
fromX:0.0 |
|
5144 |
toX:1.0 |
|
5145 |
collect:[:label | Label label:label]. |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5146 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5147 |
dialog addOkButton. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5148 |
dialog open. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5149 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5150 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5151 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5152 |
|dialog| |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5153 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5154 |
dialog := Dialog new. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5155 |
dialog |
1401 | 5156 |
addColumn:#('label1' 'label2' 'label3' 'label4' 'label5') |
5157 |
fromX:0.25 |
|
5158 |
toX:0.75 |
|
5159 |
collect:[:label | (Label label:label) adjust:#left]. |
|
130 | 5160 |
|
5161 |
dialog addOkButton. |
|
5162 |
dialog open. |
|
5163 |
" |
|
5164 |
||
5165 |
" |
|
5166 |
|dialog y| |
|
5167 |
||
5168 |
dialog := Dialog new. |
|
5169 |
y := dialog yPosition. |
|
5170 |
dialog |
|
1401 | 5171 |
addColumn:#('a1' 'b1' 'c1' 'd1') |
5172 |
fromX:0 |
|
5173 |
toX:(1/3) |
|
5174 |
collect:[:label | Label label:label]. |
|
130 | 5175 |
|
5176 |
dialog yPosition:y. |
|
5177 |
dialog |
|
1401 | 5178 |
addColumn:#('a2' 'b2' 'c2' 'd2') |
5179 |
fromX:(1/3) |
|
5180 |
toX:(2/3) |
|
5181 |
collect:[:label | Label label:label]. |
|
130 | 5182 |
|
5183 |
dialog yPosition:y. |
|
5184 |
dialog |
|
1401 | 5185 |
addColumn:#('a3' 'b3' 'c3' 'd3') |
5186 |
fromX:(2/3) |
|
5187 |
toX:1 |
|
5188 |
collect:[:label | Label label:label]. |
|
130 | 5189 |
|
5190 |
dialog addOkButton. |
|
5191 |
dialog open. |
|
5192 |
" |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5193 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5194 |
"Modified: 9.2.1996 / 22:22:12 / cg" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5195 |
! |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5196 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5197 |
addColumn:aRow fromX:leftX toX:rightX collect:aBlock tabable:tabable |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5198 |
"add some elements in a vertical column. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5199 |
Equally space elements as returned from aBlock." |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5200 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5201 |
self |
1401 | 5202 |
addColumn:aRow |
5203 |
fromX:leftX toX:rightX |
|
5204 |
collect:aBlock |
|
5205 |
tabable:tabable |
|
5206 |
horizontalLayout:#fitSpace |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5207 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5208 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5209 |
|dialog y values| |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5210 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5211 |
values := (1 to:4) collect:[:dummy | '' asValue]. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5212 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5213 |
dialog := Dialog new. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5214 |
y := dialog yPosition. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5215 |
dialog |
1401 | 5216 |
addColumn:#('one' 'two' 'three' 'four') |
5217 |
fromX:0 |
|
5218 |
toX:0.3 |
|
5219 |
collect:[:label | Label label:label]. |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5220 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5221 |
dialog yPosition:y. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5222 |
dialog |
1401 | 5223 |
addColumn:values |
5224 |
fromX:0.3 |
|
5225 |
toX:1.0 |
|
5226 |
collect:[:value | EditField on:value] |
|
5227 |
tabable:true. |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5228 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5229 |
dialog addOkButton. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5230 |
dialog open. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5231 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5232 |
dialog accepted ifTrue:[ |
1401 | 5233 |
Transcript showCR:(values collect:[:holder | holder value]) |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5234 |
] |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5235 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5236 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5237 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5238 |
|dialog y values| |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5239 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5240 |
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
|
5241 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5242 |
dialog := Dialog new. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5243 |
y := dialog yPosition. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5244 |
dialog |
1401 | 5245 |
addColumn:(1 to:4) |
5246 |
fromX:0 |
|
5247 |
toX:0.5 |
|
5248 |
collect:[:idx | CheckToggle on:(values at:idx)] |
|
5249 |
tabable:true |
|
5250 |
horizontalLayout:#center. |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5251 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5252 |
dialog yPosition:y. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5253 |
dialog |
1401 | 5254 |
addColumn:(5 to:8) |
5255 |
fromX:0.5 |
|
5256 |
toX:1.0 |
|
5257 |
collect:[:idx | CheckToggle on:(values at:idx)] |
|
5258 |
tabable:true |
|
5259 |
horizontalLayout:#center. |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5260 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5261 |
dialog addOkButton. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5262 |
dialog open. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5263 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5264 |
dialog accepted ifTrue:[ |
1401 | 5265 |
Transcript showCR:(values collect:[:holder | holder value]) |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5266 |
] |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5267 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5268 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5269 |
"Created: 9.2.1996 / 21:51:47 / cg" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5270 |
"Modified: 9.2.1996 / 22:22:02 / cg" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5271 |
! |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5272 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5273 |
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
|
5274 |
"add some elements in a vertical column. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5275 |
Equally space elements as returned from aBlock." |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5276 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5277 |
|helper component| |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5278 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5279 |
helper := VerticalPanelView new. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5280 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5281 |
aRow do:[:el | |
1401 | 5282 |
component := aBlock value:el. |
5283 |
helper add:component. |
|
5284 |
component resize. |
|
5285 |
tabable ifTrue:[self makeTabable:component]. |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5286 |
]. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5287 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5288 |
helper resize. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5289 |
self addComponent:helper. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5290 |
width < helper preferredExtent x ifTrue:[ |
1401 | 5291 |
self width:helper preferredExtent x. |
5292 |
"/ Transcript show:'w now: '; showCR:helper preferredExtent x |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5293 |
]. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5294 |
helper horizontalLayout:hLayout. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5295 |
helper left:leftX asFloat; |
1401 | 5296 |
right:rightX asFloat; |
5297 |
leftInset:leftIndent; |
|
5298 |
rightInset:rightIndent. |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5299 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5300 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5301 |
|dialog y values| |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5302 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5303 |
values := (1 to:4) collect:[:dummy | '' asValue]. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5304 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5305 |
dialog := Dialog new. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5306 |
y := dialog yPosition. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5307 |
dialog |
1401 | 5308 |
addColumn:#('one' 'two' 'three' 'four') |
5309 |
fromX:0 |
|
5310 |
toX:0.3 |
|
5311 |
collect:[:label | Label label:label]. |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5312 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5313 |
dialog yPosition:y. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5314 |
dialog |
1401 | 5315 |
addColumn:values |
5316 |
fromX:0.3 |
|
5317 |
toX:1.0 |
|
5318 |
collect:[:value | EditField on:value] |
|
5319 |
tabable:true. |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5320 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5321 |
dialog addOkButton. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5322 |
dialog open. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5323 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5324 |
dialog accepted ifTrue:[ |
1401 | 5325 |
Transcript showCR:(values collect:[:holder | holder value]) |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5326 |
] |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5327 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5328 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5329 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5330 |
|dialog y values| |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5331 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5332 |
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
|
5333 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5334 |
dialog := Dialog new. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5335 |
y := dialog yPosition. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5336 |
dialog |
1401 | 5337 |
addColumn:(1 to:4) |
5338 |
fromX:0 |
|
5339 |
toX:0.5 |
|
5340 |
collect:[:idx | CheckToggle on:(values at:idx)]. |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5341 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5342 |
dialog yPosition:y. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5343 |
dialog |
1401 | 5344 |
addColumn:(5 to:8) |
5345 |
fromX:0.5 |
|
5346 |
toX:1.0 |
|
5347 |
collect:[:idx | CheckToggle on:(values at:idx)] |
|
5348 |
tabable:true. |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5349 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5350 |
dialog addOkButton. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5351 |
dialog open. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5352 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5353 |
dialog accepted ifTrue:[ |
1401 | 5354 |
Transcript showCR:(values collect:[:holder | holder value]) |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5355 |
] |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5356 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5357 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5358 |
"Modified: 9.2.1996 / 22:02:22 / cg" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5359 |
"Created: 9.2.1996 / 22:20:31 / cg" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5360 |
! |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5361 |
|
130 | 5362 |
addRow:aCol fromX:leftX toX:rightX collect:aBlock |
5363 |
"add some elements in a horizontal row. |
|
5364 |
Equally space elements as returned from aBlock. |
|
5365 |
Advance y." |
|
5366 |
||
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5367 |
self |
1401 | 5368 |
addRow:aCol |
5369 |
fromX:leftX toX:rightX |
|
5370 |
collect:aBlock |
|
5371 |
tabable:true |
|
5372 |
horizontalLayout:#spread |
|
130 | 5373 |
|
5374 |
" |
|
5375 |
|dialog| |
|
5376 |
||
5377 |
dialog := Dialog new. |
|
5378 |
dialog |
|
1401 | 5379 |
addRow:#('a' 'b' 'c' 'd') |
5380 |
fromX:0 |
|
5381 |
toX:1 |
|
5382 |
collect:[:label | Label label:label]. |
|
130 | 5383 |
|
5384 |
dialog addOkButton. |
|
5385 |
dialog open. |
|
5386 |
" |
|
5387 |
||
5388 |
" |
|
5389 |
|dialog| |
|
5390 |
||
5391 |
dialog := Dialog new. |
|
5392 |
dialog |
|
1401 | 5393 |
addRow:#('a1' 'b1' 'c1' 'd1') |
5394 |
fromX:0 |
|
5395 |
toX:1 |
|
5396 |
collect:[:label | Label label:label]. |
|
130 | 5397 |
|
5398 |
dialog |
|
1401 | 5399 |
addRow:#('a2' 'b2' 'c2' 'd2') |
5400 |
fromX:0 |
|
5401 |
toX:0.5 |
|
5402 |
collect:[:label | Label label:label]. |
|
130 | 5403 |
|
5404 |
dialog |
|
1401 | 5405 |
addRow:#('a3' 'b3' 'c3' 'd3') |
5406 |
fromX:0.5 |
|
5407 |
toX:1 |
|
5408 |
collect:[:label | Label label:label]. |
|
130 | 5409 |
|
5410 |
dialog addOkButton. |
|
5411 |
dialog open. |
|
5412 |
" |
|
344
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 |
"Modified: 9.2.1996 / 22:25:16 / cg" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5415 |
! |
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 |
addRow:aCol fromX:leftX toX:rightX collect:aBlock tabable:tabable |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5418 |
"add some elements in a horizontal row. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5419 |
Equally space elements as returned from aBlock. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5420 |
Advance y." |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5421 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5422 |
self |
1401 | 5423 |
addRow:aCol |
5424 |
fromX:leftX toX:rightX |
|
5425 |
collect:aBlock |
|
5426 |
tabable:tabable |
|
5427 |
horizontalLayout:#spread |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5428 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5429 |
"Created: 9.2.1996 / 22:25:35 / cg" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5430 |
! |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5431 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5432 |
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
|
5433 |
"add some elements in a horizontal row. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5434 |
Equally space elements as returned from aBlock. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5435 |
Advance y." |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5436 |
|
739
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
5437 |
^ self |
1401 | 5438 |
addRow:aCol |
5439 |
fromX:leftX toX:rightX |
|
5440 |
collect:aBlock |
|
5441 |
tabable:tabable |
|
5442 |
horizontalLayout:hLayout |
|
5443 |
verticalLayout:#fit |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5444 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5445 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5446 |
|dialog| |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5447 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5448 |
dialog := Dialog new. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5449 |
dialog |
1401 | 5450 |
addRow:#('a' 'b' 'c' 'd') |
5451 |
fromX:0 |
|
5452 |
toX:1 |
|
5453 |
collect:[:label | Label label:label] |
|
5454 |
tabable:false |
|
5455 |
horizontalLayout:#fit. |
|
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 |
dialog addOkButton. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5458 |
dialog open. |
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 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5461 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5462 |
|dialog| |
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 |
dialog := Dialog new. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5465 |
dialog |
1401 | 5466 |
addRow:#('one' 'two' 'three' 'four') |
5467 |
fromX:0 |
|
5468 |
toX:1 |
|
5469 |
collect:[:label | Button label:label] |
|
5470 |
tabable:false |
|
5471 |
horizontalLayout:#fit. |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5472 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5473 |
dialog addOkButton. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5474 |
dialog open. |
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 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5477 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5478 |
|dialog| |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5479 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5480 |
dialog := Dialog new. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5481 |
dialog |
1401 | 5482 |
addRow:#('a1' 'b1' 'c1' 'd1') |
5483 |
fromX:0 |
|
5484 |
toX:1 |
|
5485 |
collect:[:label | Label label:label]. |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5486 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5487 |
dialog |
1401 | 5488 |
addRow:#('a2' 'b2' 'c2' 'd2') |
5489 |
fromX:0 |
|
5490 |
toX:0.5 |
|
5491 |
collect:[:label | Label label:label]. |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5492 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5493 |
dialog |
1401 | 5494 |
addRow:#('a3' 'b3' 'c3' 'd3') |
5495 |
fromX:0.5 |
|
5496 |
toX:1 |
|
5497 |
collect:[:label | Label label:label]. |
|
344
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 |
dialog addOkButton. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5500 |
dialog open. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
5501 |
" |
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 |
"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
|
5504 |
"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
|
5505 |
! |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
5506 |
|
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
5507 |
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
|
5508 |
"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
|
5509 |
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
|
5510 |
Advance y." |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
5511 |
|
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
5512 |
|helper component| |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
5513 |
|
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
5514 |
helper := HorizontalPanelView new. |
792 | 5515 |
helper borderWidth:0. |
739
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
5516 |
|
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
5517 |
aCol do:[:el | |
1401 | 5518 |
component := aBlock value:el. |
5519 |
component resize. |
|
5520 |
helper add:component. |
|
5521 |
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
|
5522 |
]. |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
5523 |
|
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
5524 |
helper resize. |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
5525 |
self addComponent:helper. |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
5526 |
|
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
5527 |
width < helper preferredExtent x ifTrue:[ |
1401 | 5528 |
self width:helper preferredExtent x. |
5529 |
"/ 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
|
5530 |
]. |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
5531 |
hLayout notNil ifTrue:[ |
1401 | 5532 |
helper horizontalLayout:hLayout. |
739
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
5533 |
]. |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
5534 |
vLayout notNil ifTrue:[ |
1401 | 5535 |
helper verticalLayout:vLayout. |
739
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
5536 |
]. |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
5537 |
helper left:leftX asFloat; |
1401 | 5538 |
right:rightX asFloat. |
739
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
5539 |
|
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
5540 |
" |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
5541 |
|dialog| |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
5542 |
|
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
5543 |
dialog := Dialog new. |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
5544 |
dialog |
1401 | 5545 |
addRow:#('a' 'b' 'c' 'd') |
5546 |
fromX:0 |
|
5547 |
toX:1 |
|
5548 |
collect:[:label | Label label:label] |
|
5549 |
tabable:false |
|
5550 |
horizontalLayout:#fit. |
|
739
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
5551 |
|
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
5552 |
dialog addOkButton. |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
5553 |
dialog open. |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
5554 |
" |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
5555 |
|
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
5556 |
" |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
5557 |
|dialog| |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
5558 |
|
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
5559 |
dialog := Dialog new. |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
5560 |
dialog |
1401 | 5561 |
addRow:#('one' 'two' 'three' 'four') |
5562 |
fromX:0 |
|
5563 |
toX:1 |
|
5564 |
collect:[:label | Button label:label] |
|
5565 |
tabable:false |
|
5566 |
horizontalLayout:#fit. |
|
739
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
5567 |
|
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
5568 |
dialog addOkButton. |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
5569 |
dialog open. |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
5570 |
" |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
5571 |
|
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
5572 |
" |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
5573 |
|dialog| |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
5574 |
|
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
5575 |
dialog := Dialog new. |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
5576 |
dialog |
1401 | 5577 |
addRow:#('a1' 'b1' 'c1' 'd1') |
5578 |
fromX:0 |
|
5579 |
toX:1 |
|
5580 |
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
|
5581 |
|
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
5582 |
dialog |
1401 | 5583 |
addRow:#('a2' 'b2' 'c2' 'd2') |
5584 |
fromX:0 |
|
5585 |
toX:0.5 |
|
5586 |
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
|
5587 |
|
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
5588 |
dialog |
1401 | 5589 |
addRow:#('a3' 'b3' 'c3' 'd3') |
5590 |
fromX:0.5 |
|
5591 |
toX:1 |
|
5592 |
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
|
5593 |
|
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
5594 |
dialog addOkButton. |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
5595 |
dialog open. |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
5596 |
" |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
5597 |
|
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
5598 |
"Created: 31.5.1996 / 20:45:31 / cg" |
792 | 5599 |
"Modified: 17.7.1996 / 12:06:08 / cg" |
76 | 5600 |
! ! |
5601 |
||
551
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
5602 |
!DialogBox methodsFor:'explicit focus control'! |
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
5603 |
|
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
5604 |
focusOnOk |
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
5605 |
windowGroup focusView:okButton |
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
5606 |
|
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
5607 |
"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
|
5608 |
! ! |
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
5609 |
|
76 | 5610 |
!DialogBox methodsFor:'initialization'! |
5611 |
||
197 | 5612 |
focusSequence |
5613 |
"return the elements through which we can step via |
|
5614 |
NextField/PreviousField keys. |
|
5615 |
Here we return all tabable fields followed by all buttons in |
|
5616 |
the panel." |
|
5617 |
||
5618 |
|fields buttons| |
|
5619 |
||
5620 |
tabableElements isNil ifTrue:[ |
|
1843 | 5621 |
fields := #() |
197 | 5622 |
] ifFalse:[ |
1843 | 5623 |
fields := tabableElements |
197 | 5624 |
]. |
5625 |
buttonPanel notNil ifTrue:[ |
|
1843 | 5626 |
buttons := buttonPanel subViews. |
5627 |
buttons notNil ifTrue:[ |
|
5628 |
fields := fields , buttonPanel subViews |
|
5629 |
] |
|
197 | 5630 |
]. |
1843 | 5631 |
^ 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
|
5632 |
|
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
5633 |
"Modified: 31.5.1996 / 22:05:58 / cg" |
197 | 5634 |
! |
5635 |
||
76 | 5636 |
initialize |
5637 |
|mm| |
|
5638 |
||
5639 |
super initialize. |
|
5640 |
||
573 | 5641 |
"/ label := 'Dialog'. |
948 | 5642 |
acceptValue := ValueHolder newBoolean. |
76 | 5643 |
|
5644 |
mm := ViewSpacing. |
|
5645 |
||
5646 |
acceptReturnAsOK := true. |
|
125 | 5647 |
acceptOnLeave := true. |
1757 | 5648 |
focusToOKOnLeave := DefaultFocusToOKOnLeave. |
280
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
5649 |
hideOnAccept := true. |
469
1d86f97ab2e5
autoAccept as default; configurable
Claus Gittinger <cg@exept.de>
parents:
436
diff
changeset
|
5650 |
autoAccept := true. |
76 | 5651 |
|
5652 |
buttonPanel := HorizontalPanelView in:self. |
|
118 | 5653 |
buttonPanel |
1757 | 5654 |
origin:(0.0 @ 1.0) corner:(1.0 @ 1.0); |
5655 |
bottomInset:mm; |
|
5656 |
topInset:(font height + mm * 2) negated; |
|
5657 |
borderWidth:0; |
|
5658 |
horizontalLayout:#spread. |
|
118 | 5659 |
|
122 | 5660 |
yPosition := ViewSpacing. |
312
008267b920d9
allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
5661 |
leftIndent := rightIndent := (ViewSpacing // 2). |
310
4bbc8deffc8c
allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents:
307
diff
changeset
|
5662 |
needResize := true. |
76 | 5663 |
|
5664 |
" |
|
5665 |
|b| |
|
5666 |
b := DialogBox new. |
|
118 | 5667 |
b addAbortButton; |
5668 |
addOkButton; |
|
5669 |
showAtPointer |
|
76 | 5670 |
" |
5671 |
" |
|
5672 |
|b| |
|
5673 |
b := DialogBox new. |
|
118 | 5674 |
b addOkButton; |
5675 |
showAtPointer |
|
5676 |
" |
|
76 | 5677 |
" |
118 | 5678 |
|b| |
5679 |
b := DialogBox new. |
|
5680 |
b addTextLabel:'hello world'; |
|
5681 |
addOkButton; |
|
5682 |
showAtPointer |
|
5683 |
" |
|
5684 |
" |
|
5685 |
|b| |
|
5686 |
b := DialogBox new. |
|
5687 |
b addTextLabel:'hello world'; |
|
5688 |
addVerticalSpace:50; |
|
5689 |
addOkButton; |
|
5690 |
showAtPointer |
|
5691 |
" |
|
310
4bbc8deffc8c
allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents:
307
diff
changeset
|
5692 |
|
1614 | 5693 |
"Modified: / 23.12.1997 / 10:05:24 / md" |
5694 |
"Modified: / 27.7.1998 / 20:16:37 / cg" |
|
76 | 5695 |
! |
5696 |
||
5697 |
reAdjustGeometry |
|
5698 |
"sent late in snapin processing - gives me a chance |
|
5699 |
to resize for changed font dimensions." |
|
5700 |
||
5701 |
super reAdjustGeometry. |
|
5702 |
okButton notNil ifTrue:[okButton resize]. |
|
5703 |
abortButton notNil ifTrue:[abortButton resize]. |
|
5704 |
self resize |
|
5705 |
! ! |
|
5706 |
||
197 | 5707 |
!DialogBox methodsFor:'private'! |
5708 |
||
5709 |
basicAddComponent:aComponent |
|
5710 |
"add a component, dont change its size" |
|
5711 |
||
5712 |
addedComponents isNil ifTrue:[ |
|
5713 |
addedComponents := OrderedCollection new. |
|
5714 |
]. |
|
5715 |
addedComponents add:aComponent. |
|
5716 |
self addSubView:aComponent. |
|
5717 |
! |
|
5718 |
||
5719 |
hideAndEvaluate:aBlock |
|
5720 |
"if I am modal, make myself invisible and evaluate aBlock. |
|
5721 |
If nonModal, stay up, but also evaluate the block." |
|
5722 |
||
5723 |
(windowGroup notNil and:[windowGroup isModal]) ifTrue:[ |
|
5724 |
self hide. |
|
5725 |
]. |
|
5726 |
aBlock notNil ifTrue:[aBlock value] |
|
5727 |
||
5728 |
"Modified: 5.9.1995 / 19:06:33 / claus" |
|
5729 |
! |
|
5730 |
||
5731 |
realize |
|
5732 |
"if any inputFields where added, activate the first one" |
|
5733 |
||
5734 |
inputFieldGroup notNil ifTrue:[ |
|
1646 | 5735 |
inputFieldGroup activateFirstIfNoCurrent |
197 | 5736 |
]. |
5737 |
super realize |
|
1646 | 5738 |
|
5739 |
"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
|
5740 |
! |
4bbc8deffc8c
allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents:
307
diff
changeset
|
5741 |
|
4bbc8deffc8c
allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents:
307
diff
changeset
|
5742 |
resize |
4bbc8deffc8c
allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents:
307
diff
changeset
|
5743 |
needResize ifTrue:[ |
314
705185e7001d
no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents:
312
diff
changeset
|
5744 |
needResize := false. |
705185e7001d
no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents:
312
diff
changeset
|
5745 |
super resize |
310
4bbc8deffc8c
allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents:
307
diff
changeset
|
5746 |
] |
4bbc8deffc8c
allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents:
307
diff
changeset
|
5747 |
|
4bbc8deffc8c
allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents:
307
diff
changeset
|
5748 |
"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
|
5749 |
"Modified: 27.1.1996 / 18:25:40 / cg" |
197 | 5750 |
! ! |
5751 |
||
120 | 5752 |
!DialogBox methodsFor:'queries'! |
118 | 5753 |
|
121 | 5754 |
accepted |
128 | 5755 |
"after the box has closed: |
5756 |
return true if accepted, false if canceled" |
|
125 | 5757 |
|
128 | 5758 |
^ acceptValue value |
121 | 5759 |
! |
5760 |
||
120 | 5761 |
positionOffset |
5762 |
"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
|
5763 |
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
|
5764 |
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
|
5765 |
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
|
5766 |
use my superclasses offset." |
050fba15277a
DialogBoxes positionOffset now handles all common cases
Claus Gittinger <cg@exept.de>
parents:
950
diff
changeset
|
5767 |
|
050fba15277a
DialogBoxes positionOffset now handles all common cases
Claus Gittinger <cg@exept.de>
parents:
950
diff
changeset
|
5768 |
|idx butt buttons| |
050fba15277a
DialogBoxes positionOffset now handles all common cases
Claus Gittinger <cg@exept.de>
parents:
950
diff
changeset
|
5769 |
|
050fba15277a
DialogBoxes positionOffset now handles all common cases
Claus Gittinger <cg@exept.de>
parents:
950
diff
changeset
|
5770 |
buttonPanel notNil ifTrue:[ |
1401 | 5771 |
buttons := buttonPanel subViews. |
5772 |
buttons size > 0 ifTrue:[ |
|
5773 |
idx := buttons findFirst:[:b | b isReturnButton]. |
|
5774 |
idx ~~ 0 ifTrue:[ |
|
5775 |
butt := buttons at:idx. |
|
5776 |
||
5777 |
"get our size (preferredExtent) and compute |
|
5778 |
origin and extent of buttonPanel and okButton. |
|
5779 |
This is normally done on view realization." |
|
5780 |
||
5781 |
self resize. |
|
5782 |
buttonPanel pixelOrigin:buttonPanel computeOrigin. |
|
5783 |
buttonPanel pixelExtent:buttonPanel computeExtent. |
|
5784 |
buttonPanel setChildPositionsIfChanged. |
|
5785 |
||
5786 |
^ (butt originRelativeTo:self) + (butt extent // 2) |
|
5787 |
] |
|
5788 |
] |
|
118 | 5789 |
]. |
913 | 5790 |
|
953
050fba15277a
DialogBoxes positionOffset now handles all common cases
Claus Gittinger <cg@exept.de>
parents:
950
diff
changeset
|
5791 |
^ super positionOffset |
912
310c4970e613
Fix #positionOffset to show 'senders' box with cursor on ok-button.
Stefan Vogel <sv@exept.de>
parents:
884
diff
changeset
|
5792 |
|
913 | 5793 |
"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
|
5794 |
"Modified: 16.1.1997 / 22:00:23 / cg" |
118 | 5795 |
! |
5796 |
||
130 | 5797 |
preferredExtent |
132 | 5798 |
"return my preferred extent. |
5799 |
That is the max component width, or my current width (default); |
|
5800 |
whichever is larger, by the sum of the components heights." |
|
118 | 5801 |
|
120 | 5802 |
|w h p| |
118 | 5803 |
|
797 | 5804 |
"/ If I have an explicit preferredExtent .. |
5805 |
||
713
0c38ad51016d
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
680
diff
changeset
|
5806 |
preferredExtent notNil ifTrue:[ |
1401 | 5807 |
^ preferredExtent |
713
0c38ad51016d
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
680
diff
changeset
|
5808 |
]. |
0c38ad51016d
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
680
diff
changeset
|
5809 |
|
120 | 5810 |
addedComponents notNil ifTrue:[ |
1401 | 5811 |
w := addedComponents |
5812 |
inject:0 |
|
5813 |
into:[:max :element | |
|
5814 |
|eExt prefWidth scale rel relX| |
|
5815 |
||
5816 |
prefWidth := element preferredExtent x. |
|
5817 |
||
5818 |
"/ special (for your convenience) |
|
5819 |
"/ if the element has been added with a relative width, |
|
5820 |
"/ scale it to get at least its preferred width |
|
5821 |
||
5822 |
(rel := element relativeExtent) notNil ifTrue:[ |
|
5823 |
relX := rel x. |
|
5824 |
(relX isNil or:[relX isInteger]) ifFalse:[ |
|
5825 |
prefWidth := (prefWidth * (1 / relX)) rounded |
|
5826 |
]. |
|
5827 |
]. |
|
5828 |
eExt := prefWidth + (element borderWidth * 2). "/ max:element extent x. |
|
5829 |
max max:(eExt + element leftInset + element rightInset)]. |
|
120 | 5830 |
] ifFalse:[ |
1401 | 5831 |
w := super preferredExtent x. |
120 | 5832 |
]. |
132 | 5833 |
w := w max:width. |
310
4bbc8deffc8c
allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents:
307
diff
changeset
|
5834 |
h := yPosition + ViewSpacing. |
118 | 5835 |
|
130 | 5836 |
buttonPanel subViews size ~~ 0 ifTrue:[ |
1401 | 5837 |
p := buttonPanel preferredExtent. |
5838 |
w := w max:p x. |
|
5839 |
h := h |
|
5840 |
+ p y |
|
5841 |
+ ViewSpacing. |
|
120 | 5842 |
]. |
118 | 5843 |
|
120 | 5844 |
"/ okButton isNil ifTrue:[ |
130 | 5845 |
"/ ^ super preferredExtent |
120 | 5846 |
"/ ]. |
130 | 5847 |
"/ p := buttonPanel preferredExtent. |
120 | 5848 |
"/ w := p x. |
5849 |
"/ h := ViewSpacing |
|
5850 |
"/ + p y |
|
5851 |
"/ + ViewSpacing. |
|
5852 |
"/ |
|
5853 |
^ w @ h |
|
310
4bbc8deffc8c
allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents:
307
diff
changeset
|
5854 |
|
797 | 5855 |
"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
|
5856 |
! ! |
4bbc8deffc8c
allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents:
307
diff
changeset
|
5857 |
|
197 | 5858 |
!DialogBox methodsFor:'user actions'! |
76 | 5859 |
|
197 | 5860 |
abortPressed |
5861 |
"sent by the cancel button; user pressed abort button |
|
5862 |
- hide myself and evaluate okAction" |
|
121 | 5863 |
|
197 | 5864 |
abortButton turnOffWithoutRedraw. |
5865 |
acceptValue value:false. |
|
121 | 5866 |
|
197 | 5867 |
"/ actually, only hides if I have been opened modal |
5868 |
self hideAndEvaluate:abortAction |
|
121 | 5869 |
! |
5870 |
||
197 | 5871 |
doAccept |
5872 |
"let all components accept (i.e. update their model from the values), |
|
5873 |
then set my accept value to true. |
|
5874 |
This is confusing: this method was originally called #accept, |
|
5875 |
but renamed for compatibility with ST-80, where #accept returns the |
|
5876 |
accept-valueHolder (which looks like a bad name to me ...)." |
|
76 | 5877 |
|
469
1d86f97ab2e5
autoAccept as default; configurable
Claus Gittinger <cg@exept.de>
parents:
436
diff
changeset
|
5878 |
autoAccept ifTrue:[ |
1401 | 5879 |
addedComponents notNil ifTrue:[ |
5880 |
addedComponents do:[:aComponent | |
|
5881 |
(aComponent respondsTo:#accept) ifTrue:[ |
|
5882 |
aComponent accept |
|
5883 |
] |
|
5884 |
] |
|
5885 |
]. |
|
197 | 5886 |
]. |
5887 |
acceptValue value:true. |
|
469
1d86f97ab2e5
autoAccept as default; configurable
Claus Gittinger <cg@exept.de>
parents:
436
diff
changeset
|
5888 |
|
1d86f97ab2e5
autoAccept as default; configurable
Claus Gittinger <cg@exept.de>
parents:
436
diff
changeset
|
5889 |
"Modified: 4.3.1996 / 12:14:56 / cg" |
128 | 5890 |
! |
5891 |
||
197 | 5892 |
keyPress:aKey x:x y:y |
5893 |
"return-key dublicates ok-function if acceptReturnAsOK is true" |
|
76 | 5894 |
|
490 | 5895 |
<resource: #keyboard (#Return)> |
5896 |
||
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
|
5897 |
(aKey == #Return) ifTrue:[ |
1401 | 5898 |
(okButton notNil and:[okButton isReturnButton]) ifTrue:[ |
5899 |
^ self okPressed |
|
5900 |
]. |
|
5901 |
(abortButton notNil and:[abortButton isReturnButton]) ifTrue:[ |
|
5902 |
^ self abortPressed |
|
5903 |
]. |
|
197 | 5904 |
]. |
5905 |
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
|
5906 |
|
490 | 5907 |
"Modified: 7.3.1996 / 13:15:09 / cg" |
76 | 5908 |
! |
5909 |
||
197 | 5910 |
lastFieldLeft |
5911 |
"if the dialog involves input fields, this is called |
|
5912 |
when the last field is left by Return-key or NextField-key" |
|
120 | 5913 |
|
197 | 5914 |
acceptOnLeave ifTrue:[ |
1401 | 5915 |
acceptReturnAsOK ifTrue:[ |
5916 |
focusToOKOnLeave ifTrue:[ |
|
5917 |
self focusOnOk. |
|
5918 |
^ self. |
|
5919 |
]. |
|
5920 |
self okPressed |
|
5921 |
] |
|
197 | 5922 |
]. |
280
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
5923 |
inputFieldGroup activateFirst |
357
732f59def851
care for acceptReturnAsOK being false and return being pressed
Claus Gittinger <cg@exept.de>
parents:
356
diff
changeset
|
5924 |
|
551
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
5925 |
"Modified: 19.4.1996 / 17:09:02 / cg" |
76 | 5926 |
! |
5927 |
||
197 | 5928 |
okPressed |
5929 |
"sent by the okButton; user pressed ok-button |
|
5930 |
- make myself invisible and if an action was specified do it" |
|
128 | 5931 |
|
197 | 5932 |
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
|
5933 |
|
197 | 5934 |
self doAccept. |
5935 |
||
280
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
5936 |
acceptCheck notNil ifTrue:[ |
302 | 5937 |
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
|
5938 |
]. |
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
5939 |
|
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
5940 |
hideOnAccept ifTrue:[ |
302 | 5941 |
"/ actually, only hides if I have been opened modal |
5942 |
self hideAndEvaluate:okAction. |
|
280
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
5943 |
] ifFalse:[ |
302 | 5944 |
okAction value |
280
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
5945 |
] |
128 | 5946 |
! ! |
240 | 5947 |
|
846
75c5dc601522
added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents:
831
diff
changeset
|
5948 |
!DialogBox class methodsFor:'documentation'! |
240 | 5949 |
|
5950 |
version |
|
1843 | 5951 |
^ '$Header: /cvs/stx/stx/libwidg/DialogBox.st,v 1.133 1999-04-15 12:33:52 cg Exp $' |
240 | 5952 |
! ! |
498 | 5953 |
DialogBox initialize! |