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