author | Claus Gittinger <cg@exept.de> |
Wed, 29 May 1996 15:28:01 +0200 | |
changeset 719 | 574be1981be0 |
parent 718 | bd04131f84c8 |
child 735 | 2552463a8f34 |
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 |
f071ff350cd5
added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents:
241
diff
changeset
|
15 |
acceptReturnAsOK yPosition leftIndent rightIndent bindings |
f071ff350cd5
added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents:
241
diff
changeset
|
16 |
addedComponents inputFieldGroup acceptOnLeave acceptValue |
551
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
17 |
tabableElements hideOnAccept acceptCheck needResize autoAccept |
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
18 |
focusToOKOnLeave' |
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 |
||
24 |
!DialogBox class methodsFor:'documentation'! |
|
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. |
|
122 | 52 |
Caveat: more adding support is required - especially for row-wise |
53 |
construction. |
|
54 |
||
600 | 55 |
Compatibility note: |
56 |
For ST-80 compatibility, DialogBox is also accessable under |
|
57 |
the global named 'Dialog' (which is the name of an ST-80 class, |
|
58 |
providing a very similar protocol). |
|
59 |
This may lead to confusion, if DialogBox is recompiled - you have |
|
60 |
to manually assign Dialog again to refer to the new DialogBox class. |
|
61 |
In future versions of ST/X, DialogBox may be renamed to Dialog. |
|
62 |
||
183 | 63 |
Historic note: |
356 | 64 |
originally, ST/X had separate classes for the various entry methods; |
65 |
there were YesNoBox, EnterBox, InfoBox and so on. |
|
66 |
ST-80 has all this defined in the common Dialog. |
|
67 |
Therefore, for compatibility, many ST/X methods defined here in Dialogs |
|
68 |
class protocol simply dispatch to some other boxes class method. |
|
69 |
In the future, those existing subclasses' functionality is going to |
|
70 |
be moved full into Dialog, and the subclasses will be replaced by dummy |
|
71 |
delegators. (They will be kept for backward compatibility, though). |
|
183 | 72 |
|
121 | 73 |
|
585 | 74 |
[instance variables:] |
76 | 75 |
|
356 | 76 |
buttonPanel <PanelView> contains the button(s) |
77 |
||
78 |
okButton <Button> the ok-Button |
|
79 |
||
80 |
okAction <Block> the action to be performed when ok is pressed, |
|
81 |
or return is pressed. |
|
82 |
||
83 |
acceptReturnAsOK <Boolean> if true, pressing the return-key counts |
|
84 |
as if ok was pressed. Default is true. |
|
85 |
||
86 |
abortButton <Button> the cancel-Button |
|
87 |
||
88 |
abortAction <Block> the action to be performed when cancel is |
|
89 |
pressed. |
|
90 |
||
91 |
yPosisition <Integer> current y position when adding components |
|
92 |
||
93 |
leftIndent <Integer> left inset to use when adding components |
|
94 |
||
95 |
rightIndent <Integer> right inset to use when adding components |
|
96 |
||
97 |
addedComponents <Collection> programmatically added components |
|
98 |
||
99 |
inputFieldGroup <EnterFieldGroup> |
|
100 |
for added input fields |
|
101 |
||
102 |
acceptOnLeave <Boolean> if true (the default) and there are |
|
103 |
tabable inputFields, accept and close when |
|
104 |
the last field is left. If false, the ok |
|
105 |
button must be pressed to close the box. |
|
106 |
||
107 |
acceptedValue v(<Boolean>) valueHolder on a boolean |
|
108 |
after close: holds true if box was accepted |
|
109 |
(i.e. ok-Button was pressed), false if box was |
|
110 |
closed via cancel or window manager. |
|
121 | 111 |
|
469
1d86f97ab2e5
autoAccept as default; configurable
Claus Gittinger <cg@exept.de>
parents:
436
diff
changeset
|
112 |
autoAccept Boolean if true, pressing ok (or return) |
1d86f97ab2e5
autoAccept as default; configurable
Claus Gittinger <cg@exept.de>
parents:
436
diff
changeset
|
113 |
sends #accept to all subcomponents. |
1d86f97ab2e5
autoAccept as default; configurable
Claus Gittinger <cg@exept.de>
parents:
436
diff
changeset
|
114 |
I.e. all subfields update their models |
1d86f97ab2e5
autoAccept as default; configurable
Claus Gittinger <cg@exept.de>
parents:
436
diff
changeset
|
115 |
first. The default is true. |
1d86f97ab2e5
autoAccept as default; configurable
Claus Gittinger <cg@exept.de>
parents:
436
diff
changeset
|
116 |
|
100 | 117 |
For compatibility with ST-80, this class is also available under |
118 |
the global names DialogView and Dialog (see patches file). |
|
585 | 119 |
|
120 |
[author:] |
|
121 |
Claus Gittinger |
|
593 | 122 |
|
123 |
[see also:] |
|
124 |
Button CheckToggle Toggle |
|
125 |
EditField SelectionInListView FileSelectionList |
|
126 |
FramedBox Separator |
|
127 |
( introduction to view programming :html: programming/viewintro.html ) |
|
76 | 128 |
" |
129 |
! |
|
130 |
||
131 |
examples |
|
132 |
" |
|
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
133 |
historically, DialogBox was used as an abstract class as a base for InfoBox, |
600 | 134 |
YesNoBox etc. |
135 |
However, the programmatic construction protocol (#addComponent:) |
|
136 |
now allows those classes to be easily replaced and future versions of |
|
137 |
ST/X may do this and make those subclasses obsolete. |
|
138 |
However, dummy stubs will remain to exist for backward compatibility |
|
139 |
(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
|
140 |
|
125 | 141 |
For most simple standard dialogs, there are ready to use |
142 |
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
|
143 |
|
125 | 144 |
For example: |
145 |
||
146 |
info & warnings: |
|
593 | 147 |
[exBegin] |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
148 |
Dialog information:'hi there' |
593 | 149 |
[exEnd] |
150 |
[exBegin] |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
151 |
Dialog warn:'oops' |
593 | 152 |
[exEnd] |
125 | 153 |
|
154 |
||
155 |
yes/no questions: |
|
593 | 156 |
[exBegin] |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
157 |
(Dialog confirm:'is this simple ?') |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
158 |
ifTrue:[ |
655 | 159 |
Transcript showCR:'thats what I expected' |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
160 |
] ifFalse:[ |
655 | 161 |
Transcript showCR:'read more examples and documentation' |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
162 |
] |
593 | 163 |
[exEnd] |
125 | 164 |
|
165 |
||
166 |
yes/no question with cancel option: |
|
593 | 167 |
[exBegin] |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
168 |
|answer| |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
169 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
170 |
answer := Dialog confirmWithCancel:'is this simple ?'. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
171 |
answer isNil ifTrue:[ |
655 | 172 |
Transcript showCR:'no easy decision' |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
173 |
] ifFalse:[ |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
174 |
answer ifTrue:[ |
655 | 175 |
Transcript showCR:'thats what I expected' |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
176 |
] ifFalse:[ |
655 | 177 |
Transcript showCR:'read more examples and documentation' |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
178 |
] |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
179 |
] |
593 | 180 |
[exEnd] |
125 | 181 |
|
182 |
||
183 |
asking for a string: |
|
593 | 184 |
[exBegin] |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
185 |
|s| |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
186 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
187 |
s := Dialog request:'enter your name, please:'. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
188 |
s notEmpty ifTrue:[ |
655 | 189 |
Transcript showCR:'you entered: ' , s. |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
190 |
] |
593 | 191 |
[exEnd] |
125 | 192 |
|
193 |
||
194 |
asking for a string with given default: |
|
593 | 195 |
[exBegin] |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
196 |
|s| |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
197 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
198 |
s := Dialog |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
199 |
request:'enter your name, please:' |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
200 |
initialAnswer:(OperatingSystem getLoginName). |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
201 |
s notEmpty ifTrue:[ |
655 | 202 |
Transcript showCR:'you entered: ' , s. |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
203 |
] |
593 | 204 |
[exEnd] |
125 | 205 |
|
206 |
||
207 |
asking for a filename: |
|
593 | 208 |
[exBegin] |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
209 |
|s| |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
210 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
211 |
s := Dialog |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
212 |
requestFileName:'select a file, please:' |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
213 |
default:''. |
655 | 214 |
Transcript show:'you entered: '; showCR:s. |
593 | 215 |
[exEnd] |
125 | 216 |
|
217 |
||
218 |
with changed button label and pattern: |
|
593 | 219 |
[exBegin] |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
220 |
|s| |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
221 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
222 |
s := Dialog |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
223 |
requestFileName:'select a file, please:' |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
224 |
default:'' |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
225 |
ok:'show' |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
226 |
abort:'cancel' |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
227 |
pattern:'*.rc'. |
655 | 228 |
Transcript show:'you entered: '; showCR:s. |
593 | 229 |
[exEnd] |
125 | 230 |
|
302 | 231 |
|
232 |
asking for a password: |
|
593 | 233 |
[exBegin] |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
234 |
|s| |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
235 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
236 |
s := Dialog |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
237 |
requestPassword:'enter your secret, please:'. |
655 | 238 |
Transcript show:'you entered: '; showCR:s. |
593 | 239 |
[exEnd] |
302 | 240 |
|
645 | 241 |
multiple choice dialogs: |
242 |
[exBegin] |
|
243 |
Dialog |
|
244 |
choose:'choose any' |
|
245 |
fromList:nil |
|
246 |
values:nil |
|
247 |
buttons:#('one' 'two' 'three' 'four') |
|
248 |
values:#(1 2 3 4) |
|
249 |
lines:nil |
|
250 |
cancel:nil |
|
251 |
[exEnd] |
|
252 |
||
253 |
multiple choice dialog, with list & buttons: |
|
254 |
[exBegin] |
|
655 | 255 |
Transcript showCR:( |
645 | 256 |
Dialog |
257 |
choose:'choose example' |
|
258 |
fromList:#('one' 'two' 'three' 'four') |
|
259 |
values:#(1 2 3 4) |
|
260 |
buttons:#('five' 'six' 'seven') |
|
261 |
values:#(5 6 7) |
|
262 |
lines:4 |
|
263 |
cancel:[Transcript flash. #aborted] |
|
264 |
) |
|
265 |
[exEnd] |
|
266 |
||
267 |
You can (and often have to) construct custom dialogs programmatically, |
|
268 |
from individual components. As shown in the following examples: |
|
91 | 269 |
|
121 | 270 |
basic (unusable) example: |
593 | 271 |
[exBegin] |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
272 |
DialogBox new open |
593 | 273 |
[exEnd] |
76 | 274 |
|
121 | 275 |
still unusable - only an ok-button: |
593 | 276 |
[exBegin] |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
277 |
DialogBox new addOkButton; open |
593 | 278 |
[exEnd] |
121 | 279 |
|
280 |
both ok- and abortButtons: |
|
593 | 281 |
[exBegin] |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
282 |
DialogBox new addAbortButton; addOkButton; open |
593 | 283 |
[exEnd] |
121 | 284 |
|
122 | 285 |
with different ok-label: |
593 | 286 |
[exBegin] |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
287 |
DialogBox new addAbortButton; addOkButtonLabelled:'yeah'; open |
593 | 288 |
[exEnd] |
122 | 289 |
|
645 | 290 |
adding a (centered by default) textlabel gives an infoBox: |
593 | 291 |
[exBegin] |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
292 |
DialogBox new |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
293 |
addTextLabel:'hello'; |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
294 |
addOkButton; |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
295 |
open |
593 | 296 |
[exEnd] |
121 | 297 |
|
298 |
a textlabel with abort- and okButton gives a yesNoBox: |
|
593 | 299 |
[exBegin] |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
300 |
DialogBox new |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
301 |
addTextLabel:'hello'; |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
302 |
addAbortButton; |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
303 |
addOkButton; |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
304 |
open |
593 | 305 |
[exEnd] |
121 | 306 |
|
307 |
the same, adjusting the labels contents to the left: |
|
593 | 308 |
[exBegin] |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
309 |
|box| |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
310 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
311 |
box := DialogBox new. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
312 |
(box addTextLabel:'hello') adjust:#left. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
313 |
box addAbortButton; |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
314 |
addOkButton; |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
315 |
open |
593 | 316 |
[exEnd] |
121 | 317 |
|
122 | 318 |
with modified buttons: |
593 | 319 |
[exBegin] |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
320 |
|box| |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
321 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
322 |
box := DialogBox new. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
323 |
(box addTextLabel:'are you certain ?') adjust:#left. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
324 |
box addAbortButtonLabelled:'not really'. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
325 |
(box addOkButtonLabelled:'yes, absolutely') |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
326 |
activeBackgroundColor:Color red. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
327 |
box open |
593 | 328 |
[exEnd] |
122 | 329 |
|
330 |
||
645 | 331 |
mswindows style (different up/down bitmaps in buttons): |
332 |
((try tabbing ...) |
|
593 | 333 |
[exBegin] |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
334 |
|b box| |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
335 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
336 |
box := DialogBox new. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
337 |
(box addTextLabel:'are you certain ?') adjust:#left. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
338 |
b := Button new. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
339 |
b activeLogo:(Image fromFile:'bitmaps/cancel_down.bmp'). |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
340 |
b passiveLogo:(Image fromFile:'bitmaps/cancel_up.bmp'). |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
341 |
b focusLogo:(Image fromFile:'bitmaps/cancel_focus.bmp'). |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
342 |
b beImageButton. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
343 |
box addAbortButton:b. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
344 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
345 |
b := Button new. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
346 |
b activeLogo:(Image fromFile:'bitmaps/ok_down.bmp'). |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
347 |
b passiveLogo:(Image fromFile:'bitmaps/ok_up.bmp'). |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
348 |
b focusLogo:(Image fromFile:'bitmaps/ok_focus.bmp'). |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
349 |
b beImageButton. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
350 |
box addOkButton:b. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
351 |
box open |
593 | 352 |
[exEnd] |
162 | 353 |
|
354 |
||
121 | 355 |
two textlabels: |
593 | 356 |
[exBegin] |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
357 |
DialogBox new |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
358 |
addTextLabel:'hello'; |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
359 |
addTextLabel:'world'; |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
360 |
addAbortButton; |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
361 |
addOkButton; |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
362 |
open |
593 | 363 |
[exEnd] |
118 | 364 |
|
121 | 365 |
fixing the dialogs size (suppres it calculating its size from the |
130 | 366 |
preferredExtents of its components): |
593 | 367 |
[exBegin] |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
368 |
DialogBox new |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
369 |
label:'a simple dialog'; |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
370 |
addTextLabel:'hello'; |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
371 |
addAbortButton; |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
372 |
addOkButton; |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
373 |
extent:200@200; |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
374 |
sizeFixed:true; |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
375 |
open |
593 | 376 |
[exEnd] |
118 | 377 |
|
121 | 378 |
asking the box if it was closed via ok: |
593 | 379 |
[exBegin] |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
380 |
(DialogBox new |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
381 |
label:'a simple dialog'; |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
382 |
addTextLabel:'hello'; |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
383 |
addAbortButton; |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
384 |
addOkButton; |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
385 |
extent:200@200; |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
386 |
sizeFixed:true; |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
387 |
open |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
388 |
) accepted ifTrue:[ |
655 | 389 |
Transcript showCR:'yes' |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
390 |
] ifFalse:[ |
655 | 391 |
Transcript showCR:'no' |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
392 |
] |
593 | 393 |
[exEnd] |
118 | 394 |
|
121 | 395 |
textLabels are not limited to strings (although, the name which is |
396 |
used for ST-80 compatibility, suggests it): |
|
593 | 397 |
[exBegin] |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
398 |
DialogBox new |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
399 |
addTextLabel:(Image fromFile:'bitmaps/garfield.gif'); |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
400 |
addOkButton; |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
401 |
open |
593 | 402 |
[exEnd] |
403 |
||
404 |
[exBegin] |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
405 |
DialogBox new |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
406 |
addTextLabel:'hello'; |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
407 |
addTextLabel:((Image fromFile:'bitmaps/garfield.gif') |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
408 |
magnifiedTo:200@150); |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
409 |
addTextLabel:'world'; |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
410 |
addAbortButton; |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
411 |
addOkButton; |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
412 |
open |
593 | 413 |
[exEnd] |
120 | 414 |
|
121 | 415 |
adding an input field (on a string model): |
593 | 416 |
[exBegin] |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
417 |
|stringModel| |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
418 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
419 |
stringModel := '' asValue. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
420 |
(DialogBox new |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
421 |
addTextLabel:'Please enter a string:'; |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
422 |
addInputFieldOn:stringModel; |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
423 |
addAbortButton; |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
424 |
addOkButton; |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
425 |
open |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
426 |
) accepted ifTrue:[ |
655 | 427 |
Transcript showCR:'entered: ', stringModel value |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
428 |
] |
593 | 429 |
[exEnd] |
120 | 430 |
|
431 |
||
121 | 432 |
multiple input fields (notice, that the dialog connects the fields |
433 |
in a group, so stepping is allowed via Cursor and Return keys): |
|
593 | 434 |
[exBegin] |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
435 |
|firstName lastName| |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
436 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
437 |
firstName := '' asValue. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
438 |
lastName := '' asValue. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
439 |
(DialogBox new |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
440 |
addTextLabel:'Please enter your name:'; |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
441 |
addInputFieldOn:firstName; |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
442 |
addVerticalSpace; |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
443 |
addInputFieldOn:lastName; |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
444 |
addAbortButton; |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
445 |
addOkButton; |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
446 |
open |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
447 |
) accepted ifTrue:[ |
655 | 448 |
Transcript showCR:'entered: ', firstName value , ' ' , lastName value |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
449 |
] |
593 | 450 |
[exEnd] |
121 | 451 |
|
452 |
||
453 |
of course, the model may contain a value initially: |
|
593 | 454 |
[exBegin] |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
455 |
|firstName lastName p line i name| |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
456 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
457 |
firstName := '' asValue. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
458 |
lastName := '' asValue. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
459 |
p := PipeStream readingFrom:'finger ' , OperatingSystem getLoginName. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
460 |
p notNil ifTrue:[ |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
461 |
line := p nextLine. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
462 |
(i := line findString:'Name:') ~~ 0 ifTrue:[ |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
463 |
name := line copyFrom:(i + 'Name:' size). |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
464 |
] ifFalse:[ |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
465 |
(i := line findString:'real life:') == 0 ifTrue:[ |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
466 |
line := p nextLine. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
467 |
]. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
468 |
(i := line findString:'real life:') ~~ 0 ifTrue:[ |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
469 |
name := line copyFrom:(i + 'real life:' size). |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
470 |
] |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
471 |
]. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
472 |
name notNil ifTrue:[ |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
473 |
firstName value: name asCollectionOfWords first. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
474 |
lastName value: name asCollectionOfWords last. |
655 | 475 |
Transcript showCR:'initially ' , firstName value , ' ' , lastName value. |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
476 |
]. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
477 |
p close. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
478 |
]. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
479 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
480 |
(DialogBox new |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
481 |
addTextLabel:'Please enter your name:'; |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
482 |
addInputFieldOn:firstName; |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
483 |
addVerticalSpace; |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
484 |
addInputFieldOn:lastName; |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
485 |
addAbortButton; |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
486 |
addOkButton; |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
487 |
open |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
488 |
) accepted ifTrue:[ |
655 | 489 |
Transcript showCR:'entered: ', firstName value , ' ' , lastName value |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
490 |
] |
593 | 491 |
[exEnd] |
121 | 492 |
|
120 | 493 |
|
302 | 494 |
validated password entry: |
593 | 495 |
[exBegin] |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
496 |
|box firstEntry secondEntry| |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
497 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
498 |
firstEntry := '' asValue. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
499 |
secondEntry := '' asValue. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
500 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
501 |
box := DialogBox new. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
502 |
(box addTextLabel:'Please enter your secret:') adjust:#left. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
503 |
(box addInputFieldOn:firstEntry) passwordCharacter:$*. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
504 |
box addVerticalSpace. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
505 |
(box addInputFieldOn:secondEntry) passwordCharacter:$*. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
506 |
box addAbortButton. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
507 |
box addOkButton. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
508 |
box open. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
509 |
box accepted ifTrue:[ |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
510 |
firstEntry value ~= secondEntry value ifTrue:[ |
655 | 511 |
Transcript showCR:'wrong input - try again' |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
512 |
] ifFalse:[ |
655 | 513 |
Transcript showCR:'entered: ', firstEntry value |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
514 |
] |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
515 |
] |
593 | 516 |
[exEnd] |
517 |
||
518 |
input fields with a label: |
|
519 |
[exBegin] |
|
520 |
|box firstNameHolder middleNameHolder lastNameHolder| |
|
521 |
||
522 |
firstNameHolder := 'John' asValue. |
|
523 |
middleNameHolder := 'F' asValue. |
|
524 |
lastNameHolder := 'Peters' asValue. |
|
525 |
||
526 |
box := DialogBox new. |
|
527 |
box |
|
528 |
addLabelledInputField:'first name:' |
|
529 |
adjust:#right |
|
530 |
on:firstNameHolder |
|
531 |
tabable:true |
|
532 |
separateAtX:0.4. |
|
533 |
||
534 |
box |
|
535 |
addLabelledInputField:'middle initial:' |
|
536 |
adjust:#right |
|
537 |
on:middleNameHolder |
|
538 |
tabable:true |
|
539 |
separateAtX:0.4. |
|
540 |
||
541 |
box |
|
542 |
addLabelledInputField:'last name:' |
|
543 |
adjust:#right |
|
544 |
on:lastNameHolder |
|
545 |
tabable:true |
|
546 |
separateAtX:0.4. |
|
547 |
||
548 |
box addOkButton. |
|
549 |
box open. |
|
550 |
[exEnd] |
|
551 |
||
552 |
||
553 |
constructing a dialog from other elements: |
|
121 | 554 |
adding a fileSelectionList: |
555 |
(since the dialog adds the component with its preferred extent, |
|
556 |
ignoring the 300-height, this looks ugly ... |
|
557 |
... especially when resized vertically) |
|
593 | 558 |
[exBegin] |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
559 |
|top l scr fileName| |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
560 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
561 |
fileName := '' asValue. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
562 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
563 |
top := DialogBox new. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
564 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
565 |
l := FileSelectionList new. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
566 |
l useIndex:false. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
567 |
l doubleClickAction:[:name | top okPressed]. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
568 |
l action:[:name | fileName value:name]. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
569 |
scr := ScrollableView forView:l. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
570 |
scr extent:(1.0 @ 300). |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
571 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
572 |
top addComponent:scr. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
573 |
top addAbortButton; addOkButton. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
574 |
top openModal. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
575 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
576 |
top accepted ifTrue:[ |
655 | 577 |
Transcript show:'fileName: '; showCR:fileName value storeString. |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
578 |
] |
593 | 579 |
[exEnd] |
121 | 580 |
|
581 |
same, looks better, since the height is made larger (not using |
|
582 |
fileLists preferredExtent): |
|
593 | 583 |
[exBegin] |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
584 |
|top l scr fileName| |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
585 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
586 |
fileName := '' asValue. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
587 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
588 |
top := DialogBox new. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
589 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
590 |
l := FileSelectionList new. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
591 |
l useIndex:false. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
592 |
l doubleClickAction:[:name | top okPressed]. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
593 |
l action:[:name | fileName value:name]. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
594 |
scr := ScrollableView forView:l. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
595 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
596 |
top addComponent:scr withExtent:300@300. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
597 |
top addAbortButton; addOkButton. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
598 |
top openModal. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
599 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
600 |
top accepted ifTrue:[ |
655 | 601 |
Transcript show:'fileName: '; showCR:fileName value storeString. |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
602 |
] |
593 | 603 |
[exEnd] |
121 | 604 |
|
605 |
||
606 |
again, setting the boxes initial size and fixing it |
|
130 | 607 |
(let it ignore the components' preferredExtent): |
593 | 608 |
[exBegin] |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
609 |
|top fixFrame l scr fileName| |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
610 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
611 |
fileName := '' asValue. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
612 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
613 |
top := DialogBox new. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
614 |
top extent:300@300. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
615 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
616 |
fixFrame := View new. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
617 |
fixFrame extent:(1.0 @ 300). |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
618 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
619 |
l := FileSelectionList new. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
620 |
l useIndex:false. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
621 |
l doubleClickAction:[:name | top okPressed]. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
622 |
l action:[:name | fileName value:name]. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
623 |
scr := ScrollableView forView:l. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
624 |
scr origin:0.0@0.0 corner:1.0@1.0. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
625 |
fixFrame add:scr. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
626 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
627 |
top addComponent:fixFrame. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
628 |
top addAbortButton; addOkButton. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
629 |
top openModal. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
630 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
631 |
top accepted ifTrue:[ |
655 | 632 |
Transcript show:'fileName: '; showCR:fileName value storeString. |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
633 |
] |
593 | 634 |
[exEnd] |
118 | 635 |
|
636 |
||
637 |
adding a panel with checkBoxes: |
|
593 | 638 |
[exBegin] |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
639 |
|top panel b value1 value2 value3 value4| |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
640 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
641 |
value1 := true asValue. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
642 |
value2 := false asValue. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
643 |
value3 := false asValue. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
644 |
value4 := true asValue. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
645 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
646 |
top := DialogBox new. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
647 |
top extent:200@300. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
648 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
649 |
panel := VerticalPanelView new. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
650 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
651 |
b := CheckBox on:value1. b label:'check1'. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
652 |
panel addSubView:b. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
653 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
654 |
b := CheckBox on:value2. b label:'check2'. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
655 |
panel addSubView:b. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
656 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
657 |
b := CheckBox on:value3. b label:'check3'. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
658 |
panel addSubView:b. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
659 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
660 |
b := CheckBox on:value4. b label:'check4'. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
661 |
panel addSubView:b. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
662 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
663 |
top addComponent:panel. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
664 |
top addAbortButton; addOkButton. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
665 |
top open. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
666 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
667 |
top accepted ifTrue:[ |
655 | 668 |
Transcript show:'value1: '; showCR:value1 value. |
669 |
Transcript show:'value2: '; showCR:value2 value. |
|
670 |
Transcript show:'value3: '; showCR:value3 value. |
|
671 |
Transcript show:'value4: '; showCR:value4 value. |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
672 |
] |
593 | 673 |
[exEnd] |
118 | 674 |
|
120 | 675 |
same, using a more convenient interface: |
593 | 676 |
[exBegin] |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
677 |
|box value1 value2 value3 value4| |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
678 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
679 |
value1 := true asValue. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
680 |
value2 := false asValue. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
681 |
value3 := false asValue. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
682 |
value4 := true asValue. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
683 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
684 |
box := DialogBox new. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
685 |
box extent:200@300. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
686 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
687 |
box addCheckBox:'check1' on:value1. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
688 |
box addVerticalSpace. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
689 |
box addCheckBox:'check2' on:value2. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
690 |
box addVerticalSpace. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
691 |
box addCheckBox:'check3' on:value3. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
692 |
box addVerticalSpace. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
693 |
box addCheckBox:'check4' on:value4. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
694 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
695 |
box addAbortButton; addOkButton. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
696 |
box open. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
697 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
698 |
box accepted ifTrue:[ |
655 | 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. |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
703 |
] |
593 | 704 |
[exEnd] |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
705 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
706 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
707 |
same, using an even better interface: |
593 | 708 |
[exBegin] |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
709 |
|box values labels| |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
710 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
711 |
values := #(true false false true) collect:[:val | val asValue]. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
712 |
labels := #('check1' 'check2' 'check3' 'check4'). |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
713 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
714 |
box := Dialog new. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
715 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
716 |
box |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
717 |
addColumn:(1 to:labels size) |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
718 |
fromX:0.0 |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
719 |
toX:1.0 |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
720 |
collect:[:index | CheckBox label:(labels at:index) model:(values at:index)] |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
721 |
tabable:true. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
722 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
723 |
box addAbortButton; addOkButton. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
724 |
box open. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
725 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
726 |
box accepted ifTrue:[ |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
727 |
values with:labels do:[:val :lbl | |
655 | 728 |
Transcript show:(lbl , ': '); showCR:val value. |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
729 |
] |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
730 |
] |
593 | 731 |
[exEnd] |
126 | 732 |
|
733 |
||
164 | 734 |
adding two panels in a frame: |
593 | 735 |
[exBegin] |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
736 |
|box frame vPanel1 vPanel2 m1 m2 m3 m4 chk ef| |
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 |
box := Dialog new. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
739 |
box label:'example'. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
740 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
741 |
frame := FramedBox label:'frame'. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
742 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
743 |
vPanel1 := VerticalPanelView origin:0.0@0.0 corner:0.5@1.0 in:frame. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
744 |
vPanel1 horizontalLayout:#leftSpace. |
644 | 745 |
vPanel1 verticalLayout:#spreadSpace. |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
746 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
747 |
vPanel2 := VerticalPanelView origin:0.5@0.0 corner:1.0@1.0 in:frame. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
748 |
vPanel2 horizontalLayout:#leftSpace. |
644 | 749 |
vPanel2 verticalLayout:#spreadSpace. |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
750 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
751 |
m1 := true asValue. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
752 |
m2 := true asValue. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
753 |
m3 := true asValue. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
754 |
m4 := 'hello' asValue. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
755 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
756 |
vPanel1 add:(Label label:'check1'). |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
757 |
vPanel1 add:(Label label:'m2'). |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
758 |
vPanel1 add:(Label label:'m3'). |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
759 |
vPanel1 add:(Label label:'enter'). |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
760 |
vPanel1 add:(Label label:'lbl1'). |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
761 |
vPanel1 add:(Label label:'lbl2'). |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
762 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
763 |
vPanel2 add:(chk := CheckToggle on:m1). |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
764 |
box makeTabable:chk. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
765 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
766 |
vPanel2 add:(chk := CheckToggle on:m2). |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
767 |
box makeTabable:chk. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
768 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
769 |
vPanel2 add:(chk := CheckToggle on:m3). |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
770 |
box makeTabable:chk. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
771 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
772 |
vPanel2 add:(chk := CheckToggle on:m3). |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
773 |
box makeTabable:chk. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
774 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
775 |
vPanel2 add:(chk := CheckToggle on:m3). |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
776 |
box makeTabable:chk. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
777 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
778 |
vPanel2 add:(ef := EditField on:m4). |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
779 |
ef immediateAccept:true. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
780 |
box makeTabable:ef. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
781 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
782 |
box addComponent:frame. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
783 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
784 |
box addAbortButton; addOkButton. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
785 |
box openModal. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
786 |
box accepted ifTrue:[ |
655 | 787 |
Transcript showCR:'accepted with:'. |
788 |
Transcript showCR:' m1: ' , m1 value printString. |
|
789 |
Transcript showCR:' m2: ' , m2 value printString. |
|
790 |
Transcript showCR:' m3: ' , m3 value printString. |
|
791 |
Transcript showCR:' m4: ' , m4 value printString. |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
792 |
] |
593 | 793 |
[exEnd] |
794 |
||
795 |
||
796 |
||
797 |
a full example (combined settings dialog - as in launcher): |
|
798 |
[exBegin] |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
799 |
|box warnSTX allowUnderscore immutableArrays logDoits |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
800 |
listOfLanguages listOfStyles styleNames |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
801 |
frame panel c resourceDir dir | |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
802 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
803 |
warnSTX := Compiler warnSTXSpecials asValue. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
804 |
allowUnderscore := Compiler allowUnderscoreInIdentifier asValue. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
805 |
immutableArrays := Compiler arraysAreImmutable asValue. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
806 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
807 |
logDoits := Smalltalk logDoits asValue. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
808 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
809 |
listOfLanguages := SelectionInList with:#('english' |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
810 |
'french' |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
811 |
'german' |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
812 |
'italian' |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
813 |
'spanish' |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
814 |
). |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
815 |
listOfLanguages selection:(Language asString). |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
816 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
817 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
818 |
resourceDir := Smalltalk getSystemFileName:'resources'. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
819 |
dir := FileDirectory directoryNamed:resourceDir. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
820 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
821 |
styleNames := dir select:[:aFileName | aFileName endsWith:'.style']. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
822 |
styleNames := styleNames collect:[:aFileName | aFileName copyWithoutLast:6]. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
823 |
listOfStyles := SelectionInList with:styleNames sort. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
824 |
listOfStyles selection:(View defaultStyle asString). |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
825 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
826 |
box := Dialog new. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
827 |
box label:'Settings'. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
828 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
829 |
frame := FramedBox label:'Compiler'. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
830 |
panel := VerticalPanelView origin:0.0@0.0 corner:1.0@1.0 in:frame. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
831 |
panel horizontalLayout:#leftSpace. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
832 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
833 |
panel add:((CheckBox on:warnSTX) label:'warn about ST/X language extensions'; resize). |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
834 |
panel add:((CheckBox on:allowUnderscore) label:'allow underscore in identifiers'; resize). |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
835 |
panel add:((CheckBox on:immutableArrays) label:'literal arrays are immutable'; resize). |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
836 |
box addComponent:frame. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
837 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
838 |
frame := FramedBox label:'Misc'. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
839 |
panel := VerticalPanelView origin:0.0@0.0 corner:1.0@1.0 in:frame. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
840 |
panel horizontalLayout:#leftSpace. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
841 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
842 |
panel add:((CheckBox on:logDoits) label:'log doIts in changes file'; resize). |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
843 |
box addComponent:frame. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
844 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
845 |
frame := FramedBox label:'Language'. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
846 |
panel := VerticalPanelView origin:0.0@0.0 corner:1.0@1.0 in:frame. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
847 |
panel horizontalLayout:#leftSpace. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
848 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
849 |
panel add:((PopUpList on:listOfLanguages) width:0.5). |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
850 |
box addComponent:frame. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
851 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
852 |
frame := FramedBox label:'Style'. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
853 |
panel := VerticalPanelView origin:0.0@0.0 corner:1.0@1.0 in:frame. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
854 |
panel horizontalLayout:#leftSpace. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
855 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
856 |
panel add:((PopUpList on:listOfStyles) width:0.5). |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
857 |
box addComponent:frame. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
858 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
859 |
box addAbortButton; addOkButton. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
860 |
box showAtPointer. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
861 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
862 |
box accepted ifTrue:[ |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
863 |
Transcript topView withCursor:Cursor wait do:[ |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
864 |
Compiler warnSTXSpecials:warnSTX value. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
865 |
Compiler allowUnderscoreInIdentifier:allowUnderscore value. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
866 |
Compiler arraysAreImmutable:immutableArrays value. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
867 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
868 |
Smalltalk logDoits:logDoits value. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
869 |
|
655 | 870 |
Transcript showCR:'change language to ' , listOfLanguages selection , ' ...'. |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
871 |
Smalltalk at:#Language put:listOfLanguages selection asSymbol. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
872 |
Smalltalk changed:#Language. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
873 |
ResourcePack flushCachedResourcePacks. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
874 |
|
655 | 875 |
Transcript showCR:'change style to ' , listOfStyles selection , ' ...'. |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
876 |
View defaultStyle:listOfStyles selection asSymbol. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
877 |
] |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
878 |
] |
593 | 879 |
[exEnd] |
625 | 880 |
an example from Hopkins/Horan: |
644 | 881 |
[exBegin] |
625 | 882 |
|aText index| |
883 |
||
884 |
aText := 'Smalltalk/X: An Introduction to Application Development' asText. |
|
885 |
index := aText findString:'Smalltalk/X' startingAt:1. |
|
886 |
aText emphasizeFrom:index |
|
887 |
to:'Smalltalk/X' size + index - 1 |
|
888 |
with:#bold. |
|
889 |
index := aText findString:'Introduction' startingAt:index. |
|
890 |
aText emphasizeFrom:index |
|
891 |
to:'Introduction' size + index - 1 |
|
892 |
with:#italic. |
|
644 | 893 |
Dialog warn:aText |
625 | 894 |
|
895 |
[exEnd] |
|
896 |
the same, with colors: |
|
644 | 897 |
[exBegin] |
625 | 898 |
|aText index| |
899 |
||
900 |
aText := 'Smalltalk/X: An Introduction to Application Development' asText. |
|
901 |
index := aText findString:'Smalltalk/X' startingAt:1. |
|
902 |
aText emphasizeFrom:index |
|
903 |
to:'Smalltalk/X' size + index - 1 |
|
904 |
with:(Array with:#bold with:#underline with:(#color->Color red)). |
|
905 |
index := aText findString:'Introduction' startingAt:index. |
|
906 |
aText emphasizeFrom:index |
|
907 |
to:'Introduction' size + index - 1 |
|
908 |
with:#italic. |
|
644 | 909 |
Dialog warn:aText |
625 | 910 |
[exEnd] |
76 | 911 |
" |
551
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
912 |
! |
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
913 |
|
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
914 |
inputFocus |
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
915 |
" |
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
916 |
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
|
917 |
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
|
918 |
|
600 | 919 |
The default is to shift the focus to the ok-button - thus, another return |
920 |
has to be entered (as confirmation) to close & accept the box. |
|
921 |
||
922 |
This can be changed to force an automatic OK with: |
|
551
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
923 |
aBox focusToOKOnLeave:false |
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
924 |
|
600 | 925 |
Then, leaving the last field with return, automatically accepts the box, |
926 |
as if ok was pressed. (useful for simple - single entry dialogs). |
|
927 |
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
|
928 |
|
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
929 |
|
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
930 |
With: |
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
931 |
aBox acceptReturnAsOK:false |
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
932 |
|
600 | 933 |
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
|
934 |
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
|
935 |
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
|
936 |
(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
|
937 |
to be handled somehow). |
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
938 |
|
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
939 |
|
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
940 |
Simply leaving the group with a cursor movement may also be either |
600 | 941 |
interpreted as a return (the default), or again wrap back to the top |
942 |
of the group. |
|
943 |
||
944 |
With: |
|
551
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
945 |
aBox acceptOnLeave:false |
600 | 946 |
this is turned off, so that with cursor-down, the focus is moved back |
947 |
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
|
948 |
" |
76 | 949 |
! ! |
950 |
||
498 | 951 |
!DialogBox class methodsFor:'class initialization'! |
952 |
||
953 |
initialize |
|
528
3ed1f0b5a0bb
oops - dont clobber Dialog global if subclasses #initialize
Claus Gittinger <cg@exept.de>
parents:
498
diff
changeset
|
954 |
self == DialogBox ifTrue:[ |
3ed1f0b5a0bb
oops - dont clobber Dialog global if subclasses #initialize
Claus Gittinger <cg@exept.de>
parents:
498
diff
changeset
|
955 |
Dialog := self |
3ed1f0b5a0bb
oops - dont clobber Dialog global if subclasses #initialize
Claus Gittinger <cg@exept.de>
parents:
498
diff
changeset
|
956 |
] |
498 | 957 |
|
958 |
"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
|
959 |
"Modified: 10.4.1996 / 08:16:18 / cg" |
498 | 960 |
! ! |
961 |
||
128 | 962 |
!DialogBox class methodsFor:'common dialogs'! |
100 | 963 |
|
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
964 |
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
|
965 |
"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
|
966 |
|
719
574be1981be0
destroy boxes from standard dialogs
Claus Gittinger <cg@exept.de>
parents:
718
diff
changeset
|
967 |
(InfoBox title:aString) showAtPointer; destroy |
197 | 968 |
|
969 |
" |
|
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
970 |
Dialog information:'help' |
197 | 971 |
" |
719
574be1981be0
destroy boxes from standard dialogs
Claus Gittinger <cg@exept.de>
parents:
718
diff
changeset
|
972 |
|
574be1981be0
destroy boxes from standard dialogs
Claus Gittinger <cg@exept.de>
parents:
718
diff
changeset
|
973 |
"Modified: 29.5.1996 / 15:23:03 / cg" |
197 | 974 |
! |
975 |
||
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
976 |
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
|
977 |
"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
|
978 |
|
719
574be1981be0
destroy boxes from standard dialogs
Claus Gittinger <cg@exept.de>
parents:
718
diff
changeset
|
979 |
(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
|
980 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
981 |
" |
625 | 982 |
Dialog warn:'some warning message' |
983 |
||
984 |
Dialog warn:('some text with italic emphasis' asText |
|
985 |
emphasizeFrom:16 to:22 with:#italic) |
|
986 |
||
987 |
Dialog warn:('some warning message' asText |
|
988 |
emphasizeAllWith:(#color->Color red)) |
|
989 |
||
990 |
Dialog warn:('some text with color emphasis' asText |
|
991 |
emphasizeFrom:6 to:10 with:(#color->Color blue); |
|
992 |
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
|
993 |
" |
625 | 994 |
|
719
574be1981be0
destroy boxes from standard dialogs
Claus Gittinger <cg@exept.de>
parents:
718
diff
changeset
|
995 |
"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
|
996 |
! ! |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
997 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
998 |
!DialogBox class methodsFor:'confirmation dialogs'! |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
999 |
|
197 | 1000 |
confirm:aString |
1001 |
"launch a Dialog, which allows user to enter yes or no. |
|
1002 |
return true for yes, false for no" |
|
1003 |
||
498 | 1004 |
^ self |
1005 |
confirm:aString |
|
1006 |
title:nil |
|
1007 |
yesLabel:nil |
|
1008 |
noLabel:nil |
|
1009 |
||
1010 |
"/ |box answer| |
|
1011 |
"/ |
|
1012 |
"/ box := YesNoBox title:aString. |
|
1013 |
"/ box label:(self classResources string:'Confirm'). |
|
1014 |
"/ box yesAction:[answer := true] noAction:[answer := false]. |
|
1015 |
"/ box showAtPointer. |
|
1016 |
"/ box yesAction:nil noAction:nil. |
|
1017 |
"/ ^ answer |
|
197 | 1018 |
|
1019 |
" |
|
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
1020 |
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
|
1021 |
|
655 | 1022 |
Transcript showCR:( |
414 | 1023 |
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
|
1024 |
) |
197 | 1025 |
" |
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
1026 |
|
498 | 1027 |
"Modified: 8.3.1996 / 21:16:54 / cg" |
197 | 1028 |
! |
1029 |
||
1030 |
confirm:aString initialAnswer:what |
|
1031 |
"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
|
1032 |
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
|
1033 |
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
|
1034 |
the default (i.e. return-) button" |
197 | 1035 |
|
1036 |
|box answer| |
|
1037 |
||
1038 |
box := YesNoBox title:aString. |
|
1039 |
box yesAction:[answer := true] noAction:[answer := false]. |
|
1040 |
what == false ifTrue:[ |
|
719
574be1981be0
destroy boxes from standard dialogs
Claus Gittinger <cg@exept.de>
parents:
718
diff
changeset
|
1041 |
box okButton isReturnButton:false. |
574be1981be0
destroy boxes from standard dialogs
Claus Gittinger <cg@exept.de>
parents:
718
diff
changeset
|
1042 |
box acceptReturnAsOK:false. |
574be1981be0
destroy boxes from standard dialogs
Claus Gittinger <cg@exept.de>
parents:
718
diff
changeset
|
1043 |
box noButton beReturnButton. |
197 | 1044 |
]. |
1045 |
box showAtPointer. |
|
1046 |
box yesAction:nil noAction:nil. |
|
719
574be1981be0
destroy boxes from standard dialogs
Claus Gittinger <cg@exept.de>
parents:
718
diff
changeset
|
1047 |
box destroy. |
197 | 1048 |
^ answer |
1049 |
||
1050 |
" |
|
1051 |
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
|
1052 |
|
655 | 1053 |
Transcript showCR:( |
719
574be1981be0
destroy boxes from standard dialogs
Claus Gittinger <cg@exept.de>
parents:
718
diff
changeset
|
1054 |
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
|
1055 |
) |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
1056 |
|
655 | 1057 |
Transcript showCR:( |
719
574be1981be0
destroy boxes from standard dialogs
Claus Gittinger <cg@exept.de>
parents:
718
diff
changeset
|
1058 |
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
|
1059 |
) |
197 | 1060 |
" |
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
1061 |
|
719
574be1981be0
destroy boxes from standard dialogs
Claus Gittinger <cg@exept.de>
parents:
718
diff
changeset
|
1062 |
"Modified: 29.5.1996 / 15:23:42 / cg" |
197 | 1063 |
! |
1064 |
||
498 | 1065 |
confirm:aString title:title yesLabel:yesText noLabel:noText |
253
f071ff350cd5
added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents:
241
diff
changeset
|
1066 |
"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
|
1067 |
return true for yes, false for no. |
f071ff350cd5
added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents:
241
diff
changeset
|
1068 |
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
|
1069 |
|
f071ff350cd5
added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents:
241
diff
changeset
|
1070 |
|box answer| |
f071ff350cd5
added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents:
241
diff
changeset
|
1071 |
|
f071ff350cd5
added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents:
241
diff
changeset
|
1072 |
box := YesNoBox title:aString. |
498 | 1073 |
yesText notNil ifTrue:[ |
1074 |
box yesLabel:yesText. |
|
1075 |
]. |
|
1076 |
noText notNil ifTrue:[ |
|
1077 |
box noLabel:noText. |
|
1078 |
]. |
|
253
f071ff350cd5
added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents:
241
diff
changeset
|
1079 |
box yesAction:[answer := true] noAction:[answer := false]. |
498 | 1080 |
title notNil ifTrue:[ |
1081 |
box label:title |
|
1082 |
]. |
|
253
f071ff350cd5
added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents:
241
diff
changeset
|
1083 |
box showAtPointer. |
f071ff350cd5
added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents:
241
diff
changeset
|
1084 |
box yesAction:nil noAction:nil. |
719
574be1981be0
destroy boxes from standard dialogs
Claus Gittinger <cg@exept.de>
parents:
718
diff
changeset
|
1085 |
box destroy. |
253
f071ff350cd5
added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents:
241
diff
changeset
|
1086 |
^ answer |
f071ff350cd5
added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents:
241
diff
changeset
|
1087 |
|
f071ff350cd5
added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents:
241
diff
changeset
|
1088 |
" |
498 | 1089 |
Dialog |
1090 |
confirm:'really ?' |
|
1091 |
title:'fooBar' |
|
1092 |
yesLabel:'oh well' |
|
1093 |
noLabel:'nope' |
|
1094 |
" |
|
1095 |
||
1096 |
"Created: 21.2.1996 / 01:10:14 / cg" |
|
719
574be1981be0
destroy boxes from standard dialogs
Claus Gittinger <cg@exept.de>
parents:
718
diff
changeset
|
1097 |
"Modified: 29.5.1996 / 15:23:59 / cg" |
498 | 1098 |
! |
1099 |
||
1100 |
confirm:aString yesLabel:yesText noLabel:noText |
|
1101 |
"launch a Dialog, which allows user to enter yes or no. |
|
1102 |
return true for yes, false for no. |
|
1103 |
The yes/no buttons labels are defined by yesText/noText." |
|
1104 |
||
1105 |
^ self confirm:aString title:nil yesLabel:yesText noLabel:noText |
|
1106 |
||
1107 |
" |
|
253
f071ff350cd5
added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents:
241
diff
changeset
|
1108 |
Dialog confirm:'really ?' yesLabel:'oh well' noLabel:'nope' |
f071ff350cd5
added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents:
241
diff
changeset
|
1109 |
" |
f071ff350cd5
added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents:
241
diff
changeset
|
1110 |
|
374 | 1111 |
"Created: 21.2.1996 / 01:10:14 / cg" |
498 | 1112 |
"Modified: 8.3.1996 / 21:15:06 / cg" |
253
f071ff350cd5
added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents:
241
diff
changeset
|
1113 |
! |
f071ff350cd5
added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents:
241
diff
changeset
|
1114 |
|
197 | 1115 |
confirmWithCancel:aString |
1116 |
"launch a Dialog, which allows user to enter yes, no and cancel. |
|
1117 |
return true for 'yes', false for 'no', nil for 'cancel'" |
|
1118 |
||
1119 |
|box answer| |
|
1120 |
||
1121 |
box := OptionBox title:aString numberOfOptions:3. |
|
1122 |
box buttonTitles:(self classResources array: |
|
719
574be1981be0
destroy boxes from standard dialogs
Claus Gittinger <cg@exept.de>
parents:
718
diff
changeset
|
1123 |
#('cancel' |
574be1981be0
destroy boxes from standard dialogs
Claus Gittinger <cg@exept.de>
parents:
718
diff
changeset
|
1124 |
'no' |
574be1981be0
destroy boxes from standard dialogs
Claus Gittinger <cg@exept.de>
parents:
718
diff
changeset
|
1125 |
'yes') |
574be1981be0
destroy boxes from standard dialogs
Claus Gittinger <cg@exept.de>
parents:
718
diff
changeset
|
1126 |
) |
574be1981be0
destroy boxes from standard dialogs
Claus Gittinger <cg@exept.de>
parents:
718
diff
changeset
|
1127 |
actions:(Array with:[answer := nil] |
574be1981be0
destroy boxes from standard dialogs
Claus Gittinger <cg@exept.de>
parents:
718
diff
changeset
|
1128 |
with:[answer := false] |
574be1981be0
destroy boxes from standard dialogs
Claus Gittinger <cg@exept.de>
parents:
718
diff
changeset
|
1129 |
with:[answer := true] |
574be1981be0
destroy boxes from standard dialogs
Claus Gittinger <cg@exept.de>
parents:
718
diff
changeset
|
1130 |
). |
197 | 1131 |
box showAtPointer. |
1132 |
box actions:nil. |
|
719
574be1981be0
destroy boxes from standard dialogs
Claus Gittinger <cg@exept.de>
parents:
718
diff
changeset
|
1133 |
box destroy. |
197 | 1134 |
^ answer |
1135 |
||
1136 |
" |
|
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
1137 |
Dialog confirmWithCancel:'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
|
1138 |
|
655 | 1139 |
Transcript showCR:( |
719
574be1981be0
destroy boxes from standard dialogs
Claus Gittinger <cg@exept.de>
parents:
718
diff
changeset
|
1140 |
Dialog confirmWithCancel:'really ?' |
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
1141 |
) |
197 | 1142 |
" |
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
1143 |
|
719
574be1981be0
destroy boxes from standard dialogs
Claus Gittinger <cg@exept.de>
parents:
718
diff
changeset
|
1144 |
"Modified: 29.5.1996 / 15:24:06 / 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
|
1145 |
! ! |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
1146 |
|
573 | 1147 |
!DialogBox class methodsFor:'defaults'! |
1148 |
||
1149 |
defaultLabel |
|
1150 |
"return the boxes default window title." |
|
1151 |
||
1152 |
^ 'Dialog' |
|
1153 |
||
1154 |
"Created: 23.4.1996 / 17:13:10 / cg" |
|
1155 |
! ! |
|
1156 |
||
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
1157 |
!DialogBox class methodsFor:'file name dialogs'! |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
1158 |
|
549
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1159 |
requestDirectoryName |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1160 |
"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
|
1161 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1162 |
^ self |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1163 |
requestDirectoryName:'directory ?' |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1164 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1165 |
" |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1166 |
Dialog requestDirectoryName |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1167 |
" |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1168 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1169 |
"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
|
1170 |
"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
|
1171 |
! |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1172 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1173 |
requestDirectoryName:title |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1174 |
"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
|
1175 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1176 |
^ self |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1177 |
requestDirectoryName:title |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1178 |
default:nil |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1179 |
ifFail:'' |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1180 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1181 |
" |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1182 |
Dialog |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1183 |
requestDirectoryName:'which directory ?' |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1184 |
" |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1185 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1186 |
"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
|
1187 |
"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
|
1188 |
! |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1189 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1190 |
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
|
1191 |
"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
|
1192 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1193 |
^ self |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1194 |
requestDirectoryName:title |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1195 |
default:nil |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1196 |
ifFail:'' |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1197 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1198 |
" |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1199 |
Dialog |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1200 |
requestDirectoryName:'which directory ?' |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1201 |
default:'/etc' |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1202 |
" |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1203 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1204 |
"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
|
1205 |
"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
|
1206 |
! |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1207 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1208 |
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
|
1209 |
"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
|
1210 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1211 |
|fileBox| |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1212 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1213 |
fileBox := FileSelectionBox |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1214 |
title:title |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1215 |
okText:'ok' |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1216 |
abortText:'cancel' |
719
574be1981be0
destroy boxes from standard dialogs
Claus Gittinger <cg@exept.de>
parents:
718
diff
changeset
|
1217 |
action:[:fileName | fileBox destroy. ^ fileName]. |
549
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1218 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1219 |
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
|
1220 |
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
|
1221 |
fileBox showAtPointer. |
719
574be1981be0
destroy boxes from standard dialogs
Claus Gittinger <cg@exept.de>
parents:
718
diff
changeset
|
1222 |
fileBox destroy. |
549
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1223 |
^ failBlock value |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1224 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1225 |
" |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1226 |
Dialog |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1227 |
requestDirectoryName:'which directory ?' |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1228 |
default:'/etc' |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1229 |
ifFail:'none' |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1230 |
" |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1231 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1232 |
"Created: 19.4.1996 / 14:31:04 / cg" |
719
574be1981be0
destroy boxes from standard dialogs
Claus Gittinger <cg@exept.de>
parents:
718
diff
changeset
|
1233 |
"Modified: 29.5.1996 / 15:24:30 / cg" |
549
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1234 |
! |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1235 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1236 |
requestFileName |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1237 |
"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
|
1238 |
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
|
1239 |
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
|
1240 |
|
549
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1241 |
^ self |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1242 |
requestFileName:'filename:' |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1243 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1244 |
" |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1245 |
Dialog requestFileName |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1246 |
" |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1247 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1248 |
"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
|
1249 |
"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
|
1250 |
! |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1251 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1252 |
requestFileName:titleString |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1253 |
"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
|
1254 |
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
|
1255 |
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
|
1256 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1257 |
^ self |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1258 |
requestFileName:titleString |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1259 |
default:'file.ext' |
183 | 1260 |
|
197 | 1261 |
" |
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
1262 |
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
|
1263 |
Dialog requestFileName:'enter a fileName:' |
183 | 1264 |
" |
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
1265 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
1266 |
"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
|
1267 |
"Modified: 19.4.1996 / 13:53:17 / cg" |
118 | 1268 |
! |
1269 |
||
100 | 1270 |
requestFileName:titleString default:defaultName |
1271 |
"launch a Dialog, which allows user to enter a filename. |
|
1272 |
The box will not allow pressing 'ok' without an entered string. |
|
1273 |
Return the pathname string consisting of the full pathname of the filename, |
|
1274 |
or an empty string (if cancel was pressed)." |
|
1275 |
||
549
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1276 |
^ self |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1277 |
requestFileName:titleString |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1278 |
default:defaultName |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1279 |
version:nil |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1280 |
ifFail:'' |
100 | 1281 |
|
1282 |
" |
|
1283 |
Dialog requestFileName:'enter a fileName:' default:'' |
|
1284 |
Dialog requestFileName:'enter a fileName:' default:'Makefile.bak' |
|
1285 |
" |
|
549
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1286 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1287 |
"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
|
1288 |
! |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1289 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1290 |
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
|
1291 |
"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
|
1292 |
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
|
1293 |
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
|
1294 |
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
|
1295 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1296 |
^ self |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1297 |
requestFileName:titleString |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1298 |
default:defaultName |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1299 |
version:nil |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1300 |
ifFail:'' |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1301 |
fromDirectory:aDirectoryPath |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1302 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1303 |
" |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1304 |
Dialog |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1305 |
requestFileName:'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
|
1306 |
default:'Makefile.bak' |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1307 |
fromDirectory:'..' |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1308 |
" |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1309 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1310 |
"Modified: 19.4.1996 / 14:27:31 / cg" |
100 | 1311 |
! |
1312 |
||
197 | 1313 |
requestFileName:titleString default:defaultName ok:okText abort:abortText pattern:pattern |
1314 |
"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
|
1315 |
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
|
1316 |
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
|
1317 |
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
|
1318 |
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
|
1319 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1320 |
^ self |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1321 |
requestFileName:titleString |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1322 |
default:defaultName |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1323 |
ok:okText |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1324 |
abort:abortText |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1325 |
pattern:pattern |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1326 |
fromDirectory:nil |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1327 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1328 |
" |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1329 |
Dialog |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1330 |
requestFileName:'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
|
1331 |
default:'' |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1332 |
ok:'yeah' |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1333 |
abort:'oh, no' |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1334 |
pattern:'*.st' |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1335 |
" |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1336 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1337 |
"Modified: 19.4.1996 / 14:06:22 / cg" |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1338 |
! |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1339 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1340 |
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
|
1341 |
"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
|
1342 |
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
|
1343 |
current directory (if a nil path is given). |
197 | 1344 |
The box will show okText in its okButton, abortText in the abortButton. |
1345 |
The matchPattern is set to pattern initially. |
|
719
574be1981be0
destroy boxes from standard dialogs
Claus Gittinger <cg@exept.de>
parents:
718
diff
changeset
|
1346 |
Return the string, or nil if cancel was pressed." |
197 | 1347 |
|
1348 |
|box| |
|
1349 |
||
1350 |
box := FileSelectionBox |
|
549
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1351 |
title:titleString |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1352 |
okText:okText |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1353 |
abortText:abortText |
719
574be1981be0
destroy boxes from standard dialogs
Claus Gittinger <cg@exept.de>
parents:
718
diff
changeset
|
1354 |
action:[:fileName | box destroy. ^ fileName]. |
549
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1355 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1356 |
aDirectoryPath notNil ifTrue:[box directory:aDirectoryPath]. |
197 | 1357 |
box pattern:pattern. |
1358 |
box initialText:defaultName. |
|
1359 |
box showAtPointer. |
|
1360 |
box action:nil. |
|
719
574be1981be0
destroy boxes from standard dialogs
Claus Gittinger <cg@exept.de>
parents:
718
diff
changeset
|
1361 |
box destroy. |
197 | 1362 |
^ nil |
1363 |
||
1364 |
" |
|
549
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1365 |
Dialog |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1366 |
requestFileName:'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
|
1367 |
default:'' |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1368 |
ok:'yeah' |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1369 |
abort:'oh, no' |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1370 |
pattern:'rc*' |
719
574be1981be0
destroy boxes from standard dialogs
Claus Gittinger <cg@exept.de>
parents:
718
diff
changeset
|
1371 |
fromDirectory:'/etc' |
197 | 1372 |
" |
549
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1373 |
|
719
574be1981be0
destroy boxes from standard dialogs
Claus Gittinger <cg@exept.de>
parents:
718
diff
changeset
|
1374 |
"Modified: 29.5.1996 / 15:25:40 / cg" |
197 | 1375 |
! |
1376 |
||
100 | 1377 |
requestFileName:titleString default:defaultName version:versionSymbol |
1378 |
"launch a Dialog, which allows user to enter a filename. |
|
1379 |
The box will not allow pressing 'ok' without an entered string. |
|
1380 |
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
|
1381 |
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
|
1382 |
it may be any of: |
549
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1383 |
#mustBeNew - fail (return empty string) if the file exists |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1384 |
#new - confirm if the file exists |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1385 |
#mustBeOld - fail if the file does not exist |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1386 |
#old - confirm if the file does not exist |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1387 |
#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
|
1388 |
" |
100 | 1389 |
|
549
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1390 |
^ self |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1391 |
requestFileName:titleString |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1392 |
default:defaultName |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1393 |
version:versionSymbol |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1394 |
ifFail:'' |
100 | 1395 |
|
1396 |
" |
|
1397 |
Dialog requestFileName:'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
|
1398 |
default:'' |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1399 |
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
|
1400 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
1401 |
Dialog requestFileName:'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
|
1402 |
default:'' |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1403 |
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
|
1404 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
1405 |
Dialog requestFileName:'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
|
1406 |
default:'' |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1407 |
version:#new |
100 | 1408 |
" |
307
d3fe810390cb
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 |
|
549
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1410 |
"Modified: 19.4.1996 / 13:53:58 / cg" |
100 | 1411 |
! |
1412 |
||
1413 |
requestFileName:titleString default:defaultName version:versionSymbol ifFail:failBlock |
|
1414 |
"launch a Dialog, which allows user to enter a filename. |
|
1415 |
The box will not allow pressing 'ok' without an entered string. |
|
1416 |
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
|
1417 |
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
|
1418 |
it may be any of: |
549
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1419 |
#mustBeNew - fail (return empty string) if the file exists |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1420 |
#new - confirm if the file exists |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1421 |
#mustBeOld - fail if the file does not exist |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1422 |
#old - confirm if the file does not exist |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1423 |
#any (other) - no validation |
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 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1426 |
^ self |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1427 |
requestFileName:titleString |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1428 |
default:defaultName |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1429 |
version:versionSymbol |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1430 |
ifFail:failBlock |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1431 |
fromDirectory:nil |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1432 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1433 |
" |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1434 |
Dialog |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1435 |
requestFileName:'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
|
1436 |
default:'' |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1437 |
version:nil |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1438 |
ifFail:['none'] |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1439 |
" |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1440 |
" |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1441 |
Dialog |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1442 |
requestFileName:'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
|
1443 |
default:'' |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1444 |
version:#old |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1445 |
ifFail:['none'] |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1446 |
" |
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 |
"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
|
1449 |
! |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1450 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1451 |
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
|
1452 |
"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
|
1453 |
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
|
1454 |
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
|
1455 |
it may be any of: |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1456 |
#mustBeNew - fail (return empty string) if the file exists |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1457 |
#new - confirm if the file exists |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1458 |
#mustBeOld - fail if the file does not exist |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1459 |
#old - confirm if the file does not exist |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1460 |
#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
|
1461 |
" |
100 | 1462 |
|
1463 |
|box| |
|
1464 |
||
1465 |
box := FileSelectionBox title:titleString. |
|
549
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1466 |
aDirectoryPath notNil ifTrue:[box directory:aDirectoryPath]. |
100 | 1467 |
box initialText:defaultName. |
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
1468 |
box action:[:name | |
549
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1469 |
versionSymbol == #mustBeNew ifTrue:[ |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1470 |
"/ file may not exist |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1471 |
name asFilename exists ifTrue:[^ '']. |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1472 |
]. |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1473 |
versionSymbol == #new ifTrue:[ |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1474 |
"/ file may not exist |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1475 |
name asFilename exists ifTrue:[ |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1476 |
(self confirm:(ClassResources string:'''%1'' exists.\\Continue anyway ?' with:box fileName) withCRs) |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1477 |
ifFalse:[^ '']. |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1478 |
]. |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1479 |
]. |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1480 |
versionSymbol == #mustBeOld ifTrue:[ |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1481 |
name asFilename exists ifFalse:[^ '']. |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1482 |
]. |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1483 |
versionSymbol == #old ifTrue:[ |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1484 |
"/ file may not exist |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1485 |
name asFilename exists ifFalse:[ |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1486 |
(self confirm:(ClassResources string:'''%1'' does not exist yet.\\Continue anyway ?' with:box fileName) withCRs) |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1487 |
ifFalse:[^ '']. |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1488 |
]. |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1489 |
]. |
719
574be1981be0
destroy boxes from standard dialogs
Claus Gittinger <cg@exept.de>
parents:
718
diff
changeset
|
1490 |
box destroy. |
549
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1491 |
^ 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
|
1492 |
]. |
100 | 1493 |
box showAtPointer. |
1494 |
box action:nil. |
|
719
574be1981be0
destroy boxes from standard dialogs
Claus Gittinger <cg@exept.de>
parents:
718
diff
changeset
|
1495 |
box destroy. |
100 | 1496 |
^ failBlock value |
1497 |
||
1498 |
" |
|
549
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1499 |
Dialog |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1500 |
requestFileName:'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
|
1501 |
default:'' |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1502 |
version:nil |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1503 |
ifFail:['none'] |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1504 |
fromDirectory:'/etc' |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1505 |
" |
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 |
Dialog |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1508 |
requestFileName:'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
|
1509 |
default:'' |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1510 |
version:#old |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1511 |
ifFail:['none'] |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1512 |
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
|
1513 |
" |
d3fe810390cb
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 |
" |
549
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1515 |
Dialog |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1516 |
requestFileName:'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
|
1517 |
default:'' |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1518 |
version:#mustBeNew |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1519 |
ifFail:['none'] |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1520 |
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
|
1521 |
" |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
1522 |
|
719
574be1981be0
destroy boxes from standard dialogs
Claus Gittinger <cg@exept.de>
parents:
718
diff
changeset
|
1523 |
"Modified: 29.5.1996 / 15:25:57 / cg" |
549
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1524 |
! |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1525 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1526 |
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
|
1527 |
"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
|
1528 |
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
|
1529 |
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
|
1530 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1531 |
^ self |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1532 |
requestFileName:titleString |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1533 |
default:'file.ext' |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1534 |
version:nil |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1535 |
ifFail:cancelBlock |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1536 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1537 |
" |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1538 |
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
|
1539 |
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
|
1540 |
" |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1541 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1542 |
"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
|
1543 |
"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
|
1544 |
! |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
1545 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
1546 |
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
|
1547 |
"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
|
1548 |
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
|
1549 |
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
|
1550 |
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
|
1551 |
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
|
1552 |
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
|
1553 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
1554 |
^ self requestFileName:titleString |
314
705185e7001d
no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents:
312
diff
changeset
|
1555 |
default:defaultName |
705185e7001d
no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents:
312
diff
changeset
|
1556 |
version:#new |
705185e7001d
no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents:
312
diff
changeset
|
1557 |
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
|
1558 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
1559 |
" |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
1560 |
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
|
1561 |
" |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
1562 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
1563 |
"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
|
1564 |
! ! |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
1565 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
1566 |
!DialogBox class methodsFor:'fill in the blank dialogs'! |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
1567 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
1568 |
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
|
1569 |
"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
|
1570 |
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
|
1571 |
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
|
1572 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
1573 |
^ self |
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1574 |
request:aString |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1575 |
displayAt:nil |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1576 |
centered:false |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1577 |
action:nil |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1578 |
initialAnswer:'' |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1579 |
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
|
1580 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
1581 |
" |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
1582 |
Dialog |
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1583 |
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
|
1584 |
" |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
1585 |
|
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1586 |
"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
|
1587 |
! |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
1588 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
1589 |
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
|
1590 |
"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
|
1591 |
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
|
1592 |
that point. |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1593 |
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
|
1594 |
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
|
1595 |
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
|
1596 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
1597 |
^ self |
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1598 |
request:aString |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1599 |
displayAt:aPoint |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1600 |
centered:centered |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1601 |
action:resultAction |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1602 |
initialAnswer:initial |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1603 |
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
|
1604 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
1605 |
" |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
1606 |
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
|
1607 |
|
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1608 |
Dialog |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1609 |
request:'enter a string:' |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1610 |
displayAt:200@200 |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1611 |
centered:true |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1612 |
action:[:result | result printNewline] |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1613 |
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
|
1614 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
1615 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
1616 |
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
|
1617 |
|
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1618 |
Dialog |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1619 |
request:'enter a string:' |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1620 |
displayAt:200@200 |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1621 |
centered:false |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1622 |
action:[:result | result printNewline] |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1623 |
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
|
1624 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
1625 |
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
|
1626 |
|
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1627 |
Dialog |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1628 |
request:'enter a string:' |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1629 |
displayAt:nil |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1630 |
centered:false |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1631 |
action:[:result | result printNewline] |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1632 |
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
|
1633 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
1634 |
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
|
1635 |
|
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1636 |
Dialog |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1637 |
request:'enter a string:' |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1638 |
displayAt:nil |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1639 |
centered:true |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1640 |
action:[:result | result printNewline] |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1641 |
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
|
1642 |
" |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
1643 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
1644 |
"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
|
1645 |
"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
|
1646 |
! |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1647 |
|
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1648 |
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
|
1649 |
"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
|
1650 |
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
|
1651 |
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
|
1652 |
screen center (if centered is true). |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1653 |
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
|
1654 |
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
|
1655 |
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
|
1656 |
|
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1657 |
^ self |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1658 |
request:aString |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1659 |
displayAt:aPoint |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1660 |
centered:centered |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1661 |
action:resultAction |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1662 |
initialAnswer:initial |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1663 |
okLabel:okLabel |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1664 |
cancelLabel:cancelLabel |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1665 |
title:nil |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1666 |
onCancel:cancelValue |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1667 |
|
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1668 |
" |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1669 |
at topLeft (centering is suppressed, to make the box fully visible) |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1670 |
Dialog |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1671 |
request:'enter a string:' |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1672 |
displayAt:0@0 |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1673 |
centered:true |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1674 |
action:[:result | result printNewline] |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1675 |
initialAnswer:'the default' |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1676 |
okLabel:'yes' |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1677 |
cancelLabel:'no' |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1678 |
onCancel:#foo |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1679 |
|
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1680 |
centered around 200@200: |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1681 |
|
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1682 |
Dialog |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1683 |
request:'enter a string:' |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1684 |
displayAt:200@200 |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1685 |
centered:true |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1686 |
action:[:result | result printNewline] |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1687 |
initialAnswer:'the default' |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1688 |
okLabel:'yes' |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1689 |
cancelLabel:'no' |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1690 |
onCancel:#foo |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1691 |
|
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1692 |
topLeft of box at 200@200: |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1693 |
|
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1694 |
Dialog |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1695 |
request:'enter a string:' |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1696 |
displayAt:200@200 |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1697 |
centered:false |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1698 |
action:[:result | result printNewline] |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1699 |
initialAnswer:'the default' |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1700 |
okLabel:'yes' |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1701 |
cancelLabel:'no' |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1702 |
onCancel:#foo |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1703 |
|
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1704 |
under mouse pointer: |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1705 |
|
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1706 |
Dialog |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1707 |
request:'enter a string:' |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1708 |
displayAt:nil |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1709 |
centered:false |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1710 |
action:[:result | result printNewline] |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1711 |
initialAnswer:'the default' |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1712 |
okLabel:'yes' |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1713 |
cancelLabel:'no' |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1714 |
onCancel:#foo |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1715 |
|
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1716 |
centered on the screen: |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1717 |
|
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1718 |
Dialog |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1719 |
request:'enter a string:' |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1720 |
displayAt:nil |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1721 |
centered:true |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1722 |
action:[:result | result printNewline] |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1723 |
initialAnswer:'the default' |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1724 |
okLabel:'yes' |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1725 |
cancelLabel:'no' |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1726 |
onCancel:#foo |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1727 |
" |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1728 |
|
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1729 |
"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
|
1730 |
"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
|
1731 |
! |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1732 |
|
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1733 |
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
|
1734 |
"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
|
1735 |
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
|
1736 |
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
|
1737 |
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
|
1738 |
screen center (if centered is true). |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1739 |
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
|
1740 |
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
|
1741 |
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
|
1742 |
|
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1743 |
|box| |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1744 |
|
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1745 |
box := EnterBox title:aString. |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1746 |
box initialText:initial. |
719
574be1981be0
destroy boxes from standard dialogs
Claus Gittinger <cg@exept.de>
parents:
718
diff
changeset
|
1747 |
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
|
1748 |
okLabel notNil ifTrue:[ |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1749 |
box okText:okLabel. |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1750 |
]. |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1751 |
cancelLabel notNil ifTrue:[ |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1752 |
box abortText:cancelLabel |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1753 |
]. |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1754 |
resultAction isNil ifTrue:[ |
719
574be1981be0
destroy boxes from standard dialogs
Claus Gittinger <cg@exept.de>
parents:
718
diff
changeset
|
1755 |
box action:[:val | box destroy. ^ val] |
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1756 |
] ifFalse:[ |
719
574be1981be0
destroy boxes from standard dialogs
Claus Gittinger <cg@exept.de>
parents:
718
diff
changeset
|
1757 |
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
|
1758 |
]. |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1759 |
titleString notNil ifTrue:[ |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1760 |
box label:titleString |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1761 |
]. |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1762 |
|
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1763 |
aPoint notNil ifTrue:[ |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1764 |
box showAt:aPoint center:centered |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1765 |
] ifFalse:[ |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1766 |
centered ifTrue:[ |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1767 |
box showAtCenter |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1768 |
] ifFalse:[ |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1769 |
box showAtPointer |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1770 |
] |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1771 |
]. |
719
574be1981be0
destroy boxes from standard dialogs
Claus Gittinger <cg@exept.de>
parents:
718
diff
changeset
|
1772 |
box destroy. |
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1773 |
^ cancelValue value. |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1774 |
|
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1775 |
" |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1776 |
centered around 200@200: |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1777 |
|
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1778 |
Dialog |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1779 |
request:'enter a string:' |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1780 |
displayAt:200@200 |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1781 |
centered:true |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1782 |
action:[:result | result printNewline] |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1783 |
initialAnswer:'the default' |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1784 |
okLabel:'yes' |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1785 |
cancelLabel:'no' |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1786 |
title:'foo' |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1787 |
onCancel:#foo |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1788 |
|
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1789 |
under mouse pointer: |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1790 |
|
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1791 |
Dialog |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1792 |
request:'enter a string:' |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1793 |
displayAt:nil |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1794 |
centered:false |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1795 |
action:[:result | result printNewline] |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1796 |
initialAnswer:'the default' |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1797 |
okLabel:'yes' |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1798 |
cancelLabel:'no' |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1799 |
title:'foo' |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1800 |
onCancel:#foo |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1801 |
|
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1802 |
centered on the screen: |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1803 |
|
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1804 |
Dialog |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1805 |
request:'enter a string:' |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1806 |
displayAt:nil |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1807 |
centered:true |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1808 |
action:[:result | result printNewline] |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1809 |
initialAnswer:'the default' |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1810 |
okLabel:'yes' |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1811 |
cancelLabel:'no' |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1812 |
title:'foo' |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1813 |
onCancel:#foo |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1814 |
" |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1815 |
|
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1816 |
"Created: 29.5.1996 / 14:35:04 / cg" |
719
574be1981be0
destroy boxes from standard dialogs
Claus Gittinger <cg@exept.de>
parents:
718
diff
changeset
|
1817 |
"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
|
1818 |
! |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
1819 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
1820 |
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
|
1821 |
"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
|
1822 |
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
|
1823 |
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
|
1824 |
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
|
1825 |
|
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1826 |
^ self |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1827 |
request:aString |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1828 |
displayAt:aPoint |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1829 |
centered:centered |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1830 |
action:resultAction |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1831 |
initialAnswer:initial |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1832 |
okLabel:nil |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1833 |
cancelLabel:nil |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1834 |
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
|
1835 |
|
100 | 1836 |
" |
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
1837 |
at topLeft (centering is suppressed, to make the box fully visible) |
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1838 |
Dialog |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1839 |
request:'enter a string:' |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1840 |
displayAt:0@0 |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1841 |
centered:true |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1842 |
action:[:result | result printNewline] |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1843 |
initialAnswer:'the default' |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1844 |
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
|
1845 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
1846 |
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
|
1847 |
|
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1848 |
Dialog |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1849 |
request:'enter a string:' |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1850 |
displayAt:200@200 |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1851 |
centered:true |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1852 |
action:[:result | result printNewline] |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1853 |
initialAnswer:'the default' |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1854 |
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
|
1855 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
1856 |
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
|
1857 |
|
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1858 |
Dialog |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1859 |
request:'enter a string:' |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1860 |
displayAt:200@200 |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1861 |
centered:false |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1862 |
action:[:result | result printNewline] |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1863 |
initialAnswer:'the default' |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1864 |
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
|
1865 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
1866 |
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
|
1867 |
|
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1868 |
Dialog |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1869 |
request:'enter a string:' |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1870 |
displayAt:nil |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1871 |
centered:false |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1872 |
action:[:result | result printNewline] |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1873 |
initialAnswer:'the default' |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1874 |
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
|
1875 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
1876 |
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
|
1877 |
|
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1878 |
Dialog |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1879 |
request:'enter a string:' |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1880 |
displayAt:nil |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1881 |
centered:true |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1882 |
action:[:result | result printNewline] |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1883 |
initialAnswer:'the default' |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1884 |
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
|
1885 |
" |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
1886 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
1887 |
"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
|
1888 |
"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
|
1889 |
! |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
1890 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
1891 |
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
|
1892 |
"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
|
1893 |
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
|
1894 |
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
|
1895 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
1896 |
^ self |
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1897 |
request:aString |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1898 |
displayAt:aPoint |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1899 |
centered:false |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1900 |
action:nil |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1901 |
initialAnswer:initial |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1902 |
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
|
1903 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
1904 |
" |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
1905 |
Dialog |
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1906 |
request:'enter a string:' |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1907 |
displayAt:(250 @ 250) |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1908 |
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
|
1909 |
" |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
1910 |
|
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1911 |
"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
|
1912 |
! |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
1913 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
1914 |
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
|
1915 |
"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
|
1916 |
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
|
1917 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
1918 |
^ self |
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1919 |
request:aString |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1920 |
displayAt:nil |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1921 |
centered:false |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1922 |
action:nil |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1923 |
initialAnswer:initial |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1924 |
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
|
1925 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
1926 |
" |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
1927 |
Dialog |
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1928 |
request:'enter a string:' |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1929 |
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
|
1930 |
" |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
1931 |
|
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1932 |
"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
|
1933 |
! |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
1934 |
|
718
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
1935 |
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
|
1936 |
"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
|
1937 |
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
|
1938 |
or cancelValue (if cancel was pressed)" |
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
1939 |
|
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
1940 |
^ self |
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
1941 |
request:aString |
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
1942 |
displayAt:nil |
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
1943 |
centered:false |
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
1944 |
action:nil |
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
1945 |
initialAnswer:initial |
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
1946 |
okLabel:okLabel |
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
1947 |
cancelLabel:nil |
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
1948 |
title:titleString |
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
1949 |
onCancel:cancelAction |
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
1950 |
|
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
1951 |
" |
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
1952 |
Dialog |
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
1953 |
request:'enter a string:' |
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
1954 |
initialAnswer:'the default' |
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
1955 |
onCancel:['foooo'] |
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
1956 |
" |
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
1957 |
|
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
1958 |
"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
|
1959 |
"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
|
1960 |
! |
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
1961 |
|
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
1962 |
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
|
1963 |
"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
|
1964 |
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
|
1965 |
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
|
1966 |
|
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1967 |
^ self |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1968 |
request:aString |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1969 |
displayAt:nil |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1970 |
centered:false |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1971 |
action:nil |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1972 |
initialAnswer:initial |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1973 |
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
|
1974 |
|
d3fe810390cb
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 |
" |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
1976 |
Dialog |
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1977 |
request:'enter a string:' |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1978 |
initialAnswer:'the default' |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1979 |
onCancel:['foooo'] |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1980 |
" |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1981 |
|
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1982 |
"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
|
1983 |
! |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1984 |
|
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1985 |
request:aString okLabel:okLabel |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1986 |
"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
|
1987 |
The okButton is labelled as okLabel. |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1988 |
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
|
1989 |
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
|
1990 |
|
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1991 |
^ self |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1992 |
request:aString |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1993 |
displayAt:nil |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1994 |
centered:false |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1995 |
action:nil |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1996 |
initialAnswer:'' |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1997 |
okLabel:okLabel |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1998 |
cancelLabel:nil |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1999 |
onCancel:'' |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2000 |
|
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2001 |
" |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2002 |
Dialog |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2003 |
request:'enter a string:' |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2004 |
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
|
2005 |
" |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2006 |
|
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2007 |
"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
|
2008 |
"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
|
2009 |
! |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2010 |
|
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2011 |
request:aString okLabel:okLabel onCancel:cancelValue |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2012 |
"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
|
2013 |
The okButton is labelled as okLabel. |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2014 |
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
|
2015 |
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
|
2016 |
|
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2017 |
^ self |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2018 |
request:aString |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2019 |
displayAt:nil |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2020 |
centered:false |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2021 |
action:nil |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2022 |
initialAnswer:'' |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2023 |
okLabel:okLabel |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2024 |
cancelLabel:nil |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2025 |
onCancel:cancelValue |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2026 |
|
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2027 |
" |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2028 |
Dialog |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2029 |
request:'enter a string:' |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2030 |
okLabel:'yes' |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2031 |
onCancel:nil |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2032 |
" |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2033 |
|
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2034 |
"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
|
2035 |
! |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2036 |
|
718
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
2037 |
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
|
2038 |
"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
|
2039 |
The okButton is labelled as okLabel. |
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
2040 |
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
|
2041 |
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
|
2042 |
|
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
2043 |
^ self |
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
2044 |
request:aString |
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
2045 |
displayAt:nil |
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
2046 |
centered:false |
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
2047 |
action:nil |
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
2048 |
initialAnswer:'' |
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
2049 |
okLabel:okLabel |
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
2050 |
cancelLabel:nil |
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
2051 |
title:titleString |
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
2052 |
onCancel:cancelValue |
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
2053 |
|
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
2054 |
" |
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
2055 |
Dialog |
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
2056 |
request:'enter a string:' |
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
2057 |
okLabel:'yes' |
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
2058 |
title:'foo' |
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
2059 |
onCancel:nil |
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
2060 |
" |
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
2061 |
|
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
2062 |
"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
|
2063 |
"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
|
2064 |
! |
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
2065 |
|
307
d3fe810390cb
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 |
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
|
2067 |
"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
|
2068 |
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
|
2069 |
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
|
2070 |
|
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2071 |
^ self |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2072 |
request:aString |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2073 |
displayAt:nil |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2074 |
centered:false |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2075 |
action:nil |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2076 |
initialAnswer:'' |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2077 |
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
|
2078 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2079 |
" |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2080 |
Dialog |
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2081 |
request:'enter a string:' |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
2082 |
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
|
2083 |
" |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2084 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2085 |
"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
|
2086 |
"Modified: 29.5.1996 / 14:28:59 / cg" |
100 | 2087 |
! |
2088 |
||
197 | 2089 |
requestPassword:aString |
2090 |
"launch a Dialog, which allows user to enter something invisibly. |
|
2091 |
Return the entered string (may be empty string) |
|
2092 |
or nil (if cancel was pressed)" |
|
100 | 2093 |
|
197 | 2094 |
^ EnterBox requestPassword:aString |
133 | 2095 |
|
2096 |
" |
|
2097 |
Dialog |
|
197 | 2098 |
requestPassword:'enter secret:' |
133 | 2099 |
" |
197 | 2100 |
|
2101 |
"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
|
2102 |
! ! |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2103 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2104 |
!DialogBox class methodsFor:'multiple choice dialogs'! |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2105 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2106 |
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
|
2107 |
"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
|
2108 |
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
|
2109 |
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
|
2110 |
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
|
2111 |
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
|
2112 |
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
|
2113 |
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
|
2114 |
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
|
2115 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2116 |
|box listView panel 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
|
2117 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2118 |
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
|
2119 |
(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
|
2120 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2121 |
list notNil ifTrue:[ |
557
1fbfacd0fed1
suppress scrollBar in choose if there is nothing to scroll
Claus Gittinger <cg@exept.de>
parents:
552
diff
changeset
|
2122 |
maxLines > list size ifTrue:[ |
1fbfacd0fed1
suppress scrollBar in choose if there is nothing to scroll
Claus Gittinger <cg@exept.de>
parents:
552
diff
changeset
|
2123 |
listView := ScrollableView for:SelectionInListView. |
1fbfacd0fed1
suppress scrollBar in choose if there is nothing to scroll
Claus Gittinger <cg@exept.de>
parents:
552
diff
changeset
|
2124 |
] ifFalse:[ |
1fbfacd0fed1
suppress scrollBar in choose if there is nothing to scroll
Claus Gittinger <cg@exept.de>
parents:
552
diff
changeset
|
2125 |
listView := SelectionInListView new. |
1fbfacd0fed1
suppress scrollBar in choose if there is nothing to scroll
Claus Gittinger <cg@exept.de>
parents:
552
diff
changeset
|
2126 |
listView level:-1. |
1fbfacd0fed1
suppress scrollBar in choose if there is nothing to scroll
Claus Gittinger <cg@exept.de>
parents:
552
diff
changeset
|
2127 |
]. |
1fbfacd0fed1
suppress scrollBar in choose if there is nothing to scroll
Claus Gittinger <cg@exept.de>
parents:
552
diff
changeset
|
2128 |
listView list:list. |
1fbfacd0fed1
suppress scrollBar in choose if there is nothing to scroll
Claus Gittinger <cg@exept.de>
parents:
552
diff
changeset
|
2129 |
listView doubleClickAction:[:line | box hide. ^ listValues at:line]. |
1fbfacd0fed1
suppress scrollBar in choose if there is nothing to scroll
Claus Gittinger <cg@exept.de>
parents:
552
diff
changeset
|
2130 |
box addComponent:listView indent:(ViewSpacing // 2) withHeight:(listView heightForLines:maxLines). |
1fbfacd0fed1
suppress scrollBar in choose if there is nothing to scroll
Claus Gittinger <cg@exept.de>
parents:
552
diff
changeset
|
2131 |
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
|
2132 |
]. |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2133 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2134 |
buttonLabels notNil ifTrue:[ |
557
1fbfacd0fed1
suppress scrollBar in choose if there is nothing to scroll
Claus Gittinger <cg@exept.de>
parents:
552
diff
changeset
|
2135 |
panel := HorizontalPanelView new. |
1fbfacd0fed1
suppress scrollBar in choose if there is nothing to scroll
Claus Gittinger <cg@exept.de>
parents:
552
diff
changeset
|
2136 |
panel horizontalLayout:#fitSpace. |
1fbfacd0fed1
suppress scrollBar in choose if there is nothing to scroll
Claus Gittinger <cg@exept.de>
parents:
552
diff
changeset
|
2137 |
buttonLabels keysAndValuesDo:[:index :label | |
1fbfacd0fed1
suppress scrollBar in choose if there is nothing to scroll
Claus Gittinger <cg@exept.de>
parents:
552
diff
changeset
|
2138 |
|b| |
1fbfacd0fed1
suppress scrollBar in choose if there is nothing to scroll
Claus Gittinger <cg@exept.de>
parents:
552
diff
changeset
|
2139 |
|
1fbfacd0fed1
suppress scrollBar in choose if there is nothing to scroll
Claus Gittinger <cg@exept.de>
parents:
552
diff
changeset
|
2140 |
b := Button label:label. |
1fbfacd0fed1
suppress scrollBar in choose if there is nothing to scroll
Claus Gittinger <cg@exept.de>
parents:
552
diff
changeset
|
2141 |
b action:[box hide. ^ buttonValues at:index]. |
1fbfacd0fed1
suppress scrollBar in choose if there is nothing to scroll
Claus Gittinger <cg@exept.de>
parents:
552
diff
changeset
|
2142 |
panel add:b. |
1fbfacd0fed1
suppress scrollBar in choose if there is nothing to scroll
Claus Gittinger <cg@exept.de>
parents:
552
diff
changeset
|
2143 |
box makeTabable:b. |
1fbfacd0fed1
suppress scrollBar in choose if there is nothing to scroll
Claus Gittinger <cg@exept.de>
parents:
552
diff
changeset
|
2144 |
]. |
1fbfacd0fed1
suppress scrollBar in choose if there is nothing to scroll
Claus Gittinger <cg@exept.de>
parents:
552
diff
changeset
|
2145 |
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
|
2146 |
]. |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2147 |
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
|
2148 |
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
|
2149 |
|
4bbc8deffc8c
allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents:
307
diff
changeset
|
2150 |
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
|
2151 |
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
|
2152 |
|
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2153 |
box showAtPointer. |
719
574be1981be0
destroy boxes from standard dialogs
Claus Gittinger <cg@exept.de>
parents:
718
diff
changeset
|
2154 |
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
|
2155 |
box accepted ifTrue:[ |
557
1fbfacd0fed1
suppress scrollBar in choose if there is nothing to scroll
Claus Gittinger <cg@exept.de>
parents:
552
diff
changeset
|
2156 |
(answer := listView selection) notNil ifTrue:[ |
1fbfacd0fed1
suppress scrollBar in choose if there is nothing to scroll
Claus Gittinger <cg@exept.de>
parents:
552
diff
changeset
|
2157 |
^ listValues at:answer |
1fbfacd0fed1
suppress scrollBar in choose if there is nothing to scroll
Claus Gittinger <cg@exept.de>
parents:
552
diff
changeset
|
2158 |
] |
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2159 |
]. |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2160 |
^ cancelBlock value |
197 | 2161 |
|
2162 |
" |
|
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2163 |
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
|
2164 |
|
655 | 2165 |
Transcript showCR:( |
557
1fbfacd0fed1
suppress scrollBar in choose if there is nothing to scroll
Claus Gittinger <cg@exept.de>
parents:
552
diff
changeset
|
2166 |
Dialog |
1fbfacd0fed1
suppress scrollBar in choose if there is nothing to scroll
Claus Gittinger <cg@exept.de>
parents:
552
diff
changeset
|
2167 |
choose:'choose any' |
1fbfacd0fed1
suppress scrollBar in choose if there is nothing to scroll
Claus Gittinger <cg@exept.de>
parents:
552
diff
changeset
|
2168 |
fromList:#('one' 'two' 'three' 'four') |
1fbfacd0fed1
suppress scrollBar in choose if there is nothing to scroll
Claus Gittinger <cg@exept.de>
parents:
552
diff
changeset
|
2169 |
values:#(1 2 3 4) |
1fbfacd0fed1
suppress scrollBar in choose if there is nothing to scroll
Claus Gittinger <cg@exept.de>
parents:
552
diff
changeset
|
2170 |
buttons:#('five' 'six' 'seven') |
1fbfacd0fed1
suppress scrollBar in choose if there is nothing to scroll
Claus Gittinger <cg@exept.de>
parents:
552
diff
changeset
|
2171 |
values:#(5 6 7) |
1fbfacd0fed1
suppress scrollBar in choose if there is nothing to scroll
Claus Gittinger <cg@exept.de>
parents:
552
diff
changeset
|
2172 |
lines:10 |
1fbfacd0fed1
suppress scrollBar in choose if there is nothing to scroll
Claus Gittinger <cg@exept.de>
parents:
552
diff
changeset
|
2173 |
cancel:nil |
1fbfacd0fed1
suppress scrollBar in choose if there is nothing to scroll
Claus Gittinger <cg@exept.de>
parents:
552
diff
changeset
|
2174 |
) |
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2175 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2176 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2177 |
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
|
2178 |
|
655 | 2179 |
Transcript showCR:( |
557
1fbfacd0fed1
suppress scrollBar in choose if there is nothing to scroll
Claus Gittinger <cg@exept.de>
parents:
552
diff
changeset
|
2180 |
Dialog |
1fbfacd0fed1
suppress scrollBar in choose if there is nothing to scroll
Claus Gittinger <cg@exept.de>
parents:
552
diff
changeset
|
2181 |
choose:'choose any' |
1fbfacd0fed1
suppress scrollBar in choose if there is nothing to scroll
Claus Gittinger <cg@exept.de>
parents:
552
diff
changeset
|
2182 |
fromList:#('one' 'two' 'three' 'four') |
1fbfacd0fed1
suppress scrollBar in choose if there is nothing to scroll
Claus Gittinger <cg@exept.de>
parents:
552
diff
changeset
|
2183 |
values:#(1 2 3 4) |
1fbfacd0fed1
suppress scrollBar in choose if there is nothing to scroll
Claus Gittinger <cg@exept.de>
parents:
552
diff
changeset
|
2184 |
buttons:nil |
1fbfacd0fed1
suppress scrollBar in choose if there is nothing to scroll
Claus Gittinger <cg@exept.de>
parents:
552
diff
changeset
|
2185 |
values:nil |
1fbfacd0fed1
suppress scrollBar in choose if there is nothing to scroll
Claus Gittinger <cg@exept.de>
parents:
552
diff
changeset
|
2186 |
lines:4 |
1fbfacd0fed1
suppress scrollBar in choose if there is nothing to scroll
Claus Gittinger <cg@exept.de>
parents:
552
diff
changeset
|
2187 |
cancel:nil |
1fbfacd0fed1
suppress scrollBar in choose if there is nothing to scroll
Claus Gittinger <cg@exept.de>
parents:
552
diff
changeset
|
2188 |
) |
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2189 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2190 |
|
558 | 2191 |
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
|
2192 |
|
655 | 2193 |
Transcript showCR:( |
557
1fbfacd0fed1
suppress scrollBar in choose if there is nothing to scroll
Claus Gittinger <cg@exept.de>
parents:
552
diff
changeset
|
2194 |
Dialog |
1fbfacd0fed1
suppress scrollBar in choose if there is nothing to scroll
Claus Gittinger <cg@exept.de>
parents:
552
diff
changeset
|
2195 |
choose:'choose any' |
1fbfacd0fed1
suppress scrollBar in choose if there is nothing to scroll
Claus Gittinger <cg@exept.de>
parents:
552
diff
changeset
|
2196 |
fromList:nil |
1fbfacd0fed1
suppress scrollBar in choose if there is nothing to scroll
Claus Gittinger <cg@exept.de>
parents:
552
diff
changeset
|
2197 |
values:nil |
1fbfacd0fed1
suppress scrollBar in choose if there is nothing to scroll
Claus Gittinger <cg@exept.de>
parents:
552
diff
changeset
|
2198 |
buttons:#('one' 'two' 'three' 'four') |
1fbfacd0fed1
suppress scrollBar in choose if there is nothing to scroll
Claus Gittinger <cg@exept.de>
parents:
552
diff
changeset
|
2199 |
values:#(1 2 3 4) |
558 | 2200 |
lines:nil |
557
1fbfacd0fed1
suppress scrollBar in choose if there is nothing to scroll
Claus Gittinger <cg@exept.de>
parents:
552
diff
changeset
|
2201 |
cancel:nil |
1fbfacd0fed1
suppress scrollBar in choose if there is nothing to scroll
Claus Gittinger <cg@exept.de>
parents:
552
diff
changeset
|
2202 |
) |
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2203 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2204 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2205 |
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
|
2206 |
|
655 | 2207 |
Transcript showCR:( |
557
1fbfacd0fed1
suppress scrollBar in choose if there is nothing to scroll
Claus Gittinger <cg@exept.de>
parents:
552
diff
changeset
|
2208 |
Dialog |
1fbfacd0fed1
suppress scrollBar in choose if there is nothing to scroll
Claus Gittinger <cg@exept.de>
parents:
552
diff
changeset
|
2209 |
choose:'choose example' |
1fbfacd0fed1
suppress scrollBar in choose if there is nothing to scroll
Claus Gittinger <cg@exept.de>
parents:
552
diff
changeset
|
2210 |
fromList:#('one' 'two' 'three' 'four') |
1fbfacd0fed1
suppress scrollBar in choose if there is nothing to scroll
Claus Gittinger <cg@exept.de>
parents:
552
diff
changeset
|
2211 |
values:#(1 2 3 4) |
1fbfacd0fed1
suppress scrollBar in choose if there is nothing to scroll
Claus Gittinger <cg@exept.de>
parents:
552
diff
changeset
|
2212 |
buttons:#('five' 'six' 'seven') |
1fbfacd0fed1
suppress scrollBar in choose if there is nothing to scroll
Claus Gittinger <cg@exept.de>
parents:
552
diff
changeset
|
2213 |
values:#(5 6 7) |
1fbfacd0fed1
suppress scrollBar in choose if there is nothing to scroll
Claus Gittinger <cg@exept.de>
parents:
552
diff
changeset
|
2214 |
lines:4 |
1fbfacd0fed1
suppress scrollBar in choose if there is nothing to scroll
Claus Gittinger <cg@exept.de>
parents:
552
diff
changeset
|
2215 |
cancel:[Transcript flash. #aborted] |
1fbfacd0fed1
suppress scrollBar in choose if there is nothing to scroll
Claus Gittinger <cg@exept.de>
parents:
552
diff
changeset
|
2216 |
) |
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2217 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2218 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2219 |
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
|
2220 |
|
655 | 2221 |
Transcript showCR:( |
557
1fbfacd0fed1
suppress scrollBar in choose if there is nothing to scroll
Claus Gittinger <cg@exept.de>
parents:
552
diff
changeset
|
2222 |
Dialog |
1fbfacd0fed1
suppress scrollBar in choose if there is nothing to scroll
Claus Gittinger <cg@exept.de>
parents:
552
diff
changeset
|
2223 |
choose:'choose any' |
1fbfacd0fed1
suppress scrollBar in choose if there is nothing to scroll
Claus Gittinger <cg@exept.de>
parents:
552
diff
changeset
|
2224 |
fromList:nil |
1fbfacd0fed1
suppress scrollBar in choose if there is nothing to scroll
Claus Gittinger <cg@exept.de>
parents:
552
diff
changeset
|
2225 |
values:nil |
1fbfacd0fed1
suppress scrollBar in choose if there is nothing to scroll
Claus Gittinger <cg@exept.de>
parents:
552
diff
changeset
|
2226 |
buttons:nil |
1fbfacd0fed1
suppress scrollBar in choose if there is nothing to scroll
Claus Gittinger <cg@exept.de>
parents:
552
diff
changeset
|
2227 |
values:nil |
1fbfacd0fed1
suppress scrollBar in choose if there is nothing to scroll
Claus Gittinger <cg@exept.de>
parents:
552
diff
changeset
|
2228 |
lines:nil |
1fbfacd0fed1
suppress scrollBar in choose if there is nothing to scroll
Claus Gittinger <cg@exept.de>
parents:
552
diff
changeset
|
2229 |
cancel:nil |
1fbfacd0fed1
suppress scrollBar in choose if there is nothing to scroll
Claus Gittinger <cg@exept.de>
parents:
552
diff
changeset
|
2230 |
) |
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2231 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2232 |
|
133 | 2233 |
" |
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2234 |
|
719
574be1981be0
destroy boxes from standard dialogs
Claus Gittinger <cg@exept.de>
parents:
718
diff
changeset
|
2235 |
"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
|
2236 |
! |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2237 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2238 |
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
|
2239 |
"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
|
2240 |
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
|
2241 |
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
|
2242 |
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
|
2243 |
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
|
2244 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2245 |
^ self |
314
705185e7001d
no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents:
312
diff
changeset
|
2246 |
choose:aString |
705185e7001d
no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents:
312
diff
changeset
|
2247 |
fromList:list |
705185e7001d
no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents:
312
diff
changeset
|
2248 |
values:listValues |
705185e7001d
no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents:
312
diff
changeset
|
2249 |
buttons:nil |
705185e7001d
no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents:
312
diff
changeset
|
2250 |
values:nil |
705185e7001d
no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents:
312
diff
changeset
|
2251 |
lines:maxLines |
705185e7001d
no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents:
312
diff
changeset
|
2252 |
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
|
2253 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2254 |
" |
655 | 2255 |
Transcript showCR:( |
314
705185e7001d
no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents:
312
diff
changeset
|
2256 |
Dialog |
705185e7001d
no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents:
312
diff
changeset
|
2257 |
choose:'choose any' |
705185e7001d
no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents:
312
diff
changeset
|
2258 |
fromList:#('one' 'two' 'three' 'four') |
705185e7001d
no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents:
312
diff
changeset
|
2259 |
values:#(1 2 3 4) |
705185e7001d
no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents:
312
diff
changeset
|
2260 |
lines:4 |
705185e7001d
no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents:
312
diff
changeset
|
2261 |
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
|
2262 |
) |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2263 |
|
655 | 2264 |
Transcript showCR:( |
314
705185e7001d
no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents:
312
diff
changeset
|
2265 |
Dialog |
705185e7001d
no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents:
312
diff
changeset
|
2266 |
choose:'choose example' |
705185e7001d
no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents:
312
diff
changeset
|
2267 |
fromList:#('one' 'two' 'three' 'four') |
705185e7001d
no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents:
312
diff
changeset
|
2268 |
values:#(1 2 3 4) |
705185e7001d
no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents:
312
diff
changeset
|
2269 |
lines:4 |
705185e7001d
no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents:
312
diff
changeset
|
2270 |
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
|
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 |
" |
d3fe810390cb
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 |
|
d3fe810390cb
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 |
"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
|
2275 |
! |
d3fe810390cb
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 |
|
d3fe810390cb
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 |
choose:aString labels:buttonLabels values:values default: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
|
2278 |
"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
|
2279 |
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
|
2280 |
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
|
2281 |
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
|
2282 |
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
|
2283 |
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
|
2284 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2285 |
|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
|
2286 |
|
d3fe810390cb
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 |
box := OptionBox title:aString numberOfOptions:buttonLabels size. |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2288 |
box buttonTitles:(self classResources array:buttonLabels) |
719
574be1981be0
destroy boxes from standard dialogs
Claus Gittinger <cg@exept.de>
parents:
718
diff
changeset
|
2289 |
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
|
2290 |
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
|
2291 |
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
|
2292 |
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
|
2293 |
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
|
2294 |
box showAtPointer. |
719
574be1981be0
destroy boxes from standard dialogs
Claus Gittinger <cg@exept.de>
parents:
718
diff
changeset
|
2295 |
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
|
2296 |
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
|
2297 |
^ 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
|
2298 |
|
d3fe810390cb
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 |
"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
|
2300 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2301 |
Dialog |
719
574be1981be0
destroy boxes from standard dialogs
Claus Gittinger <cg@exept.de>
parents:
718
diff
changeset
|
2302 |
choose:'choose any' |
574be1981be0
destroy boxes from standard dialogs
Claus Gittinger <cg@exept.de>
parents:
718
diff
changeset
|
2303 |
labels:#('one' 'two' 'three' 'four') |
574be1981be0
destroy boxes from standard dialogs
Claus Gittinger <cg@exept.de>
parents:
718
diff
changeset
|
2304 |
values:#(1 2 3 4) |
574be1981be0
destroy boxes from standard dialogs
Claus Gittinger <cg@exept.de>
parents:
718
diff
changeset
|
2305 |
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
|
2306 |
|
d3fe810390cb
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 |
Dialog |
719
574be1981be0
destroy boxes from standard dialogs
Claus Gittinger <cg@exept.de>
parents:
718
diff
changeset
|
2308 |
choose:'choose any' |
574be1981be0
destroy boxes from standard dialogs
Claus Gittinger <cg@exept.de>
parents:
718
diff
changeset
|
2309 |
labels:#('cancel' 'foo' 'bar' 'baz') |
574be1981be0
destroy boxes from standard dialogs
Claus Gittinger <cg@exept.de>
parents:
718
diff
changeset
|
2310 |
values:#(nil foo bar baz) |
574be1981be0
destroy boxes from standard dialogs
Claus Gittinger <cg@exept.de>
parents:
718
diff
changeset
|
2311 |
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
|
2312 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2313 |
Dialog |
719
574be1981be0
destroy boxes from standard dialogs
Claus Gittinger <cg@exept.de>
parents:
718
diff
changeset
|
2314 |
choose:'choose any' |
574be1981be0
destroy boxes from standard dialogs
Claus Gittinger <cg@exept.de>
parents:
718
diff
changeset
|
2315 |
labels:#('one' 'two' 'three' 'four') |
574be1981be0
destroy boxes from standard dialogs
Claus Gittinger <cg@exept.de>
parents:
718
diff
changeset
|
2316 |
values:#(1 2 3 4) |
574be1981be0
destroy boxes from standard dialogs
Claus Gittinger <cg@exept.de>
parents:
718
diff
changeset
|
2317 |
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
|
2318 |
" |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2319 |
|
719
574be1981be0
destroy boxes from standard dialogs
Claus Gittinger <cg@exept.de>
parents:
718
diff
changeset
|
2320 |
"Modified: 29.5.1996 / 15:27:32 / cg" |
100 | 2321 |
! ! |
2322 |
||
197 | 2323 |
!DialogBox methodsFor:'accessing'! |
76 | 2324 |
|
197 | 2325 |
abortText:aString |
2326 |
"define the label in the abort-button" |
|
2327 |
||
2328 |
|oldSize| |
|
121 | 2329 |
|
197 | 2330 |
aString ~= abortButton label ifTrue:[ |
2331 |
oldSize := abortButton extent. |
|
2332 |
abortButton label:aString. |
|
2333 |
abortButton resize. |
|
2334 |
abortButton extent ~= oldSize ifTrue:[ |
|
2335 |
shown ifTrue:[self resize] |
|
2336 |
] |
|
2337 |
] |
|
121 | 2338 |
! |
2339 |
||
197 | 2340 |
okText:aString |
2341 |
"define the text in the ok-button" |
|
2342 |
||
2343 |
|oldSize| |
|
2344 |
||
2345 |
aString ~= okButton label ifTrue:[ |
|
2346 |
oldSize := okButton extent. |
|
2347 |
okButton label:aString. |
|
2348 |
okButton resize. |
|
2349 |
okButton extent ~= oldSize ifTrue:[ |
|
2350 |
shown ifTrue:[self resize] |
|
2351 |
] |
|
2352 |
] |
|
2353 |
! |
|
125 | 2354 |
|
197 | 2355 |
okText:okString abortText:abortString |
2356 |
"set both texts displayed in the buttons" |
|
2357 |
||
2358 |
(abortString ~= abortButton label |
|
2359 |
or:[okString ~= okButton label]) ifTrue:[ |
|
2360 |
okButton label:okString. |
|
2361 |
abortButton label:abortString. |
|
2362 |
okButton resize. |
|
2363 |
abortButton resize. |
|
2364 |
shown ifTrue:[self resize] |
|
2365 |
] |
|
2366 |
! ! |
|
2367 |
||
2368 |
!DialogBox methodsFor:'accessing-behavior'! |
|
2369 |
||
2370 |
abortAction:aBlock |
|
2371 |
"define the action to be performed when abort is pressed" |
|
2372 |
||
2373 |
abortAction := aBlock |
|
125 | 2374 |
! |
2375 |
||
280
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
2376 |
acceptCheck:aBlock |
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
2377 |
"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
|
2378 |
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
|
2379 |
otherwise not." |
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
2380 |
|
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
2381 |
acceptCheck := aBlock |
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
2382 |
! |
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
2383 |
|
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
2384 |
acceptOnLeave:aBoolean |
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
2385 |
"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
|
2386 |
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
|
2387 |
|
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
2388 |
acceptOnLeave := aBoolean. |
551
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
2389 |
|
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
2390 |
"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
|
2391 |
! |
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
2392 |
|
197 | 2393 |
acceptReturnAsOK:aBoolean |
2394 |
"turn on/off interpretation of return-key as ok. |
|
2395 |
Default is on" |
|
2396 |
||
2397 |
acceptReturnAsOK := aBoolean. |
|
2398 |
okButton notNil ifTrue:[ |
|
2399 |
okButton isReturnButton:aBoolean. |
|
2400 |
] |
|
2401 |
! |
|
2402 |
||
2403 |
action:aBlock |
|
2404 |
"set the action to be performed when user presses ok-button; |
|
2405 |
aBlock must be nil or a block. This method simply |
|
2406 |
reuses okAction: and has been added for a consistent action-setting |
|
2407 |
protocol." |
|
76 | 2408 |
|
197 | 2409 |
self okAction:aBlock |
2410 |
! |
|
2411 |
||
280
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
2412 |
focusOnField:anInputField |
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
2413 |
inputFieldGroup makeActive:anInputField |
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
2414 |
|
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
2415 |
|
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
2416 |
|
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
2417 |
|
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
2418 |
|
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
2419 |
|
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
2420 |
|
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
2421 |
! |
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
2422 |
|
551
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
2423 |
focusToOKOnLeave:aBoolean |
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
2424 |
"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
|
2425 |
or cursor key. |
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
2426 |
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
|
2427 |
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
|
2428 |
the dialog is accepted & closed." |
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
2429 |
|
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
2430 |
focusToOKOnLeave := aBoolean. |
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
2431 |
|
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
2432 |
"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
|
2433 |
"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
|
2434 |
! |
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
2435 |
|
280
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
2436 |
hideOnAccept:aBoolean |
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
2437 |
"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
|
2438 |
The default is true" |
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
2439 |
|
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
2440 |
hideOnAccept := aBoolean |
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
2441 |
! |
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
2442 |
|
593 | 2443 |
makeTabable:aComponentOrSubcomponent |
2444 |
"add a component (usually a subcomponent, of which the dialog |
|
2445 |
does not know) to the list of tabable ones (i.e. those, that can be |
|
2446 |
stepped through via FocusNext/FocusPrevious). |
|
2447 |
Toplevel tabable components are usually added with #addComponent:tabable:" |
|
2448 |
||
2449 |
tabableElements isNil ifTrue:[ |
|
2450 |
tabableElements := OrderedCollection new |
|
2451 |
]. |
|
2452 |
tabableElements add:aComponentOrSubcomponent. |
|
2453 |
||
2454 |
(aComponentOrSubcomponent isInputField) ifTrue:[ |
|
2455 |
self addToInputFieldGroup:aComponentOrSubcomponent |
|
2456 |
]. |
|
2457 |
||
2458 |
"Modified: 27.4.1996 / 17:55:44 / cg" |
|
2459 |
! |
|
2460 |
||
2461 |
makeTabable:aComponentOrSubcomponent before:anotherComponent |
|
2462 |
"add a component (usually a subcomponent, of which the dialog |
|
2463 |
does not know) to the list of tabable ones (i.e. those, that can be |
|
2464 |
stepped through via FocusNext/FocusPrevious). |
|
2465 |
Toplevel tabable components are usually added with #addComponent:tabable:" |
|
2466 |
||
2467 |
tabableElements isNil ifTrue:[ |
|
2468 |
tabableElements := OrderedCollection new |
|
2469 |
]. |
|
2470 |
anotherComponent isNil ifTrue:[ |
|
2471 |
tabableElements addFirst:aComponentOrSubcomponent |
|
2472 |
] ifFalse:[ |
|
2473 |
tabableElements add:aComponentOrSubcomponent before:anotherComponent. |
|
2474 |
]. |
|
2475 |
||
2476 |
(aComponentOrSubcomponent isInputField) ifTrue:[ |
|
2477 |
self addToInputFieldGroup:aComponentOrSubcomponent |
|
2478 |
]. |
|
2479 |
||
2480 |
"Modified: 27.4.1996 / 17:55:52 / cg" |
|
2481 |
! |
|
2482 |
||
197 | 2483 |
okAction:aBlock |
2484 |
"define the action to be performed when ok is pressed" |
|
133 | 2485 |
|
197 | 2486 |
okAction := aBlock |
2487 |
! ! |
|
2488 |
||
2489 |
!DialogBox methodsFor:'accessing-components'! |
|
2490 |
||
2491 |
abortButton |
|
2492 |
"return the abortButton - this access is provided to allow |
|
2493 |
setting the buttons look (for example: colors or font)" |
|
2494 |
||
2495 |
^ abortButton |
|
76 | 2496 |
! |
2497 |
||
197 | 2498 |
okButton |
2499 |
"return the okButton - this access is provided to allow |
|
2500 |
setting the buttons look (for example: colors or font)" |
|
76 | 2501 |
|
197 | 2502 |
^ okButton |
2503 |
! ! |
|
155 | 2504 |
|
197 | 2505 |
!DialogBox methodsFor:'accessing-elements'! |
2506 |
||
2507 |
componentAt:name |
|
680 | 2508 |
"retrieve a component by name - to access it, it must have been |
2509 |
named previously with #names:as:" |
|
2510 |
||
197 | 2511 |
bindings isNil ifTrue:[^ nil]. |
2512 |
^ bindings at:name ifAbsent:nil |
|
680 | 2513 |
|
2514 |
"Modified: 25.5.1996 / 11:17:36 / cg" |
|
76 | 2515 |
! |
2516 |
||
280
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
2517 |
inputFieldGroup |
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
2518 |
^ inputFieldGroup |
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
2519 |
! |
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
2520 |
|
197 | 2521 |
name:element as:name |
680 | 2522 |
"assign a name to a component. This can be done during construction, |
2523 |
to allow later access to the components (i.e. without a need to |
|
2524 |
remember them in some instVars)" |
|
2525 |
||
197 | 2526 |
bindings isNil ifTrue:[ |
680 | 2527 |
bindings := IdentityDictionary new. |
197 | 2528 |
]. |
2529 |
bindings at:name put:element |
|
680 | 2530 |
|
2531 |
"Modified: 25.5.1996 / 11:20:15 / cg" |
|
197 | 2532 |
! ! |
2533 |
||
2534 |
!DialogBox methodsFor:'accessing-models'! |
|
76 | 2535 |
|
197 | 2536 |
accept |
2537 |
"return the valueHolder holding true when the box |
|
2538 |
is accepted, false if closed via the windowManager or |
|
2539 |
the cancel button. |
|
2540 |
This is confusing: this method was originally called #acceptValue, |
|
2541 |
but renamed for compatibility with ST-80. |
|
2542 |
This looks like a bad name to me, since in most other situations, #accept |
|
2543 |
is used to force an accept, not to return some valueHolder ...)." |
|
2544 |
||
2545 |
^ acceptValue |
|
280
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
2546 |
! |
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
2547 |
|
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
2548 |
acceptChannel:aValueHolder |
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
2549 |
"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
|
2550 |
is accepted" |
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
2551 |
|
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
2552 |
acceptValue := aValueHolder |
76 | 2553 |
! ! |
2554 |
||
120 | 2555 |
!DialogBox methodsFor:'construction-adding'! |
2556 |
||
593 | 2557 |
addComponent:aComponent |
2558 |
"add any component with its preferred height and full width. |
|
2559 |
Returns the component." |
|
2560 |
||
2561 |
^ self addComponent:aComponent indent:nil tabable:false |
|
2562 |
||
2563 |
"Modified: 9.2.1996 / 22:22:41 / cg" |
|
2564 |
! |
|
2565 |
||
2566 |
addComponent:aComponent indent:indent |
|
2567 |
"add any component with its preferred height and full width. |
|
2568 |
The indent is temporarily changed to indent. |
|
2569 |
Returns the component." |
|
2570 |
||
2571 |
^ self addComponent:aComponent indent:indent tabable:false |
|
2572 |
||
2573 |
"Modified: 9.2.1996 / 22:22:44 / cg" |
|
2574 |
! |
|
2575 |
||
2576 |
addComponent:aComponent indent:indent tabable:tabable |
|
2577 |
"add any component with its preferred height and full width. |
|
2578 |
The indent is temporarily changed to indent. |
|
2579 |
Returns the component." |
|
2580 |
||
2581 |
|oldLeft oldRight result| |
|
2582 |
||
2583 |
oldLeft := leftIndent. |
|
2584 |
oldRight := rightIndent. |
|
2585 |
indent notNil ifTrue:[ |
|
2586 |
leftIndent := rightIndent := indent. |
|
2587 |
]. |
|
2588 |
result := self addComponent:aComponent tabable:tabable tabbedComponent:aComponent. |
|
2589 |
leftIndent := oldLeft. |
|
2590 |
rightIndent := oldRight. |
|
2591 |
^ result |
|
2592 |
||
2593 |
"Modified: 9.2.1996 / 22:22:50 / cg" |
|
2594 |
! |
|
2595 |
||
2596 |
addComponent:aComponent indent:indent withExtent:ext |
|
2597 |
"add any component with some given extent. |
|
2598 |
Returns the component." |
|
2599 |
||
2600 |
|fullSize lI rI| |
|
2601 |
||
2602 |
indent isNil ifTrue:[ |
|
2603 |
lI := leftIndent. |
|
2604 |
rI := rightIndent. |
|
2605 |
] ifFalse:[ |
|
2606 |
lI := rI := indent |
|
2607 |
]. |
|
2608 |
||
2609 |
self basicAddComponent:aComponent. |
|
2610 |
fullSize := ext + (lI + rI @ 0). |
|
2611 |
aComponent extent:fullSize. |
|
2612 |
aComponent origin:0.0@yPosition; |
|
2613 |
leftInset:lI; |
|
2614 |
rightInset:rI. |
|
2615 |
yPosition := yPosition + aComponent height + ViewSpacing. |
|
2616 |
width := fullSize x max:width. |
|
2617 |
needResize := true. |
|
2618 |
^ aComponent |
|
2619 |
||
2620 |
"Modified: 9.2.1996 / 22:22:54 / cg" |
|
2621 |
! |
|
2622 |
||
2623 |
addComponent:aComponent indent:indent withHeight:height |
|
2624 |
"add any component with some given height and full width. |
|
2625 |
Returns the component." |
|
2626 |
||
2627 |
|lI rI| |
|
2628 |
||
2629 |
indent isNil ifTrue:[ |
|
2630 |
lI := leftIndent. |
|
2631 |
rI := rightIndent. |
|
2632 |
] ifFalse:[ |
|
2633 |
lI := rI := indent |
|
2634 |
]. |
|
2635 |
self basicAddComponent:aComponent. |
|
2636 |
aComponent height:height. |
|
2637 |
aComponent origin:0.0@yPosition; |
|
2638 |
width:1.0; |
|
2639 |
leftInset:lI; |
|
2640 |
rightInset:rI. |
|
2641 |
yPosition := yPosition + "aComponent" height + ViewSpacing. |
|
2642 |
needResize := true. |
|
2643 |
^ aComponent |
|
2644 |
||
2645 |
"Modified: 9.2.1996 / 22:22:58 / cg" |
|
2646 |
! |
|
2647 |
||
2648 |
addComponent:aComponent tabable:tabable |
|
2649 |
"add any component with its preferred height and full width. |
|
2650 |
Returns the component." |
|
2651 |
||
2652 |
^ self addComponent:aComponent tabable:tabable tabbedComponent:aComponent |
|
2653 |
||
2654 |
"Modified: 9.2.1996 / 22:23:04 / cg" |
|
2655 |
! |
|
2656 |
||
2657 |
addComponent:aComponent tabable:tabable tabbedComponent:subComponent |
|
2658 |
"add any component with its preferred height and full width. |
|
2659 |
Returns the component." |
|
2660 |
||
2661 |
tabable ifTrue:[ |
|
2662 |
tabableElements isNil ifTrue:[ |
|
2663 |
tabableElements := OrderedCollection new |
|
2664 |
]. |
|
2665 |
tabableElements add:subComponent |
|
2666 |
]. |
|
2667 |
^ self addComponent:aComponent |
|
2668 |
withHeight:(aComponent preferredExtent y). |
|
2669 |
||
2670 |
"Modified: 9.2.1996 / 22:23:07 / cg" |
|
2671 |
! |
|
2672 |
||
2673 |
addComponent:aComponent withExtent:ext |
|
2674 |
"add any component with some given extent. |
|
2675 |
Returns the component." |
|
2676 |
||
2677 |
^ self addComponent:aComponent indent:nil withExtent:ext |
|
2678 |
||
2679 |
"Modified: 9.2.1996 / 22:23:11 / cg" |
|
2680 |
! |
|
2681 |
||
2682 |
addComponent:aComponent withHeight:height |
|
2683 |
"add any component with some given height and full width. |
|
2684 |
Returns the component." |
|
2685 |
||
2686 |
^ self addComponent:aComponent indent:nil withHeight:height |
|
2687 |
||
2688 |
"Modified: 9.2.1996 / 22:23:15 / cg" |
|
2689 |
! |
|
2690 |
||
2691 |
addLabelledField:aView label:labelString adjust:labelAdjust tabable:tabable separateAtX:relativeX |
|
2692 |
"add a label and some view side-by-side. |
|
2693 |
The labels goes from 0.0 to relativeX; the inputField from relativeX to 1.0. |
|
2694 |
The labels string is defined by labelString and adjusted according to labelAdjust. |
|
2695 |
The inputField gets model as its model. |
|
2696 |
Return the inputField." |
|
2697 |
||
2698 |
|y lbl max| |
|
2699 |
||
2700 |
y := self yPosition. |
|
2701 |
lbl := Label label:labelString. |
|
2702 |
max := lbl preferredExtent y max:(aView preferredExtent y). |
|
2703 |
||
2704 |
self addComponent:lbl indent:leftIndent withHeight:max. |
|
2705 |
lbl rightInset:0. |
|
2706 |
lbl width:relativeX; adjust:labelAdjust; borderWidth:0. |
|
2707 |
||
2708 |
self yPosition:y. |
|
2709 |
self addComponent:aView tabable:tabable. |
|
2710 |
aView leftInset:ViewSpacing. |
|
2711 |
aView width:(1.0 - relativeX); left:relativeX. |
|
2712 |
||
2713 |
aView isInputField ifTrue:[ |
|
2714 |
self addToInputFieldGroup:aView |
|
2715 |
]. |
|
2716 |
||
2717 |
^ aView |
|
2718 |
||
2719 |
" |
|
2720 |
|dialog model field| |
|
2721 |
||
2722 |
model := '' asValue. |
|
2723 |
||
2724 |
dialog := DialogBox new. |
|
2725 |
||
2726 |
field := dialog |
|
2727 |
addLabelledField:(EditField on:model) label:'input here:' |
|
2728 |
adjust:#left |
|
2729 |
tabable:true |
|
2730 |
separateAtX:0.3. |
|
2731 |
||
2732 |
dialog addAbortButton; addOkButton. |
|
2733 |
dialog open. |
|
655 | 2734 |
dialog accepted ifTrue:[Transcript showCR:model value]. |
593 | 2735 |
" |
2736 |
||
2737 |
" |
|
2738 |
|dialog model field| |
|
2739 |
||
2740 |
model := SelectionInList new. |
|
2741 |
model list:#('foo' 'bar' 'baz'). |
|
2742 |
model selectionIndex:2. |
|
2743 |
||
2744 |
dialog := DialogBox new. |
|
2745 |
||
2746 |
field := dialog |
|
2747 |
addLabelledField:(PopUpList on:model) label:'select here:' |
|
2748 |
adjust:#left |
|
2749 |
tabable:true |
|
2750 |
separateAtX:0.3. |
|
2751 |
||
2752 |
dialog addAbortButton; addOkButton. |
|
2753 |
dialog open. |
|
655 | 2754 |
dialog accepted ifTrue:[Transcript showCR:model value]. |
593 | 2755 |
" |
2756 |
||
2757 |
"Created: 13.4.1996 / 13:41:31 / cg" |
|
2758 |
"Modified: 19.4.1996 / 17:39:46 / cg" |
|
2759 |
! |
|
2760 |
||
2761 |
addTextLabel:aString |
|
2762 |
"create a text label - the name has been choosen for ST-80 compatibility; |
|
2763 |
however, ST/X labels allow image labels too. |
|
2764 |
Returns the label." |
|
2765 |
||
2766 |
|l| |
|
2767 |
||
2768 |
l := Label new label:aString. |
|
2769 |
l borderWidth:0. |
|
2770 |
self addComponent:l. |
|
2771 |
^ l |
|
2772 |
||
2773 |
" |
|
2774 |
|b| |
|
2775 |
||
2776 |
b := DialogBox new. |
|
2777 |
b addTextLabel:'hello'. |
|
2778 |
b showAtPointer |
|
2779 |
" |
|
2780 |
" |
|
2781 |
|b| |
|
2782 |
||
2783 |
b := DialogBox new. |
|
2784 |
b leftIndent:100. |
|
2785 |
b addTextLabel:'hello'. |
|
2786 |
b leftIndent:0. |
|
2787 |
b addTextLabel:'world'. |
|
2788 |
b showAtPointer |
|
2789 |
" |
|
2790 |
" |
|
2791 |
|b| |
|
2792 |
||
2793 |
b := DialogBox new. |
|
2794 |
b addTextLabel:'hello'. |
|
2795 |
b addTextLabel:'world'. |
|
2796 |
b addOkButton. |
|
2797 |
b showAtPointer |
|
2798 |
" |
|
2799 |
" |
|
2800 |
|b| |
|
2801 |
||
2802 |
b := DialogBox new. |
|
2803 |
b addTextLabel:'hello'. |
|
2804 |
(b addTextLabel:'world') foregroundColor:Color red. |
|
2805 |
b addOkButton. |
|
2806 |
b showAtPointer |
|
2807 |
" |
|
2808 |
" |
|
2809 |
|b| |
|
2810 |
||
2811 |
b := DialogBox new. |
|
2812 |
b addTextLabel:'hello world\\How about this ?' withCRs. |
|
2813 |
b addOkButton. |
|
2814 |
b showAtPointer |
|
2815 |
" |
|
2816 |
" |
|
2817 |
|b| |
|
2818 |
||
2819 |
b := DialogBox new. |
|
2820 |
b addTextLabel:'hello world\\How about this ?' withCRs. |
|
2821 |
b addTextLabel:'not bad'. |
|
2822 |
b addAbortButton. |
|
2823 |
b addOkButton. |
|
2824 |
b showAtPointer |
|
2825 |
" |
|
2826 |
! |
|
2827 |
||
2828 |
addToInputFieldGroup:aComponentOrSubcomponent |
|
2829 |
"add a component to the input group. |
|
2830 |
The argument, aComponentOrSubcomponent may even be a nested subcomponent of |
|
2831 |
a topLevel component." |
|
2832 |
||
2833 |
inputFieldGroup isNil ifTrue:[ |
|
2834 |
inputFieldGroup := EnterFieldGroup new. |
|
2835 |
inputFieldGroup leaveAction:[self lastFieldLeft]. |
|
2836 |
aComponentOrSubcomponent hasKeyboardFocus:true. |
|
2837 |
]. |
|
2838 |
inputFieldGroup add:aComponentOrSubcomponent. |
|
2839 |
self delegate:(KeyboardForwarder to:inputFieldGroup condition:#noFocus). |
|
2840 |
||
2841 |
"Created: 9.2.1996 / 20:23:04 / cg" |
|
2842 |
"Modified: 27.4.1996 / 17:54:51 / cg" |
|
2843 |
! ! |
|
2844 |
||
2845 |
!DialogBox methodsFor:'construction-buttons'! |
|
2846 |
||
197 | 2847 |
addAbortButton |
2848 |
"create an abortButton - to be sent from redefined initialize |
|
162 | 2849 |
methods in subclasses or when creating a box programmatically. |
2850 |
Returns the button." |
|
2851 |
||
197 | 2852 |
^ self addAbortButtonLabelled:nil |
122 | 2853 |
! |
120 | 2854 |
|
162 | 2855 |
addAbortButton:aButton |
2856 |
"add an already created abortButton - to be sent from redefined initialize |
|
2857 |
methods in subclasses or when creating a box programmatically. |
|
2858 |
Returns the button." |
|
2859 |
||
2860 |
abortButton := aButton. |
|
2861 |
aButton model:self; change:#abortPressed. |
|
2862 |
^ self addButton:aButton. |
|
2863 |
||
2864 |
"Created: 17.9.1995 / 20:17:26 / claus" |
|
2865 |
! |
|
2866 |
||
122 | 2867 |
addAbortButtonLabelled:buttonLabel |
2868 |
"create an abortButton with a label - to be sent from redefined initialize |
|
2869 |
methods in subclasses or when creating a box programmatically. |
|
2870 |
A nil argument creates one with the default label. |
|
2871 |
Returns the button." |
|
2872 |
||
162 | 2873 |
|aButton| |
2874 |
||
2875 |
aButton := Button abortButton. |
|
2876 |
buttonLabel notNil ifTrue:[aButton label:buttonLabel]. |
|
2877 |
^ self addAbortButton:aButton |
|
2878 |
||
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
2879 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
2880 |
|dialog| |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
2881 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
2882 |
dialog := DialogBox new. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
2883 |
dialog addAbortButtonLabelled:'get out of here'. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
2884 |
dialog addOkButtonLabelled:'yes thats ok'. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
2885 |
dialog open. |
655 | 2886 |
dialog accepted ifTrue:[Transcript showCR:'yes']. |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
2887 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
2888 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
2889 |
"Modified: 9.2.1996 / 22:09:40 / cg" |
120 | 2890 |
! |
76 | 2891 |
|
197 | 2892 |
addButton:aButton |
2893 |
"add a button into the buttonPanel. |
|
122 | 2894 |
Returns the button." |
120 | 2895 |
|
197 | 2896 |
^ self addButton:aButton after:nil |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
2897 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
2898 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
2899 |
|dialog| |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
2900 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
2901 |
dialog := DialogBox new. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
2902 |
dialog addAbortButton. |
655 | 2903 |
dialog addButton:(Button label:'foo' action:[Transcript showCR:'foo']). |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
2904 |
dialog addOkButton. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
2905 |
dialog open. |
655 | 2906 |
dialog accepted ifTrue:[Transcript showCR:'yes']. |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
2907 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
2908 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
2909 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
2910 |
|dialog| |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
2911 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
2912 |
dialog := DialogBox new. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
2913 |
dialog addAbortButton. |
655 | 2914 |
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
|
2915 |
dialog addOkButton. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
2916 |
dialog open. |
655 | 2917 |
dialog accepted ifTrue:[Transcript showCR:'yes']. |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
2918 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
2919 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
2920 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
2921 |
|dialog| |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
2922 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
2923 |
dialog := DialogBox new. |
655 | 2924 |
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
|
2925 |
dialog addAbortButton. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
2926 |
dialog addOkButton. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
2927 |
dialog open. |
655 | 2928 |
dialog accepted ifTrue:[Transcript showCR:'yes']. |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
2929 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
2930 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
2931 |
"Modified: 9.2.1996 / 22:14:17 / cg" |
197 | 2932 |
! |
2933 |
||
2934 |
addButton:aButton after:someOtherButtonOrNil |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
2935 |
"add a button into the buttonPanel. |
197 | 2936 |
If the argument someOtherButtonOrNil is nil, the button is |
2937 |
added at the end." |
|
2938 |
||
2939 |
|h| |
|
2940 |
||
2941 |
buttonPanel addSubView:aButton after:someOtherButtonOrNil. |
|
2942 |
buttonPanel subViews size > 1 ifTrue:[ |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
2943 |
buttonPanel horizontalLayout:#fitSpace. |
197 | 2944 |
]. |
2945 |
(h := (aButton heightIncludingBorder + (ViewSpacing * 2))) > buttonPanel topInset ifTrue:[ |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
2946 |
buttonPanel topInset:h negated |
197 | 2947 |
]. |
310
4bbc8deffc8c
allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents:
307
diff
changeset
|
2948 |
needResize := true. |
197 | 2949 |
^ aButton |
310
4bbc8deffc8c
allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents:
307
diff
changeset
|
2950 |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
2951 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
2952 |
|dialog| |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
2953 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
2954 |
dialog := DialogBox new. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
2955 |
dialog addAbortButton. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
2956 |
dialog addOkButton. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
2957 |
dialog addButton:(Button |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
2958 |
label:'foo' |
655 | 2959 |
action:[dialog hide. Transcript showCR:'foo']) |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
2960 |
after:(dialog okButton). |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
2961 |
dialog open. |
655 | 2962 |
dialog accepted ifTrue:[Transcript showCR:'yes']. |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
2963 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
2964 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
2965 |
|dialog| |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
2966 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
2967 |
dialog := DialogBox new. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
2968 |
dialog addAbortButton. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
2969 |
dialog addOkButton. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
2970 |
dialog addButton:(Button |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
2971 |
label:'foo' |
655 | 2972 |
action:[dialog hide. Transcript showCR:'foo']) |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
2973 |
after:(dialog abortButton). |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
2974 |
dialog open. |
655 | 2975 |
dialog accepted ifTrue:[Transcript showCR:'yes']. |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
2976 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
2977 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
2978 |
|dialog| |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
2979 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
2980 |
dialog := DialogBox new. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
2981 |
dialog addAbortButton. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
2982 |
dialog addOkButton. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
2983 |
dialog addButton:(Button |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
2984 |
label:'foo' |
655 | 2985 |
action:[dialog hide. Transcript showCR:'foo']) |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
2986 |
after:nil. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
2987 |
dialog open. |
655 | 2988 |
dialog accepted ifTrue:[Transcript showCR:'yes']. |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
2989 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
2990 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
2991 |
"Modified: 9.2.1996 / 22:13:51 / cg" |
197 | 2992 |
! |
2993 |
||
353
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
2994 |
addButton:aButton before:someOtherButtonOrNil |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
2995 |
"add a button into the buttonPanel. |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
2996 |
If the argument someOtherButtonOrNil is nil, the button is |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
2997 |
added upFront." |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
2998 |
|
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
2999 |
|h| |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
3000 |
|
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
3001 |
buttonPanel addSubView:aButton before:someOtherButtonOrNil. |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
3002 |
buttonPanel subViews size > 1 ifTrue:[ |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
3003 |
buttonPanel horizontalLayout:#fitSpace. |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
3004 |
]. |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
3005 |
(h := (aButton heightIncludingBorder + (ViewSpacing * 2))) > buttonPanel topInset ifTrue:[ |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
3006 |
buttonPanel topInset:h negated |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
3007 |
]. |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
3008 |
needResize := true. |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
3009 |
^ aButton |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
3010 |
|
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
3011 |
" |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
3012 |
|dialog| |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
3013 |
|
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
3014 |
dialog := DialogBox new. |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
3015 |
dialog addAbortButton. |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
3016 |
dialog addOkButton. |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
3017 |
dialog addButton:(Button |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
3018 |
label:'foo' |
655 | 3019 |
action:[dialog hide. Transcript showCR:'foo']) |
353
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
3020 |
before:(dialog okButton). |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
3021 |
dialog open. |
655 | 3022 |
dialog accepted ifTrue:[Transcript showCR:'yes']. |
353
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
3023 |
" |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
3024 |
" |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
3025 |
|dialog| |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
3026 |
|
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
3027 |
dialog := DialogBox new. |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
3028 |
dialog addAbortButton. |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
3029 |
dialog addOkButton. |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
3030 |
dialog addButton:(Button |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
3031 |
label:'foo' |
655 | 3032 |
action:[dialog hide. Transcript showCR:'foo']) |
353
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
3033 |
before:nil. |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
3034 |
dialog open. |
655 | 3035 |
dialog accepted ifTrue:[Transcript showCR:'yes']. |
353
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
3036 |
" |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
3037 |
|
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
3038 |
"Modified: 9.2.1996 / 22:13:51 / cg" |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
3039 |
"Created: 10.2.1996 / 16:04:35 / cg" |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
3040 |
! |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
3041 |
|
593 | 3042 |
addHelpButtonFor:pathToHelpText |
3043 |
"add a help button to the buttonPanel. |
|
3044 |
The argument, pathToHelpText should specify the path to the help |
|
3045 |
text under either the doc/online/<language> or the help/<language> |
|
3046 |
directory." |
|
3047 |
||
3048 |
|helpButton| |
|
3049 |
||
3050 |
helpButton := Button label:(resources string:'help'). |
|
3051 |
helpButton action:[ |
|
659 | 3052 |
self withWaitCursorDo:[HTMLDocumentView openFullOnHelpFile:pathToHelpText]]. |
593 | 3053 |
^ self addButton:helpButton before:nil. |
3054 |
||
3055 |
" |
|
3056 |
|box| |
|
3057 |
||
3058 |
box := DialogBox new. |
|
3059 |
box |
|
3060 |
addHelpButtonFor:'NewLauncher/compilerSettings.html'; |
|
3061 |
addAbortButton; |
|
3062 |
addOkButton. |
|
3063 |
||
3064 |
box open |
|
3065 |
" |
|
3066 |
||
659 | 3067 |
"Modified: 20.5.1996 / 20:30:55 / cg" |
593 | 3068 |
! |
3069 |
||
3070 |
addOkButton |
|
3071 |
"create an okButton - to be sent from redefined initialize |
|
3072 |
methods in subclasses or when creating a box programmatically. |
|
3073 |
Returns the button." |
|
3074 |
||
3075 |
^ self addOkButtonLabelled:nil |
|
3076 |
||
3077 |
" |
|
3078 |
|dialog| |
|
3079 |
||
3080 |
dialog := DialogBox new. |
|
3081 |
dialog addOkButton. |
|
3082 |
dialog open. |
|
655 | 3083 |
dialog accepted ifTrue:[Transcript showCR:'yes']. |
593 | 3084 |
" |
3085 |
||
3086 |
"Modified: 9.2.1996 / 21:37:02 / cg" |
|
3087 |
! |
|
3088 |
||
3089 |
addOkButton:aButton |
|
3090 |
"add an already created okButton - to be sent from redefined initialize |
|
3091 |
methods in subclasses or when creating a box programmatically. |
|
3092 |
Returns the button." |
|
3093 |
||
3094 |
okButton := aButton. |
|
3095 |
aButton model:self; change:#okPressed. |
|
3096 |
^ self addButton:aButton. |
|
3097 |
||
3098 |
" |
|
3099 |
|dialog b| |
|
3100 |
||
3101 |
b := Button label:((Image fromFile:'garfield.gif') magnifiedBy:0.5). |
|
3102 |
||
3103 |
dialog := DialogBox new. |
|
3104 |
dialog addOkButton:b. |
|
3105 |
dialog open. |
|
655 | 3106 |
dialog accepted ifTrue:[Transcript showCR:'yes']. |
593 | 3107 |
" |
3108 |
||
3109 |
"Modified: 17.9.1995 / 20:20:41 / claus" |
|
3110 |
"Modified: 9.2.1996 / 21:38:48 / cg" |
|
3111 |
! |
|
3112 |
||
3113 |
addOkButtonLabelled:buttonLabel |
|
3114 |
"create an okButton with a label - to be sent from redefined initialize |
|
3115 |
methods in subclasses or when creating a box programmatically. |
|
3116 |
A nil argument creates one with the default text. |
|
3117 |
Returns the button." |
|
3118 |
||
3119 |
|aButton| |
|
3120 |
||
3121 |
aButton := Button okButton. |
|
3122 |
buttonLabel notNil ifTrue:[aButton label:buttonLabel]. |
|
3123 |
aButton isReturnButton:acceptReturnAsOK. |
|
3124 |
^ self addOkButton:aButton. |
|
3125 |
||
3126 |
" |
|
3127 |
|dialog| |
|
3128 |
||
3129 |
dialog := DialogBox new. |
|
3130 |
dialog addOkButtonLabelled:'get out of here'. |
|
3131 |
dialog open. |
|
655 | 3132 |
dialog accepted ifTrue:[Transcript showCR:'yes']. |
593 | 3133 |
" |
3134 |
||
3135 |
"Modified: 9.2.1996 / 21:39:34 / cg" |
|
3136 |
! ! |
|
3137 |
||
3138 |
!DialogBox methodsFor:'construction-check & comboboxes'! |
|
3139 |
||
197 | 3140 |
addCheckBox:label on:aModel |
3141 |
"create a checkBox with label on aModel and add it. |
|
3142 |
Returns the box." |
|
3143 |
||
3144 |
^ self addCheckBox:label on:aModel tabable:true |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
3145 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
3146 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
3147 |
|dialog check| |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
3148 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
3149 |
check := true asValue. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
3150 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
3151 |
dialog := DialogBox new. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
3152 |
dialog addCheckBox:'on or off' on:check. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
3153 |
dialog addOkButton. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
3154 |
dialog open. |
655 | 3155 |
dialog accepted ifTrue:[Transcript showCR:check value]. |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
3156 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
3157 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
3158 |
"Modified: 9.2.1996 / 22:15:38 / cg" |
197 | 3159 |
! |
3160 |
||
600 | 3161 |
addCheckBox:label on:aModel tabable:tabable |
3162 |
"create a checkBox with label on aModel and add it. |
|
3163 |
Returns the box." |
|
3164 |
||
3165 |
|b| |
|
3166 |
||
3167 |
b := CheckBox on:aModel. |
|
3168 |
b label:label. |
|
3169 |
self addComponent:b tabable:tabable. |
|
3170 |
^ b |
|
3171 |
||
3172 |
" |
|
3173 |
|dialog check1 check2 check3| |
|
3174 |
||
3175 |
check1 := true asValue. |
|
3176 |
check2 := false asValue. |
|
3177 |
check3 := true asValue. |
|
3178 |
||
3179 |
dialog := DialogBox new. |
|
3180 |
dialog addCheckBox:'on or off' on:check1 tabable:false. |
|
3181 |
dialog addHorizontalLine. |
|
3182 |
||
3183 |
dialog addCheckBox:'on or off' on:check2 tabable:true. |
|
3184 |
dialog addCheckBox:'on or off' on:check3 tabable:true. |
|
3185 |
dialog addOkButton. |
|
3186 |
dialog open. |
|
3187 |
" |
|
3188 |
||
3189 |
"Modified: 9.2.1996 / 22:16:49 / cg" |
|
3190 |
! |
|
3191 |
||
593 | 3192 |
addComboBoxOn:aModel |
3193 |
"create a comboBoxView on aModel and add it. |
|
3194 |
Returns the comboBoxView." |
|
3195 |
||
3196 |
^ self addComboBoxOn:aModel tabable:true |
|
3197 |
||
3198 |
" |
|
3199 |
without a list, the comboBox is disabled: |
|
3200 |
||
3201 |
|box val| |
|
3202 |
||
3203 |
val := 'some input' asValue. |
|
3204 |
||
3205 |
box := Dialog new. |
|
3206 |
||
3207 |
(box addTextLabel:'combo box example') adjust:#left. |
|
3208 |
box addVerticalSpace. |
|
3209 |
(box addComboBoxOn:val). |
|
3210 |
box addOkButton. |
|
3211 |
box open. |
|
3212 |
box accepted ifTrue:[ |
|
655 | 3213 |
Transcript showCR:val value |
593 | 3214 |
]. |
3215 |
" |
|
3216 |
||
3217 |
"with a list, it can be pulled: |
|
3218 |
||
3219 |
|box val| |
|
3220 |
||
3221 |
val := '' asValue. |
|
3222 |
||
3223 |
box := Dialog new. |
|
3224 |
||
3225 |
(box addTextLabel:'combo box example') adjust:#left. |
|
3226 |
box addVerticalSpace. |
|
3227 |
(box addComboBoxOn:val) list:#('one' 'two' 'three' 'four'). |
|
3228 |
box addOkButton. |
|
3229 |
box open. |
|
3230 |
box accepted ifTrue:[ |
|
655 | 3231 |
Transcript showCR:val value |
593 | 3232 |
]. |
3233 |
" |
|
3234 |
||
3235 |
"Modified: 28.2.1996 / 15:17:39 / cg" |
|
3236 |
"Created: 4.3.1996 / 17:21:45 / cg" |
|
3237 |
! |
|
3238 |
||
3239 |
addComboBoxOn:aModel tabable:tabable |
|
3240 |
"create a comboBoxView on aModel and add it. |
|
3241 |
Returns the comboBoxView." |
|
3242 |
||
3243 |
|f| |
|
3244 |
||
3245 |
f := ComboBoxView new. |
|
3246 |
f model:aModel. |
|
3247 |
self addComponent:f tabable:tabable. |
|
3248 |
tabable ifTrue:[ |
|
3249 |
self addToInputFieldGroup:f editor. |
|
3250 |
]. |
|
3251 |
^ f |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
3252 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
3253 |
" |
593 | 3254 |
without a list, the comboBox is disabled: |
3255 |
||
3256 |
|box val| |
|
3257 |
||
3258 |
val := 'some input' asValue. |
|
3259 |
||
3260 |
box := Dialog new. |
|
3261 |
||
3262 |
(box addTextLabel:'combo box example') adjust:#left. |
|
3263 |
box addVerticalSpace. |
|
3264 |
(box addComboBoxOn:val tabable:true). |
|
3265 |
box addOkButton. |
|
3266 |
box open. |
|
3267 |
box accepted ifTrue:[ |
|
655 | 3268 |
Transcript showCR:val value |
593 | 3269 |
]. |
3270 |
" |
|
3271 |
||
3272 |
"with a list, it can be pulled: |
|
3273 |
||
3274 |
|box val| |
|
3275 |
||
3276 |
val := '' asValue. |
|
3277 |
||
3278 |
box := Dialog new. |
|
3279 |
||
3280 |
(box addTextLabel:'combo box example') adjust:#left. |
|
3281 |
box addVerticalSpace. |
|
3282 |
(box addComboBoxOn:val tabable:true) list:#('one' 'two' 'three' 'four'). |
|
3283 |
box addOkButton. |
|
3284 |
box open. |
|
3285 |
box accepted ifTrue:[ |
|
655 | 3286 |
Transcript showCR:val value |
593 | 3287 |
]. |
3288 |
" |
|
3289 |
||
3290 |
"Modified: 4.3.1996 / 17:21:57 / cg" |
|
3291 |
! |
|
3292 |
||
3293 |
addComboListOn:aModel |
|
3294 |
"create a comboListView on aModel and add it. |
|
3295 |
Returns the comboListView." |
|
3296 |
||
3297 |
^ self addComboListOn:aModel tabable:true |
|
3298 |
||
3299 |
"without a list, the comboList is disabled: |
|
3300 |
||
3301 |
|box val| |
|
3302 |
||
3303 |
val := 'some input' asValue. |
|
3304 |
||
3305 |
box := Dialog new. |
|
3306 |
||
3307 |
(box addTextLabel:'combo list example') adjust:#left. |
|
3308 |
box addVerticalSpace. |
|
3309 |
(box addComboListOn:val). |
|
3310 |
box addOkButton. |
|
3311 |
box open. |
|
3312 |
box accepted ifTrue:[ |
|
655 | 3313 |
Transcript showCR:val value |
593 | 3314 |
]. |
3315 |
" |
|
3316 |
||
3317 |
"with a list, it can be pulled: |
|
3318 |
||
3319 |
|box val| |
|
3320 |
||
3321 |
val := '' asValue. |
|
3322 |
||
3323 |
box := Dialog new. |
|
3324 |
||
3325 |
(box addTextLabel:'combo box example') adjust:#left. |
|
3326 |
box addVerticalSpace. |
|
3327 |
(box addComboListOn:val) list:#('one' 'two' 'three' 'four'). |
|
3328 |
box addOkButton. |
|
3329 |
box open. |
|
3330 |
box accepted ifTrue:[ |
|
655 | 3331 |
Transcript showCR:val value |
593 | 3332 |
]. |
3333 |
" |
|
3334 |
||
3335 |
"Created: 28.2.1996 / 15:16:34 / cg" |
|
3336 |
"Modified: 4.3.1996 / 17:22:59 / cg" |
|
3337 |
! |
|
3338 |
||
3339 |
addComboListOn:aModel tabable:tabable |
|
3340 |
"create a comboListView on aModel and add it. |
|
3341 |
Returns the comboListView." |
|
3342 |
||
3343 |
|f| |
|
3344 |
||
3345 |
f := ComboListView new. |
|
3346 |
f model:aModel. |
|
3347 |
self addComponent:f tabable:tabable. |
|
3348 |
^ f |
|
3349 |
||
3350 |
"without a list, the comboList is disabled: |
|
3351 |
||
3352 |
|box val| |
|
3353 |
||
3354 |
val := 'some input' asValue. |
|
3355 |
||
3356 |
box := Dialog new. |
|
3357 |
||
3358 |
(box addTextLabel:'combo list example') adjust:#left. |
|
3359 |
box addVerticalSpace. |
|
3360 |
(box addComboListOn:val tabable:true). |
|
3361 |
box addOkButton. |
|
3362 |
box open. |
|
3363 |
box accepted ifTrue:[ |
|
655 | 3364 |
Transcript showCR:val value |
593 | 3365 |
]. |
3366 |
" |
|
3367 |
||
3368 |
"with a list, it can be pulled: |
|
3369 |
||
3370 |
|box val| |
|
3371 |
||
3372 |
val := '' asValue. |
|
3373 |
||
3374 |
box := Dialog new. |
|
3375 |
||
3376 |
(box addTextLabel:'combo box example') adjust:#left. |
|
3377 |
box addVerticalSpace. |
|
3378 |
(box addComboListOn:val tabable:true) list:#('one' 'two' 'three' 'four'). |
|
3379 |
box addOkButton. |
|
3380 |
box open. |
|
3381 |
box accepted ifTrue:[ |
|
655 | 3382 |
Transcript showCR:val value |
593 | 3383 |
]. |
3384 |
" |
|
3385 |
||
3386 |
"Created: 28.2.1996 / 15:16:34 / cg" |
|
3387 |
"Modified: 4.3.1996 / 17:23:38 / cg" |
|
3388 |
! ! |
|
3389 |
||
3390 |
!DialogBox methodsFor:'construction-inputfields'! |
|
3391 |
||
3392 |
addFilenameInputFieldOn:aModel in:aDirectory tabable:tabable |
|
3393 |
"create a fileName input field on aModel and add it. |
|
3394 |
Returns the field. This is much like a normal input field, |
|
3395 |
but supports filename completion." |
|
3396 |
||
3397 |
|f| |
|
3398 |
||
3399 |
f := FilenameEditField new. |
|
3400 |
aDirectory notNil ifTrue:[f directory:aDirectory]. |
|
3401 |
f model:aModel. |
|
3402 |
self addInputField:f tabable:tabable. |
|
3403 |
^ f |
|
3404 |
! |
|
3405 |
||
3406 |
addInputField:aField |
|
3407 |
"add an already created input field. |
|
3408 |
Returns the field." |
|
3409 |
||
3410 |
^ self addInputField:aField tabable:true |
|
3411 |
||
3412 |
"Modified: 9.2.1996 / 20:46:16 / cg" |
|
3413 |
! |
|
3414 |
||
3415 |
addInputField:aField tabable:tabable |
|
3416 |
"add an already created input field. |
|
3417 |
If tabable is true, the field is put into a group, to allow |
|
3418 |
stepping through the fields with #Cursor/#Return keys. |
|
3419 |
Returns the field." |
|
3420 |
||
3421 |
self addComponent:aField tabable:tabable. |
|
3422 |
tabable ifTrue:[ |
|
3423 |
self addToInputFieldGroup:aField. |
|
3424 |
]. |
|
3425 |
^ aField |
|
3426 |
||
3427 |
"Modified: 9.2.1996 / 20:47:28 / cg" |
|
3428 |
! |
|
3429 |
||
3430 |
addInputFieldOn:aModel |
|
3431 |
"create an input field on aModel and add it. |
|
3432 |
Returns the field." |
|
3433 |
||
3434 |
^ self addInputFieldOn:aModel tabable:true |
|
3435 |
||
3436 |
" |
|
3437 |
|dialog model field| |
|
3438 |
||
3439 |
model := '' asValue. |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
3440 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
3441 |
dialog := DialogBox new. |
593 | 3442 |
(dialog addTextLabel:'enter a string') adjust:#left. |
3443 |
||
3444 |
field := dialog addInputFieldOn:model. |
|
3445 |
||
3446 |
dialog addAbortButton; addOkButton. |
|
3447 |
dialog open. |
|
655 | 3448 |
dialog accepted ifTrue:[Transcript showCR:model value]. |
593 | 3449 |
" |
3450 |
||
3451 |
"Modified: 9.2.1996 / 21:34:14 / cg" |
|
3452 |
! |
|
3453 |
||
3454 |
addInputFieldOn:aModel tabable:tabable |
|
3455 |
"create an input field on aModel and add it. |
|
3456 |
If tabable is false, the field cannot be tabbed into |
|
3457 |
and return does not close the box. |
|
3458 |
(pointer must be moved into it). |
|
3459 |
Returns the field." |
|
3460 |
||
3461 |
|f| |
|
3462 |
||
3463 |
f := EditField new. |
|
3464 |
f model:aModel. |
|
3465 |
self addInputField:f tabable:tabable. |
|
3466 |
^ f |
|
3467 |
||
3468 |
" a non-tabable field: |
|
3469 |
||
3470 |
|dialog model field| |
|
3471 |
||
3472 |
model := '' asValue. |
|
3473 |
||
3474 |
dialog := DialogBox new. |
|
3475 |
(dialog addTextLabel:'enter a string') adjust:#left. |
|
3476 |
||
3477 |
field := dialog addInputFieldOn:model tabable:false. |
|
3478 |
||
3479 |
dialog addAbortButton; addOkButton. |
|
3480 |
dialog open. |
|
655 | 3481 |
dialog accepted ifTrue:[Transcript showCR:model value]. |
593 | 3482 |
" |
3483 |
||
3484 |
"Modified: 9.2.1996 / 21:36:16 / cg" |
|
3485 |
! |
|
3486 |
||
3487 |
addLabelledInputField:labelString adjust:labelAdjust on:model tabable:tabable separateAtX:relativeX |
|
3488 |
"add a label and an inputField side-by-side. |
|
3489 |
The labels goes from 0.0 to relativeX; the inputField from relativeX to 1.0. |
|
3490 |
The labels string is defined by labelString and adjusted according to labelAdjust. |
|
3491 |
The inputField gets model as its model. |
|
3492 |
Return the inputField." |
|
3493 |
||
3494 |
||
3495 |
^ self |
|
3496 |
addLabelledField:(EditField on:model) label:labelString |
|
3497 |
adjust:labelAdjust |
|
3498 |
tabable:tabable |
|
3499 |
separateAtX:relativeX. |
|
3500 |
||
3501 |
" |
|
3502 |
|dialog model field| |
|
3503 |
||
3504 |
model := '' asValue. |
|
3505 |
||
3506 |
dialog := DialogBox new. |
|
3507 |
||
3508 |
field := dialog |
|
3509 |
addLabelledInputField:'enter a string' |
|
3510 |
adjust:#left |
|
3511 |
on:model |
|
3512 |
tabable:true |
|
3513 |
separateAtX:0.3. |
|
3514 |
||
3515 |
dialog addAbortButton; addOkButton. |
|
3516 |
dialog open. |
|
655 | 3517 |
dialog accepted ifTrue:[Transcript showCR:model value]. |
593 | 3518 |
" |
3519 |
||
3520 |
" |
|
3521 |
|dialog model1 model2 field| |
|
3522 |
||
3523 |
model1 := '' asValue. |
|
3524 |
model2 := '' asValue. |
|
3525 |
||
3526 |
dialog := DialogBox new. |
|
3527 |
||
3528 |
dialog addTextLabel:'a two-input box'. |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
3529 |
dialog addHorizontalLine. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
3530 |
|
593 | 3531 |
field := dialog |
3532 |
addLabelledInputField:'string1:' |
|
3533 |
adjust:#right |
|
3534 |
on:model1 |
|
3535 |
tabable:true |
|
3536 |
separateAtX:0.4. |
|
3537 |
||
3538 |
field := dialog |
|
3539 |
addLabelledInputField:'string2:' |
|
3540 |
adjust:#right |
|
3541 |
on:model2 |
|
3542 |
tabable:true |
|
3543 |
separateAtX:0.4. |
|
3544 |
||
3545 |
dialog addAbortButton; addOkButton. |
|
3546 |
dialog open. |
|
3547 |
dialog accepted ifTrue:[ |
|
655 | 3548 |
Transcript showCR:model1 value. |
3549 |
Transcript showCR:model2 value. |
|
593 | 3550 |
]. |
3551 |
" |
|
3552 |
||
3553 |
"Created: 13.4.1996 / 13:41:31 / cg" |
|
3554 |
"Modified: 19.4.1996 / 17:39:46 / cg" |
|
3555 |
! ! |
|
3556 |
||
3557 |
!DialogBox methodsFor:'construction-layout'! |
|
3558 |
||
3559 |
addHorizontalLine |
|
3560 |
"add a horizontal line as separator" |
|
3561 |
||
3562 |
^ self addComponent:(Separator new extent:1.0 @ 5). |
|
3563 |
||
3564 |
" |
|
3565 |
|dialog| |
|
3566 |
||
3567 |
dialog := DialogBox new. |
|
3568 |
dialog |
|
3569 |
addTextLabel:'some title string'; |
|
3570 |
addHorizontalLine; |
|
3571 |
addTextLabel:'more text'; |
|
3572 |
addOkButton; |
|
3573 |
open. |
|
3574 |
" |
|
3575 |
||
3576 |
" |
|
3577 |
|dialog| |
|
3578 |
||
3579 |
dialog := DialogBox new. |
|
3580 |
dialog |
|
3581 |
addTextLabel:'some title string'; |
|
3582 |
addHorizontalLine; |
|
3583 |
addTextLabel:'more text'. |
|
3584 |
(dialog addHorizontalLine) width:20. |
|
3585 |
dialog addTextLabel:'more text'. |
|
3586 |
(dialog addHorizontalLine) width:20. |
|
3587 |
dialog |
|
3588 |
addTextLabel:'more text'; |
|
3589 |
addHorizontalLine; |
|
3590 |
addOkButton; |
|
3591 |
open. |
|
3592 |
" |
|
3593 |
||
3594 |
"Modified: 19.4.1996 / 15:11:30 / cg" |
|
3595 |
! |
|
3596 |
||
3597 |
addVerticalSpace |
|
3598 |
"add a default vertical space (1 mm)" |
|
3599 |
||
3600 |
self addVerticalSpace:(ViewSpacing). |
|
3601 |
||
3602 |
" |
|
3603 |
|dialog| |
|
3604 |
||
3605 |
dialog := DialogBox new. |
|
3606 |
dialog addTextLabel:'some title string'. |
|
3607 |
dialog addVerticalSpace. |
|
3608 |
dialog addTextLabel:'more text'. |
|
3609 |
||
3610 |
dialog addOkButton. |
|
3611 |
dialog open. |
|
3612 |
" |
|
3613 |
||
3614 |
"Modified: 9.2.1996 / 21:41:10 / cg" |
|
3615 |
! |
|
3616 |
||
3617 |
addVerticalSpace:nPixel |
|
3618 |
"add some pixels of space to the next component" |
|
3619 |
||
3620 |
yPosition := yPosition + nPixel. |
|
3621 |
needResize := true. |
|
3622 |
||
3623 |
" |
|
3624 |
|dialog| |
|
3625 |
||
3626 |
dialog := DialogBox new. |
|
3627 |
dialog addTextLabel:'some title string'. |
|
3628 |
dialog addVerticalSpace:50. |
|
3629 |
dialog addTextLabel:'more text'. |
|
3630 |
||
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
3631 |
dialog addOkButton. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
3632 |
dialog open. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
3633 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
3634 |
|
593 | 3635 |
"Modified: 9.2.1996 / 21:41:23 / cg" |
3636 |
! |
|
3637 |
||
3638 |
leftIndent |
|
3639 |
"return the current indent |
|
3640 |
(current x position - thats where the next component will be located)." |
|
3641 |
||
3642 |
^ leftIndent |
|
3643 |
||
3644 |
"Modified: 27.1.1996 / 18:21:31 / cg" |
|
3645 |
! |
|
3646 |
||
3647 |
leftIndent:aNumber |
|
3648 |
"set the left indent (current x position - thats where the next component |
|
3649 |
will be located)." |
|
3650 |
||
3651 |
leftIndent := aNumber. |
|
3652 |
needResize := true. |
|
3653 |
||
3654 |
" |
|
3655 |
|dialog| |
|
3656 |
||
3657 |
dialog := DialogBox new. |
|
3658 |
(dialog addTextLabel:'label1') adjust:#left. |
|
3659 |
dialog leftIndent:20. |
|
3660 |
(dialog addTextLabel:'label2') adjust:#left. |
|
3661 |
dialog leftIndent:40. |
|
3662 |
(dialog addTextLabel:'label3') adjust:#left. |
|
3663 |
dialog leftIndent:60. |
|
3664 |
(dialog addTextLabel:'label4') adjust:#left. |
|
3665 |
||
3666 |
dialog addOkButton. |
|
3667 |
dialog open. |
|
3668 |
" |
|
3669 |
||
3670 |
"Modified: 9.2.1996 / 21:42:20 / cg" |
|
3671 |
! |
|
3672 |
||
3673 |
rightIndent |
|
3674 |
"return the current right indent." |
|
3675 |
||
3676 |
^ rightIndent |
|
3677 |
||
3678 |
"Modified: 27.1.1996 / 18:21:31 / cg" |
|
3679 |
! |
|
3680 |
||
3681 |
rightIndent:aNumber |
|
3682 |
"set the right indent" |
|
3683 |
||
3684 |
rightIndent := aNumber. |
|
3685 |
needResize := true. |
|
3686 |
||
3687 |
" |
|
3688 |
|dialog| |
|
3689 |
||
3690 |
dialog := DialogBox new. |
|
3691 |
(dialog addTextLabel:'label1') adjust:#right. |
|
3692 |
dialog rightIndent:20. |
|
3693 |
(dialog addTextLabel:'label2') adjust:#right. |
|
3694 |
dialog rightIndent:40. |
|
3695 |
(dialog addTextLabel:'label3') adjust:#right. |
|
3696 |
dialog rightIndent:60. |
|
3697 |
(dialog addTextLabel:'label4') adjust:#right. |
|
3698 |
||
3699 |
dialog addOkButton. |
|
3700 |
dialog open. |
|
3701 |
" |
|
3702 |
||
3703 |
"Modified: 9.2.1996 / 21:42:46 / cg" |
|
3704 |
! |
|
3705 |
||
3706 |
stickAtBottomWithFixHeight:aComponent |
|
3707 |
"arrange for a component to be positioned at a constant offset |
|
3708 |
from the bottom of the box and its height to remain the same. |
|
3709 |
This will keep the component at a constant distance from the bottom |
|
3710 |
(without this setup, it would stay at a constant offset from the top)" |
|
3711 |
||
3712 |
self resize. |
|
3713 |
||
3714 |
aComponent |
|
3715 |
topInset:(self height - aComponent top) negated; |
|
3716 |
bottomInset:(self height - aComponent bottom); |
|
3717 |
origin:0.0 @ 1.0; corner:1.0 @ 1.0. |
|
3718 |
||
3719 |
" |
|
3720 |
compare the resizing behavior of: |
|
3721 |
||
3722 |
|box| |
|
3723 |
||
3724 |
box := Dialog new. |
|
3725 |
box addTextLabel:'hello'. |
|
3726 |
box addTextLabel:'hello2'. |
|
3727 |
box addOkButton. |
|
3728 |
box show |
|
3729 |
||
3730 |
with: |
|
3731 |
||
3732 |
|box l2| |
|
3733 |
||
3734 |
box := Dialog new. |
|
3735 |
box addTextLabel:'hello'. |
|
3736 |
l2 := box addTextLabel:'hello2'. |
|
3737 |
box addOkButton. |
|
3738 |
box stickAtBottomWithFixHeight:l2. |
|
3739 |
box show |
|
3740 |
" |
|
3741 |
||
3742 |
"Created: 27.1.1996 / 17:17:41 / cg" |
|
3743 |
"Modified: 27.1.1996 / 18:29:03 / cg" |
|
3744 |
! |
|
3745 |
||
3746 |
stickAtBottomWithVariableHeight:aComponent |
|
3747 |
"arrange for a component to be positioned at a constant offset |
|
3748 |
from the bottom of the box and its height to be adjusted. |
|
3749 |
This will resize the component for a constant distance from the top, |
|
3750 |
and the bottom. |
|
3751 |
(without this setup, its height would remain constant)" |
|
3752 |
||
3753 |
self resize. |
|
3754 |
||
3755 |
aComponent |
|
3756 |
bottomInset:(self height - aComponent bottom); |
|
3757 |
corner:1.0@1.0. |
|
3758 |
||
3759 |
" |
|
3760 |
compare the resizing behavior of: |
|
3761 |
||
3762 |
|box| |
|
3763 |
||
3764 |
box := Dialog new. |
|
3765 |
box addTextLabel:'hello'. |
|
3766 |
(box addComponent:(SelectionInListView new)) level:-1. |
|
3767 |
box addOkButton. |
|
3768 |
box show |
|
3769 |
||
3770 |
with: |
|
3771 |
||
3772 |
|box list| |
|
3773 |
||
3774 |
box := Dialog new. |
|
3775 |
box addTextLabel:'hello'. |
|
3776 |
list := (box addComponent:(SelectionInListView new)) level:-1. |
|
3777 |
box addOkButton. |
|
3778 |
box stickAtBottomWithVariableHeight:list. |
|
3779 |
box show |
|
3780 |
" |
|
3781 |
||
3782 |
"Modified: 27.4.1996 / 18:34:20 / cg" |
|
3783 |
! |
|
3784 |
||
3785 |
yPosition |
|
3786 |
"return the current y position (thats where the next component |
|
3787 |
will be located)." |
|
3788 |
||
3789 |
^ yPosition |
|
120 | 3790 |
! |
3791 |
||
593 | 3792 |
yPosition:aNumber |
3793 |
"set the current y position (thats where the next component |
|
3794 |
will be located)." |
|
3795 |
||
3796 |
yPosition := aNumber. |
|
3797 |
needResize := true. |
|
3798 |
||
3799 |
" |
|
3800 |
|dialog pos| |
|
3801 |
||
3802 |
dialog := DialogBox new. |
|
3803 |
pos := dialog yPosition. |
|
3804 |
(dialog addTextLabel:'label1') width:0.5. |
|
3805 |
dialog yPosition:pos. |
|
3806 |
(dialog addTextLabel:'label2') width:0.5; left:0.5. |
|
3807 |
||
3808 |
dialog addOkButton. |
|
3809 |
dialog open. |
|
3810 |
" |
|
3811 |
||
3812 |
" |
|
3813 |
|dialog pos| |
|
3814 |
||
3815 |
dialog := DialogBox new. |
|
3816 |
pos := dialog yPosition. |
|
3817 |
#('one' 'two' 'three' 'four') |
|
3818 |
with:#(0.0 0.25 0.5 0.75) do:[:lbl :x | |
|
3819 |
dialog yPosition:pos. |
|
3820 |
(dialog addComponent:(Button label:lbl) tabable:true) |
|
3821 |
width:0.25; left:x. |
|
3822 |
]. |
|
3823 |
||
3824 |
dialog addOkButton. |
|
3825 |
dialog open. |
|
3826 |
" |
|
3827 |
||
3828 |
"Modified: 9.2.1996 / 21:46:40 / cg" |
|
3829 |
! ! |
|
3830 |
||
3831 |
!DialogBox methodsFor:'construction-lists'! |
|
3832 |
||
3833 |
addListBoxOn:aModel |
|
3834 |
"add a selectionInListView to the box. |
|
3835 |
The listViews ScrollWrapper is returned" |
|
3836 |
||
3837 |
^ self |
|
3838 |
addListBoxOn:aModel |
|
3839 |
withNumberOfLines:nil |
|
3840 |
hScrollable:false |
|
3841 |
vScrollable:true. |
|
3842 |
||
3843 |
" |
|
3844 |
|dialog model listView| |
|
3845 |
||
3846 |
model := SelectionInList new. |
|
3847 |
model list:#('one' 'two' 'three' 'four'). |
|
3848 |
model selectionIndex:2. |
|
3849 |
||
3850 |
dialog := DialogBox new. |
|
3851 |
(dialog addTextLabel:'select any') adjust:#left. |
|
3852 |
||
3853 |
listView := dialog addListBoxOn:model. |
|
3854 |
||
3855 |
dialog addAbortButton; addOkButton. |
|
3856 |
dialog open. |
|
3857 |
||
655 | 3858 |
dialog accepted ifTrue:[Transcript show:'selection is:'; showCR:model selection]. |
593 | 3859 |
" |
3860 |
||
3861 |
"Modified: 27.4.1996 / 18:27:58 / cg" |
|
3862 |
! |
|
3863 |
||
3864 |
addListBoxOn:aModel class:aListViewClass |
|
3865 |
"create & add an instance of aListViewClass to the box. |
|
3866 |
The listViews ScrollWrapper is returned" |
|
3867 |
||
3868 |
^ self |
|
3869 |
addListBoxOn:aModel |
|
3870 |
class:aListViewClass |
|
3871 |
withNumberOfLines:nil |
|
3872 |
hScrollable:false |
|
3873 |
vScrollable:true. |
|
3874 |
||
3875 |
"Created: 19.4.1996 / 13:06:14 / cg" |
|
3876 |
"Modified: 27.4.1996 / 18:27:53 / cg" |
|
3877 |
! |
|
3878 |
||
3879 |
addListBoxOn:aModel class:aListViewClass withNumberOfLines:numLines |
|
3880 |
"create and add an instance of aListViewClass to the box. |
|
3881 |
The list has numLines (if nonNil) number of lines shown. |
|
3882 |
The listViews ScrollWrapper is returned" |
|
3883 |
||
3884 |
^ self |
|
3885 |
addListBoxOn:aModel |
|
3886 |
class:aListViewClass |
|
3887 |
withNumberOfLines:numLines |
|
3888 |
hScrollable:false |
|
3889 |
vScrollable:true. |
|
3890 |
||
3891 |
"Created: 19.4.1996 / 13:05:05 / cg" |
|
3892 |
"Modified: 27.4.1996 / 18:27:48 / cg" |
|
3893 |
! |
|
3894 |
||
3895 |
addListBoxOn:aModel class:aListViewClass withNumberOfLines:numLines hScrollable:hs vScrollable:vs |
|
3896 |
"add an instance ofaListViewClass selectionInListView to the box. |
|
3897 |
The list has numLines (if nonNil) number of lines shown. |
|
3898 |
If scrolled, the ScrollWrapper is returned - otherwise the listView." |
|
3899 |
||
3900 |
|l scr h dH| |
|
3901 |
||
3902 |
l := aListViewClass new. |
|
3903 |
l model:aModel. |
|
3904 |
l doubleClickAction:[:name | self okPressed]. |
|
3905 |
||
3906 |
vs ifTrue:[ |
|
3907 |
hs ifTrue:[ |
|
3908 |
scr := HVScrollableView forView:l miniScrollerH:true . |
|
3909 |
] ifFalse:[ |
|
3910 |
scr := ScrollableView forView:l |
|
3911 |
]. |
|
3912 |
scr resize. |
|
655 | 3913 |
"/ Transcript show:scr height; show:' '; showCR:l height. |
593 | 3914 |
dH := scr height - l height. |
3915 |
] ifFalse:[ |
|
3916 |
l level:-1. |
|
3917 |
scr := l. |
|
3918 |
dH := 0. |
|
3919 |
]. |
|
3920 |
||
3921 |
numLines notNil ifTrue:[ |
|
3922 |
h := l heightForLines:numLines. |
|
3923 |
] ifFalse:[ |
|
3924 |
h := l preferredExtent y |
|
3925 |
]. |
|
3926 |
self addComponent:scr withHeight:(h + dH). |
|
3927 |
^ scr |
|
3928 |
||
3929 |
" |
|
3930 |
|dialog listView| |
|
3931 |
||
3932 |
dialog := DialogBox new. |
|
3933 |
(dialog addTextLabel:'select any') adjust:#left. |
|
3934 |
||
3935 |
listView := dialog |
|
3936 |
addListBoxOn:nil |
|
3937 |
class:FileSelectionList |
|
3938 |
withNumberOfLines:10 |
|
3939 |
hScrollable:false |
|
3940 |
vScrollable:false. |
|
3941 |
||
3942 |
listView directory:'/etc'. |
|
3943 |
||
3944 |
dialog addAbortButton; addOkButton. |
|
3945 |
dialog open. |
|
3946 |
||
655 | 3947 |
dialog accepted ifTrue:[Transcript show:'selection is:'; showCR:listView selectionValue]. |
593 | 3948 |
" |
3949 |
||
3950 |
"Created: 22.2.1996 / 15:40:07 / cg" |
|
3951 |
"Modified: 27.4.1996 / 18:26:15 / cg" |
|
3952 |
! |
|
3953 |
||
3954 |
addListBoxOn:aModel withNumberOfLines:numLines |
|
3955 |
"add a selectionInListView to the box. |
|
3956 |
The list has numLines (if nonNil) number of lines shown. |
|
3957 |
The listViews ScrollWrapper is returned" |
|
3958 |
||
3959 |
^ self |
|
3960 |
addListBoxOn:aModel |
|
3961 |
withNumberOfLines:numLines |
|
3962 |
hScrollable:false |
|
3963 |
vScrollable:true. |
|
3964 |
||
3965 |
" |
|
3966 |
|dialog model listView| |
|
3967 |
||
3968 |
model := SelectionInList new. |
|
3969 |
model list:#('one' 'two' 'three' 'four'). |
|
3970 |
model selectionIndex:2. |
|
3971 |
||
3972 |
dialog := DialogBox new. |
|
3973 |
(dialog addTextLabel:'select any') adjust:#left. |
|
3974 |
||
3975 |
listView := dialog addListBoxOn:model withNumberOfLines:3. |
|
3976 |
||
3977 |
dialog addAbortButton; addOkButton. |
|
3978 |
dialog open. |
|
3979 |
||
655 | 3980 |
dialog accepted ifTrue:[Transcript show:'selection is:'; showCR:model selection]. |
593 | 3981 |
" |
3982 |
||
3983 |
"Created: 22.2.1996 / 15:40:07 / cg" |
|
3984 |
"Modified: 27.4.1996 / 18:27:42 / cg" |
|
3985 |
! |
|
3986 |
||
3987 |
addListBoxOn:aModel withNumberOfLines:numLines hScrollable:hs vScrollable:vs |
|
3988 |
"add a selectionInListView to the box. |
|
3989 |
The list has numLines (if nonNil) number of lines shown. |
|
3990 |
If scrolled, the ScrollWrapper is returned - otherwise the listView." |
|
3991 |
||
3992 |
^ self |
|
3993 |
addListBoxOn:aModel |
|
3994 |
class:SelectionInListView |
|
3995 |
withNumberOfLines:numLines |
|
3996 |
hScrollable:hs |
|
3997 |
vScrollable:vs |
|
3998 |
||
3999 |
" |
|
4000 |
|dialog model listView| |
|
4001 |
||
4002 |
model := SelectionInList new. |
|
4003 |
model list:#('one' 'two' 'three' 'four'). |
|
4004 |
model selectionIndex:2. |
|
4005 |
||
4006 |
dialog := DialogBox new. |
|
4007 |
(dialog addTextLabel:'select any') adjust:#left. |
|
4008 |
||
4009 |
listView := dialog addListBoxOn:model withNumberOfLines:3 hScrollable:true vScrollable:true. |
|
4010 |
||
4011 |
dialog addAbortButton; addOkButton. |
|
4012 |
dialog open. |
|
4013 |
||
655 | 4014 |
dialog accepted ifTrue:[Transcript show:'selection is:'; showCR:model selection]. |
593 | 4015 |
" |
4016 |
||
4017 |
" |
|
4018 |
|dialog model listView| |
|
4019 |
||
4020 |
model := SelectionInList new. |
|
4021 |
model list:#('one' 'two' 'three' 'four'). |
|
4022 |
model selectionIndex:2. |
|
4023 |
||
4024 |
dialog := DialogBox new. |
|
4025 |
(dialog addTextLabel:'select any') adjust:#left. |
|
4026 |
||
4027 |
listView := dialog addListBoxOn:model withNumberOfLines:3 hScrollable:false vScrollable:false. |
|
4028 |
||
4029 |
dialog addAbortButton; addOkButton. |
|
4030 |
dialog open. |
|
4031 |
||
655 | 4032 |
dialog accepted ifTrue:[Transcript show:'selection is:'; showCR:model selection]. |
593 | 4033 |
" |
4034 |
||
4035 |
"Created: 22.2.1996 / 15:40:07 / cg" |
|
4036 |
"Modified: 27.4.1996 / 18:26:36 / cg" |
|
4037 |
! |
|
4038 |
||
4039 |
addPopUpList:labelString on:aModel |
|
4040 |
"create a popUpList with a label on aModel and add it. |
|
4041 |
Returns the box." |
|
4042 |
||
4043 |
^ self addPopUpList:labelString on:aModel tabable:true |
|
4044 |
! |
|
4045 |
||
4046 |
addPopUpList:labelString on:aModel tabable:tabable |
|
4047 |
"create a popUpList on aModel and add it. |
|
4048 |
Returns the popUpList." |
|
4049 |
||
4050 |
|p box l| |
|
4051 |
||
4052 |
p := PopUpList on:aModel. |
|
4053 |
p resize; sizeFixed:true. |
|
4054 |
labelString notNil ifTrue:[ |
|
4055 |
box := HorizontalPanelView new. |
|
4056 |
box borderWidth:0; horizontalLayout:#rightSpace. |
|
4057 |
box add:(l := Label label:labelString). |
|
4058 |
l borderWidth:0. |
|
4059 |
box add:p. |
|
4060 |
] ifFalse:[ |
|
4061 |
box := p. |
|
4062 |
]. |
|
4063 |
self addComponent:box tabable:tabable tabbedComponent:p. |
|
4064 |
^ p |
|
4065 |
! |
|
4066 |
||
4067 |
addPopUpListOn:aModel |
|
4068 |
"create a popUpList on aModel and add it. |
|
4069 |
Returns the box." |
|
4070 |
||
4071 |
^ self addPopUpList:nil on:aModel tabable:true |
|
4072 |
! |
|
4073 |
||
4074 |
addPopUpListOn:aModel tabable:tabable |
|
4075 |
"create a popUpList on aModel and add it. |
|
4076 |
Returns the popUpList." |
|
4077 |
||
4078 |
^ self addPopUpList:nil on:aModel tabable:tabable |
|
4079 |
! ! |
|
4080 |
||
4081 |
!DialogBox methodsFor:'construction-rows & columns'! |
|
4082 |
||
130 | 4083 |
addColumn:aRow fromX:leftX toX:rightX collect:aBlock |
4084 |
"add some elements in a vertical column. |
|
4085 |
Equally space elements as returned from aBlock." |
|
4086 |
||
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4087 |
self |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4088 |
addColumn:aRow |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4089 |
fromX:leftX toX:rightX |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4090 |
collect:aBlock |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4091 |
tabable:false |
130 | 4092 |
|
4093 |
" |
|
4094 |
|dialog| |
|
4095 |
||
4096 |
dialog := Dialog new. |
|
4097 |
dialog |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4098 |
addColumn:#('label1' 'label2' 'lbl3' 'l4' 'label5') |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4099 |
fromX:0.0 |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4100 |
toX:1.0 |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4101 |
collect:[:label | Label label:label]. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4102 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4103 |
dialog addOkButton. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4104 |
dialog open. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4105 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4106 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4107 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4108 |
|dialog| |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4109 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4110 |
dialog := Dialog new. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4111 |
dialog |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4112 |
addColumn:#('label1' 'label2' 'label3' 'label4' 'label5') |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4113 |
fromX:0.25 |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4114 |
toX:0.75 |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4115 |
collect:[:label | (Label label:label) adjust:#left]. |
130 | 4116 |
|
4117 |
dialog addOkButton. |
|
4118 |
dialog open. |
|
4119 |
" |
|
4120 |
||
4121 |
" |
|
4122 |
|dialog y| |
|
4123 |
||
4124 |
dialog := Dialog new. |
|
4125 |
y := dialog yPosition. |
|
4126 |
dialog |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4127 |
addColumn:#('a1' 'b1' 'c1' 'd1') |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4128 |
fromX:0 |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4129 |
toX:(1/3) |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4130 |
collect:[:label | Label label:label]. |
130 | 4131 |
|
4132 |
dialog yPosition:y. |
|
4133 |
dialog |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4134 |
addColumn:#('a2' 'b2' 'c2' 'd2') |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4135 |
fromX:(1/3) |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4136 |
toX:(2/3) |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4137 |
collect:[:label | Label label:label]. |
130 | 4138 |
|
4139 |
dialog yPosition:y. |
|
4140 |
dialog |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4141 |
addColumn:#('a3' 'b3' 'c3' 'd3') |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4142 |
fromX:(2/3) |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4143 |
toX:1 |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4144 |
collect:[:label | Label label:label]. |
130 | 4145 |
|
4146 |
dialog addOkButton. |
|
4147 |
dialog open. |
|
4148 |
" |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4149 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4150 |
"Modified: 9.2.1996 / 22:22:12 / cg" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4151 |
! |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4152 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4153 |
addColumn:aRow fromX:leftX toX:rightX collect:aBlock tabable:tabable |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4154 |
"add some elements in a vertical column. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4155 |
Equally space elements as returned from aBlock." |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4156 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4157 |
self |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4158 |
addColumn:aRow |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4159 |
fromX:leftX toX:rightX |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4160 |
collect:aBlock |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4161 |
tabable:tabable |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4162 |
horizontalLayout:#fitSpace |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4163 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4164 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4165 |
|dialog y values| |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4166 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4167 |
values := (1 to:4) collect:[:dummy | '' asValue]. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4168 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4169 |
dialog := Dialog new. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4170 |
y := dialog yPosition. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4171 |
dialog |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4172 |
addColumn:#('one' 'two' 'three' 'four') |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4173 |
fromX:0 |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4174 |
toX:0.3 |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4175 |
collect:[:label | Label label:label]. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4176 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4177 |
dialog yPosition:y. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4178 |
dialog |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4179 |
addColumn:values |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4180 |
fromX:0.3 |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4181 |
toX:1.0 |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4182 |
collect:[:value | EditField on:value] |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4183 |
tabable:true. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4184 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4185 |
dialog addOkButton. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4186 |
dialog open. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4187 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4188 |
dialog accepted ifTrue:[ |
655 | 4189 |
Transcript showCR:(values collect:[:holder | holder value]) |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4190 |
] |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4191 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4192 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4193 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4194 |
|dialog y values| |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4195 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4196 |
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
|
4197 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4198 |
dialog := Dialog new. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4199 |
y := dialog yPosition. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4200 |
dialog |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4201 |
addColumn:(1 to:4) |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4202 |
fromX:0 |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4203 |
toX:0.5 |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4204 |
collect:[:idx | CheckToggle on:(values at:idx)] |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4205 |
tabable:true |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4206 |
horizontalLayout:#center. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4207 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4208 |
dialog yPosition:y. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4209 |
dialog |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4210 |
addColumn:(5 to:8) |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4211 |
fromX:0.5 |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4212 |
toX:1.0 |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4213 |
collect:[:idx | CheckToggle on:(values at:idx)] |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4214 |
tabable:true |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4215 |
horizontalLayout:#center. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4216 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4217 |
dialog addOkButton. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4218 |
dialog open. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4219 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4220 |
dialog accepted ifTrue:[ |
655 | 4221 |
Transcript showCR:(values collect:[:holder | holder value]) |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4222 |
] |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4223 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4224 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4225 |
"Created: 9.2.1996 / 21:51:47 / cg" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4226 |
"Modified: 9.2.1996 / 22:22:02 / cg" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4227 |
! |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4228 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4229 |
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
|
4230 |
"add some elements in a vertical column. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4231 |
Equally space elements as returned from aBlock." |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4232 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4233 |
|helper component| |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4234 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4235 |
helper := VerticalPanelView new. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4236 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4237 |
aRow do:[:el | |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4238 |
component := aBlock value:el. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4239 |
helper add:component. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4240 |
component resize. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4241 |
tabable ifTrue:[self makeTabable:component]. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4242 |
]. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4243 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4244 |
helper resize. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4245 |
self addComponent:helper. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4246 |
width < helper preferredExtent x ifTrue:[ |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4247 |
self width:helper preferredExtent x. |
655 | 4248 |
"/ Transcript show:'w now: '; showCR:helper preferredExtent x |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4249 |
]. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4250 |
helper horizontalLayout:hLayout. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4251 |
helper left:leftX asFloat; |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4252 |
right:rightX asFloat; |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4253 |
leftInset:leftIndent; |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4254 |
rightInset:rightIndent. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4255 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4256 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4257 |
|dialog y values| |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4258 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4259 |
values := (1 to:4) collect:[:dummy | '' asValue]. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4260 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4261 |
dialog := Dialog new. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4262 |
y := dialog yPosition. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4263 |
dialog |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4264 |
addColumn:#('one' 'two' 'three' 'four') |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4265 |
fromX:0 |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4266 |
toX:0.3 |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4267 |
collect:[:label | Label label:label]. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4268 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4269 |
dialog yPosition:y. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4270 |
dialog |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4271 |
addColumn:values |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4272 |
fromX:0.3 |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4273 |
toX:1.0 |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4274 |
collect:[:value | EditField on:value] |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4275 |
tabable:true. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4276 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4277 |
dialog addOkButton. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4278 |
dialog open. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4279 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4280 |
dialog accepted ifTrue:[ |
655 | 4281 |
Transcript showCR:(values collect:[:holder | holder value]) |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4282 |
] |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4283 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4284 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4285 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4286 |
|dialog y values| |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4287 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4288 |
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
|
4289 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4290 |
dialog := Dialog new. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4291 |
y := dialog yPosition. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4292 |
dialog |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4293 |
addColumn:(1 to:4) |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4294 |
fromX:0 |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4295 |
toX:0.5 |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4296 |
collect:[:idx | CheckToggle on:(values at:idx)]. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4297 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4298 |
dialog yPosition:y. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4299 |
dialog |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4300 |
addColumn:(5 to:8) |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4301 |
fromX:0.5 |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4302 |
toX:1.0 |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4303 |
collect:[:idx | CheckToggle on:(values at:idx)] |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4304 |
tabable:true. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4305 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4306 |
dialog addOkButton. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4307 |
dialog open. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4308 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4309 |
dialog accepted ifTrue:[ |
655 | 4310 |
Transcript showCR:(values collect:[:holder | holder value]) |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4311 |
] |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4312 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4313 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4314 |
"Modified: 9.2.1996 / 22:02:22 / cg" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4315 |
"Created: 9.2.1996 / 22:20:31 / cg" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4316 |
! |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4317 |
|
130 | 4318 |
addRow:aCol fromX:leftX toX:rightX collect:aBlock |
4319 |
"add some elements in a horizontal row. |
|
4320 |
Equally space elements as returned from aBlock. |
|
4321 |
Advance y." |
|
4322 |
||
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4323 |
self |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4324 |
addRow:aCol |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4325 |
fromX:leftX toX:rightX |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4326 |
collect:aBlock |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4327 |
tabable:true |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4328 |
horizontalLayout:#spread |
130 | 4329 |
|
4330 |
" |
|
4331 |
|dialog| |
|
4332 |
||
4333 |
dialog := Dialog new. |
|
4334 |
dialog |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4335 |
addRow:#('a' 'b' 'c' 'd') |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4336 |
fromX:0 |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4337 |
toX:1 |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4338 |
collect:[:label | Label label:label]. |
130 | 4339 |
|
4340 |
dialog addOkButton. |
|
4341 |
dialog open. |
|
4342 |
" |
|
4343 |
||
4344 |
" |
|
4345 |
|dialog| |
|
4346 |
||
4347 |
dialog := Dialog new. |
|
4348 |
dialog |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4349 |
addRow:#('a1' 'b1' 'c1' 'd1') |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4350 |
fromX:0 |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4351 |
toX:1 |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4352 |
collect:[:label | Label label:label]. |
130 | 4353 |
|
4354 |
dialog |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4355 |
addRow:#('a2' 'b2' 'c2' 'd2') |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4356 |
fromX:0 |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4357 |
toX:0.5 |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4358 |
collect:[:label | Label label:label]. |
130 | 4359 |
|
4360 |
dialog |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4361 |
addRow:#('a3' 'b3' 'c3' 'd3') |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4362 |
fromX:0.5 |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4363 |
toX:1 |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4364 |
collect:[:label | Label label:label]. |
130 | 4365 |
|
4366 |
dialog addOkButton. |
|
4367 |
dialog open. |
|
4368 |
" |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4369 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4370 |
"Modified: 9.2.1996 / 22:25:16 / cg" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4371 |
! |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4372 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4373 |
addRow:aCol fromX:leftX toX:rightX collect:aBlock tabable:tabable |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4374 |
"add some elements in a horizontal row. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4375 |
Equally space elements as returned from aBlock. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4376 |
Advance y." |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4377 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4378 |
self |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4379 |
addRow:aCol |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4380 |
fromX:leftX toX:rightX |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4381 |
collect:aBlock |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4382 |
tabable:tabable |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4383 |
horizontalLayout:#spread |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4384 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4385 |
"Created: 9.2.1996 / 22:25:35 / cg" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4386 |
! |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4387 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4388 |
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
|
4389 |
"add some elements in a horizontal row. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4390 |
Equally space elements as returned from aBlock. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4391 |
Advance y." |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4392 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4393 |
|helper component| |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4394 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4395 |
helper := HorizontalPanelView new. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4396 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4397 |
aCol do:[:el | |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4398 |
component := aBlock value:el. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4399 |
component resize. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4400 |
helper add:component. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4401 |
tabable ifTrue:[self makeTabable:component] |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4402 |
]. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4403 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4404 |
helper resize. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4405 |
self addComponent:helper. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4406 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4407 |
width < helper preferredExtent x ifTrue:[ |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4408 |
self width:helper preferredExtent x. |
655 | 4409 |
"/ Transcript show:'w now: '; showCR:helper preferredExtent x |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4410 |
]. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4411 |
helper horizontalLayout:hLayout. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4412 |
helper verticalLayout:#fit. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4413 |
helper left:leftX asFloat; |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4414 |
right:rightX asFloat. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4415 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4416 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4417 |
|dialog| |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4418 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4419 |
dialog := Dialog new. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4420 |
dialog |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4421 |
addRow:#('a' 'b' 'c' 'd') |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4422 |
fromX:0 |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4423 |
toX:1 |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4424 |
collect:[:label | Label label:label] |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4425 |
tabable:false |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4426 |
horizontalLayout:#fit. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4427 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4428 |
dialog addOkButton. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4429 |
dialog open. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4430 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4431 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4432 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4433 |
|dialog| |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4434 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4435 |
dialog := Dialog new. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4436 |
dialog |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4437 |
addRow:#('one' 'two' 'three' 'four') |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4438 |
fromX:0 |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4439 |
toX:1 |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4440 |
collect:[:label | Button label:label] |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4441 |
tabable:false |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4442 |
horizontalLayout:#fit. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4443 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4444 |
dialog addOkButton. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4445 |
dialog open. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4446 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4447 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4448 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4449 |
|dialog| |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4450 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4451 |
dialog := Dialog new. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4452 |
dialog |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4453 |
addRow:#('a1' 'b1' 'c1' 'd1') |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4454 |
fromX:0 |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4455 |
toX:1 |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4456 |
collect:[:label | Label label:label]. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4457 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4458 |
dialog |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4459 |
addRow:#('a2' 'b2' 'c2' 'd2') |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4460 |
fromX:0 |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4461 |
toX:0.5 |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4462 |
collect:[:label | Label label:label]. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4463 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4464 |
dialog |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4465 |
addRow:#('a3' 'b3' 'c3' 'd3') |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4466 |
fromX:0.5 |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4467 |
toX:1 |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4468 |
collect:[:label | Label label:label]. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4469 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4470 |
dialog addOkButton. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4471 |
dialog open. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4472 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4473 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4474 |
"Created: 9.2.1996 / 22:24:31 / cg" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
4475 |
"Modified: 9.2.1996 / 22:28:14 / cg" |
76 | 4476 |
! ! |
4477 |
||
551
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
4478 |
!DialogBox methodsFor:'explicit focus control'! |
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
4479 |
|
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
4480 |
focusOnOk |
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
4481 |
windowGroup focusView:okButton |
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
4482 |
|
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
4483 |
"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
|
4484 |
! ! |
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
4485 |
|
76 | 4486 |
!DialogBox methodsFor:'initialization'! |
4487 |
||
197 | 4488 |
focusSequence |
4489 |
"return the elements through which we can step via |
|
4490 |
NextField/PreviousField keys. |
|
4491 |
Here we return all tabable fields followed by all buttons in |
|
4492 |
the panel." |
|
4493 |
||
4494 |
|fields buttons| |
|
4495 |
||
4496 |
tabableElements isNil ifTrue:[ |
|
4497 |
fields := #() |
|
4498 |
] ifFalse:[ |
|
4499 |
fields := tabableElements |
|
4500 |
]. |
|
4501 |
buttonPanel notNil ifTrue:[ |
|
4502 |
buttons := buttonPanel subViews. |
|
4503 |
buttons notNil ifTrue:[ |
|
4504 |
fields := fields , buttonPanel subViews |
|
4505 |
] |
|
4506 |
]. |
|
4507 |
^ fields |
|
4508 |
! |
|
4509 |
||
76 | 4510 |
initialize |
4511 |
|mm| |
|
4512 |
||
4513 |
super initialize. |
|
4514 |
||
573 | 4515 |
"/ label := 'Dialog'. |
128 | 4516 |
acceptValue := false asValue. |
76 | 4517 |
|
4518 |
mm := ViewSpacing. |
|
4519 |
||
4520 |
acceptReturnAsOK := true. |
|
125 | 4521 |
acceptOnLeave := true. |
551
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
4522 |
focusToOKOnLeave := true. |
280
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
4523 |
hideOnAccept := true. |
469
1d86f97ab2e5
autoAccept as default; configurable
Claus Gittinger <cg@exept.de>
parents:
436
diff
changeset
|
4524 |
autoAccept := true. |
76 | 4525 |
|
4526 |
buttonPanel := HorizontalPanelView in:self. |
|
118 | 4527 |
buttonPanel |
469
1d86f97ab2e5
autoAccept as default; configurable
Claus Gittinger <cg@exept.de>
parents:
436
diff
changeset
|
4528 |
origin:(0.0 @ 1.0) corner:(1.0 @ 1.0); |
1d86f97ab2e5
autoAccept as default; configurable
Claus Gittinger <cg@exept.de>
parents:
436
diff
changeset
|
4529 |
bottomInset:mm; |
1d86f97ab2e5
autoAccept as default; configurable
Claus Gittinger <cg@exept.de>
parents:
436
diff
changeset
|
4530 |
topInset:(font height + mm * 2) negated; |
1d86f97ab2e5
autoAccept as default; configurable
Claus Gittinger <cg@exept.de>
parents:
436
diff
changeset
|
4531 |
borderWidth:0; |
1d86f97ab2e5
autoAccept as default; configurable
Claus Gittinger <cg@exept.de>
parents:
436
diff
changeset
|
4532 |
horizontalLayout:#spread. |
118 | 4533 |
|
122 | 4534 |
yPosition := ViewSpacing. |
312
008267b920d9
allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
4535 |
leftIndent := rightIndent := (ViewSpacing // 2). |
310
4bbc8deffc8c
allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents:
307
diff
changeset
|
4536 |
needResize := true. |
76 | 4537 |
|
4538 |
" |
|
4539 |
|b| |
|
4540 |
b := DialogBox new. |
|
118 | 4541 |
b addAbortButton; |
4542 |
addOkButton; |
|
4543 |
showAtPointer |
|
76 | 4544 |
" |
4545 |
" |
|
4546 |
|b| |
|
4547 |
b := DialogBox new. |
|
118 | 4548 |
b addOkButton; |
4549 |
showAtPointer |
|
4550 |
" |
|
76 | 4551 |
" |
118 | 4552 |
|b| |
4553 |
b := DialogBox new. |
|
4554 |
b addTextLabel:'hello world'; |
|
4555 |
addOkButton; |
|
4556 |
showAtPointer |
|
4557 |
" |
|
4558 |
" |
|
4559 |
|b| |
|
4560 |
b := DialogBox new. |
|
4561 |
b addTextLabel:'hello world'; |
|
4562 |
addVerticalSpace:50; |
|
4563 |
addOkButton; |
|
4564 |
showAtPointer |
|
4565 |
" |
|
310
4bbc8deffc8c
allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents:
307
diff
changeset
|
4566 |
|
573 | 4567 |
"Modified: 23.4.1996 / 17:13:18 / cg" |
76 | 4568 |
! |
4569 |
||
4570 |
reAdjustGeometry |
|
4571 |
"sent late in snapin processing - gives me a chance |
|
4572 |
to resize for changed font dimensions." |
|
4573 |
||
4574 |
super reAdjustGeometry. |
|
4575 |
okButton notNil ifTrue:[okButton resize]. |
|
4576 |
abortButton notNil ifTrue:[abortButton resize]. |
|
4577 |
self resize |
|
4578 |
! ! |
|
4579 |
||
197 | 4580 |
!DialogBox methodsFor:'private'! |
4581 |
||
4582 |
basicAddComponent:aComponent |
|
4583 |
"add a component, dont change its size" |
|
4584 |
||
4585 |
addedComponents isNil ifTrue:[ |
|
4586 |
addedComponents := OrderedCollection new. |
|
4587 |
]. |
|
4588 |
addedComponents add:aComponent. |
|
4589 |
self addSubView:aComponent. |
|
4590 |
! |
|
4591 |
||
4592 |
hideAndEvaluate:aBlock |
|
4593 |
"if I am modal, make myself invisible and evaluate aBlock. |
|
4594 |
If nonModal, stay up, but also evaluate the block." |
|
4595 |
||
4596 |
(windowGroup notNil and:[windowGroup isModal]) ifTrue:[ |
|
4597 |
self hide. |
|
4598 |
]. |
|
4599 |
aBlock notNil ifTrue:[aBlock value] |
|
4600 |
||
4601 |
"Modified: 5.9.1995 / 19:06:33 / claus" |
|
4602 |
! |
|
4603 |
||
4604 |
realize |
|
4605 |
"if any inputFields where added, activate the first one" |
|
4606 |
||
4607 |
inputFieldGroup notNil ifTrue:[ |
|
4608 |
inputFieldGroup activateFirst |
|
4609 |
]. |
|
4610 |
super realize |
|
310
4bbc8deffc8c
allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents:
307
diff
changeset
|
4611 |
! |
4bbc8deffc8c
allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents:
307
diff
changeset
|
4612 |
|
4bbc8deffc8c
allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents:
307
diff
changeset
|
4613 |
resize |
4bbc8deffc8c
allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents:
307
diff
changeset
|
4614 |
needResize ifTrue:[ |
314
705185e7001d
no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents:
312
diff
changeset
|
4615 |
needResize := false. |
705185e7001d
no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents:
312
diff
changeset
|
4616 |
super resize |
310
4bbc8deffc8c
allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents:
307
diff
changeset
|
4617 |
] |
4bbc8deffc8c
allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents:
307
diff
changeset
|
4618 |
|
4bbc8deffc8c
allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents:
307
diff
changeset
|
4619 |
"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
|
4620 |
"Modified: 27.1.1996 / 18:25:40 / cg" |
197 | 4621 |
! ! |
4622 |
||
120 | 4623 |
!DialogBox methodsFor:'queries'! |
118 | 4624 |
|
121 | 4625 |
accepted |
128 | 4626 |
"after the box has closed: |
4627 |
return true if accepted, false if canceled" |
|
125 | 4628 |
|
128 | 4629 |
^ acceptValue value |
121 | 4630 |
! |
4631 |
||
120 | 4632 |
positionOffset |
4633 |
"return the delta, by which the box should be displayed |
|
4634 |
from the mouse pointer. Value returned here makes center of |
|
4635 |
okButton appear under the cursor" |
|
118 | 4636 |
|
120 | 4637 |
okButton isNil ifTrue:[ |
4638 |
^ super positionOffset |
|
118 | 4639 |
]. |
120 | 4640 |
buttonPanel setChildPositionsIfChanged. |
4641 |
^ (okButton originRelativeTo:self) + (okButton extent // 2) |
|
118 | 4642 |
! |
4643 |
||
130 | 4644 |
preferredExtent |
132 | 4645 |
"return my preferred extent. |
4646 |
That is the max component width, or my current width (default); |
|
4647 |
whichever is larger, by the sum of the components heights." |
|
118 | 4648 |
|
120 | 4649 |
|w h p| |
118 | 4650 |
|
713
0c38ad51016d
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
680
diff
changeset
|
4651 |
preferredExtent notNil ifTrue:[ |
0c38ad51016d
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
680
diff
changeset
|
4652 |
^ preferredExtent |
0c38ad51016d
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
680
diff
changeset
|
4653 |
]. |
0c38ad51016d
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
680
diff
changeset
|
4654 |
|
120 | 4655 |
addedComponents notNil ifTrue:[ |
354
dcad6936bfa6
when computing the preferredExtent, take care of relative-sized components (scale)
Claus Gittinger <cg@exept.de>
parents:
353
diff
changeset
|
4656 |
w := addedComponents |
dcad6936bfa6
when computing the preferredExtent, take care of relative-sized components (scale)
Claus Gittinger <cg@exept.de>
parents:
353
diff
changeset
|
4657 |
inject:0 |
dcad6936bfa6
when computing the preferredExtent, take care of relative-sized components (scale)
Claus Gittinger <cg@exept.de>
parents:
353
diff
changeset
|
4658 |
into:[:max :element | |
dcad6936bfa6
when computing the preferredExtent, take care of relative-sized components (scale)
Claus Gittinger <cg@exept.de>
parents:
353
diff
changeset
|
4659 |
|eExt prefX scale rel relX| |
dcad6936bfa6
when computing the preferredExtent, take care of relative-sized components (scale)
Claus Gittinger <cg@exept.de>
parents:
353
diff
changeset
|
4660 |
|
dcad6936bfa6
when computing the preferredExtent, take care of relative-sized components (scale)
Claus Gittinger <cg@exept.de>
parents:
353
diff
changeset
|
4661 |
prefX := element preferredExtent x. |
dcad6936bfa6
when computing the preferredExtent, take care of relative-sized components (scale)
Claus Gittinger <cg@exept.de>
parents:
353
diff
changeset
|
4662 |
|
dcad6936bfa6
when computing the preferredExtent, take care of relative-sized components (scale)
Claus Gittinger <cg@exept.de>
parents:
353
diff
changeset
|
4663 |
"/ special (for your convenience) |
dcad6936bfa6
when computing the preferredExtent, take care of relative-sized components (scale)
Claus Gittinger <cg@exept.de>
parents:
353
diff
changeset
|
4664 |
"/ if the element has been added with a relative width, |
dcad6936bfa6
when computing the preferredExtent, take care of relative-sized components (scale)
Claus Gittinger <cg@exept.de>
parents:
353
diff
changeset
|
4665 |
"/ scale it to get at least its preferred width |
dcad6936bfa6
when computing the preferredExtent, take care of relative-sized components (scale)
Claus Gittinger <cg@exept.de>
parents:
353
diff
changeset
|
4666 |
|
dcad6936bfa6
when computing the preferredExtent, take care of relative-sized components (scale)
Claus Gittinger <cg@exept.de>
parents:
353
diff
changeset
|
4667 |
(rel := element relativeExtent) notNil ifTrue:[ |
dcad6936bfa6
when computing the preferredExtent, take care of relative-sized components (scale)
Claus Gittinger <cg@exept.de>
parents:
353
diff
changeset
|
4668 |
relX := rel x. |
dcad6936bfa6
when computing the preferredExtent, take care of relative-sized components (scale)
Claus Gittinger <cg@exept.de>
parents:
353
diff
changeset
|
4669 |
(relX isNil or:[relX isInteger]) ifFalse:[ |
dcad6936bfa6
when computing the preferredExtent, take care of relative-sized components (scale)
Claus Gittinger <cg@exept.de>
parents:
353
diff
changeset
|
4670 |
prefX := (prefX * (1 / relX)) rounded |
dcad6936bfa6
when computing the preferredExtent, take care of relative-sized components (scale)
Claus Gittinger <cg@exept.de>
parents:
353
diff
changeset
|
4671 |
]. |
dcad6936bfa6
when computing the preferredExtent, take care of relative-sized components (scale)
Claus Gittinger <cg@exept.de>
parents:
353
diff
changeset
|
4672 |
]. |
dcad6936bfa6
when computing the preferredExtent, take care of relative-sized components (scale)
Claus Gittinger <cg@exept.de>
parents:
353
diff
changeset
|
4673 |
eExt := prefX + (element borderWidth * 2). "/ max:element extent x. |
dcad6936bfa6
when computing the preferredExtent, take care of relative-sized components (scale)
Claus Gittinger <cg@exept.de>
parents:
353
diff
changeset
|
4674 |
max max:(eExt + element leftInset + element rightInset)]. |
120 | 4675 |
] ifFalse:[ |
354
dcad6936bfa6
when computing the preferredExtent, take care of relative-sized components (scale)
Claus Gittinger <cg@exept.de>
parents:
353
diff
changeset
|
4676 |
w := super preferredExtent x. |
120 | 4677 |
]. |
132 | 4678 |
w := w max:width. |
310
4bbc8deffc8c
allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents:
307
diff
changeset
|
4679 |
h := yPosition + ViewSpacing. |
118 | 4680 |
|
130 | 4681 |
buttonPanel subViews size ~~ 0 ifTrue:[ |
354
dcad6936bfa6
when computing the preferredExtent, take care of relative-sized components (scale)
Claus Gittinger <cg@exept.de>
parents:
353
diff
changeset
|
4682 |
p := buttonPanel preferredExtent. |
dcad6936bfa6
when computing the preferredExtent, take care of relative-sized components (scale)
Claus Gittinger <cg@exept.de>
parents:
353
diff
changeset
|
4683 |
w := w max:p x. |
dcad6936bfa6
when computing the preferredExtent, take care of relative-sized components (scale)
Claus Gittinger <cg@exept.de>
parents:
353
diff
changeset
|
4684 |
h := h |
dcad6936bfa6
when computing the preferredExtent, take care of relative-sized components (scale)
Claus Gittinger <cg@exept.de>
parents:
353
diff
changeset
|
4685 |
+ p y |
dcad6936bfa6
when computing the preferredExtent, take care of relative-sized components (scale)
Claus Gittinger <cg@exept.de>
parents:
353
diff
changeset
|
4686 |
+ ViewSpacing. |
120 | 4687 |
]. |
118 | 4688 |
|
120 | 4689 |
"/ okButton isNil ifTrue:[ |
130 | 4690 |
"/ ^ super preferredExtent |
120 | 4691 |
"/ ]. |
130 | 4692 |
"/ p := buttonPanel preferredExtent. |
120 | 4693 |
"/ w := p x. |
4694 |
"/ h := ViewSpacing |
|
4695 |
"/ + p y |
|
4696 |
"/ + ViewSpacing. |
|
4697 |
"/ |
|
4698 |
^ w @ h |
|
310
4bbc8deffc8c
allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents:
307
diff
changeset
|
4699 |
|
713
0c38ad51016d
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
680
diff
changeset
|
4700 |
"Modified: 29.5.1996 / 12:13:03 / cg" |
310
4bbc8deffc8c
allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents:
307
diff
changeset
|
4701 |
! ! |
4bbc8deffc8c
allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents:
307
diff
changeset
|
4702 |
|
197 | 4703 |
!DialogBox methodsFor:'user actions'! |
76 | 4704 |
|
197 | 4705 |
abortPressed |
4706 |
"sent by the cancel button; user pressed abort button |
|
4707 |
- hide myself and evaluate okAction" |
|
121 | 4708 |
|
197 | 4709 |
abortButton turnOffWithoutRedraw. |
4710 |
acceptValue value:false. |
|
121 | 4711 |
|
197 | 4712 |
"/ actually, only hides if I have been opened modal |
4713 |
self hideAndEvaluate:abortAction |
|
121 | 4714 |
! |
4715 |
||
197 | 4716 |
doAccept |
4717 |
"let all components accept (i.e. update their model from the values), |
|
4718 |
then set my accept value to true. |
|
4719 |
This is confusing: this method was originally called #accept, |
|
4720 |
but renamed for compatibility with ST-80, where #accept returns the |
|
4721 |
accept-valueHolder (which looks like a bad name to me ...)." |
|
76 | 4722 |
|
469
1d86f97ab2e5
autoAccept as default; configurable
Claus Gittinger <cg@exept.de>
parents:
436
diff
changeset
|
4723 |
autoAccept ifTrue:[ |
1d86f97ab2e5
autoAccept as default; configurable
Claus Gittinger <cg@exept.de>
parents:
436
diff
changeset
|
4724 |
addedComponents notNil ifTrue:[ |
1d86f97ab2e5
autoAccept as default; configurable
Claus Gittinger <cg@exept.de>
parents:
436
diff
changeset
|
4725 |
addedComponents do:[:aComponent | |
1d86f97ab2e5
autoAccept as default; configurable
Claus Gittinger <cg@exept.de>
parents:
436
diff
changeset
|
4726 |
(aComponent respondsTo:#accept) ifTrue:[ |
1d86f97ab2e5
autoAccept as default; configurable
Claus Gittinger <cg@exept.de>
parents:
436
diff
changeset
|
4727 |
aComponent accept |
1d86f97ab2e5
autoAccept as default; configurable
Claus Gittinger <cg@exept.de>
parents:
436
diff
changeset
|
4728 |
] |
1d86f97ab2e5
autoAccept as default; configurable
Claus Gittinger <cg@exept.de>
parents:
436
diff
changeset
|
4729 |
] |
1d86f97ab2e5
autoAccept as default; configurable
Claus Gittinger <cg@exept.de>
parents:
436
diff
changeset
|
4730 |
]. |
197 | 4731 |
]. |
4732 |
acceptValue value:true. |
|
469
1d86f97ab2e5
autoAccept as default; configurable
Claus Gittinger <cg@exept.de>
parents:
436
diff
changeset
|
4733 |
|
1d86f97ab2e5
autoAccept as default; configurable
Claus Gittinger <cg@exept.de>
parents:
436
diff
changeset
|
4734 |
"Modified: 4.3.1996 / 12:14:56 / cg" |
128 | 4735 |
! |
4736 |
||
197 | 4737 |
keyPress:aKey x:x y:y |
4738 |
"return-key dublicates ok-function if acceptReturnAsOK is true" |
|
76 | 4739 |
|
490 | 4740 |
<resource: #keyboard (#Return)> |
4741 |
||
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
4742 |
(aKey == #Return) ifTrue:[ |
490 | 4743 |
(okButton notNil and:[okButton isReturnButton]) ifTrue:[ |
4744 |
^ self okPressed |
|
4745 |
]. |
|
4746 |
(abortButton notNil and:[abortButton isReturnButton]) ifTrue:[ |
|
4747 |
^ self abortPressed |
|
4748 |
]. |
|
197 | 4749 |
]. |
4750 |
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
|
4751 |
|
490 | 4752 |
"Modified: 7.3.1996 / 13:15:09 / cg" |
76 | 4753 |
! |
4754 |
||
197 | 4755 |
lastFieldLeft |
4756 |
"if the dialog involves input fields, this is called |
|
4757 |
when the last field is left by Return-key or NextField-key" |
|
120 | 4758 |
|
197 | 4759 |
acceptOnLeave ifTrue:[ |
357
732f59def851
care for acceptReturnAsOK being false and return being pressed
Claus Gittinger <cg@exept.de>
parents:
356
diff
changeset
|
4760 |
acceptReturnAsOK ifTrue:[ |
551
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
4761 |
focusToOKOnLeave ifTrue:[ |
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
4762 |
self focusOnOk. |
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
4763 |
^ self. |
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
4764 |
]. |
357
732f59def851
care for acceptReturnAsOK being false and return being pressed
Claus Gittinger <cg@exept.de>
parents:
356
diff
changeset
|
4765 |
self okPressed |
732f59def851
care for acceptReturnAsOK being false and return being pressed
Claus Gittinger <cg@exept.de>
parents:
356
diff
changeset
|
4766 |
] |
197 | 4767 |
]. |
280
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
4768 |
inputFieldGroup activateFirst |
357
732f59def851
care for acceptReturnAsOK being false and return being pressed
Claus Gittinger <cg@exept.de>
parents:
356
diff
changeset
|
4769 |
|
551
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
4770 |
"Modified: 19.4.1996 / 17:09:02 / cg" |
76 | 4771 |
! |
4772 |
||
197 | 4773 |
okPressed |
4774 |
"sent by the okButton; user pressed ok-button |
|
4775 |
- make myself invisible and if an action was specified do it" |
|
128 | 4776 |
|
197 | 4777 |
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
|
4778 |
|
197 | 4779 |
self doAccept. |
4780 |
||
280
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
4781 |
acceptCheck notNil ifTrue:[ |
302 | 4782 |
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
|
4783 |
]. |
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
4784 |
|
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
4785 |
hideOnAccept ifTrue:[ |
302 | 4786 |
"/ actually, only hides if I have been opened modal |
4787 |
self hideAndEvaluate:okAction. |
|
280
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
4788 |
] ifFalse:[ |
302 | 4789 |
okAction value |
280
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
4790 |
] |
128 | 4791 |
! ! |
240 | 4792 |
|
4793 |
!DialogBox class methodsFor:'documentation'! |
|
4794 |
||
4795 |
version |
|
719
574be1981be0
destroy boxes from standard dialogs
Claus Gittinger <cg@exept.de>
parents:
718
diff
changeset
|
4796 |
^ '$Header: /cvs/stx/stx/libwidg/DialogBox.st,v 1.79 1996-05-29 13:28:01 cg Exp $' |
240 | 4797 |
! ! |
498 | 4798 |
DialogBox initialize! |