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