author | Claus Gittinger <cg@exept.de> |
Mon, 13 Aug 2018 09:43:00 +0200 | |
changeset 6391 | 935a745d3c55 |
parent 6235 | c9af202cf052 |
child 6468 | dbd77c7b3738 |
permissions | -rw-r--r-- |
0 | 1 |
" |
5 | 2 |
COPYRIGHT (c) 1991 by Claus Gittinger |
59 | 3 |
All Rights Reserved |
0 | 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 |
" |
|
2212
7475e8be57bb
recompute label origin, if the form changes
Claus Gittinger <cg@exept.de>
parents:
2162
diff
changeset
|
12 |
"{ Package: 'stx:libwidg' }" |
7475e8be57bb
recompute label origin, if the form changes
Claus Gittinger <cg@exept.de>
parents:
2162
diff
changeset
|
13 |
|
5893 | 14 |
"{ NameSpace: Smalltalk }" |
15 |
||
740
2d5cb01c7e11
no need for focusSequence - DialogBox does it
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
16 |
DialogBox subclass:#OptionBox |
3936 | 17 |
instanceVariableNames:'labelPanel formLabel textLabel buttons actions defaultButtonIndex' |
6235 | 18 |
classVariableNames:'WarnBitmap InfoBitmap YesNoBitmap' |
355 | 19 |
poolDictionaries:'' |
20 |
category:'Views-DialogBoxes' |
|
0 | 21 |
! |
22 |
||
847 | 23 |
!OptionBox class methodsFor:'documentation'! |
7 | 24 |
|
38 | 25 |
copyright |
26 |
" |
|
27 |
COPYRIGHT (c) 1991 by Claus Gittinger |
|
59 | 28 |
All Rights Reserved |
38 | 29 |
|
30 |
This software is furnished under a license and may be used |
|
31 |
only in accordance with the terms of that license and with the |
|
32 |
inclusion of the above copyright notice. This software may not |
|
33 |
be provided or otherwise made available to, or used by, any |
|
34 |
other person. No title to or ownership of the software is |
|
35 |
hereby transferred. |
|
36 |
" |
|
37 |
! |
|
38 |
||
7 | 39 |
documentation |
40 |
" |
|
646 | 41 |
CAVEAT: this is a leftover - functionality has been merged into DialogBox |
3936 | 42 |
PLEASE use one of the `Dialog chooseXXX' methods instead of OptionBox. |
646 | 43 |
|
44 |
||
355 | 45 |
Historic note: |
646 | 46 |
originally, ST/X had separate classes for the various entry methods; |
47 |
there were YesNoBox, EnterBox, InfoBox and so on. |
|
48 |
In the meantime, the DialogBox class (and therefore its alias: Dialog) |
|
5893 | 49 |
is going to duplicate most functionality found in these classes. |
355 | 50 |
|
646 | 51 |
In the future, those existing subclasses' functionality is going to |
52 |
be moved fully into Dialog, and the subclasses will be replaced by dummy |
|
53 |
delegators. (They will be kept for backward compatibility, though). |
|
355 | 54 |
|
55 |
||
38 | 56 |
OptionBoxes are like YesNoBoxes but with as many buttons as you like; |
91 | 57 |
this will finally be a superclass of WarnBox and YesNoBox - or maybe merged |
38 | 58 |
all into DialogBox.. |
97 | 59 |
Use them for multiway questions. |
91 | 60 |
For a consistent user interface, the rightmost button is the default return |
97 | 61 |
button (i.e. pressing return in the box performs this buttons function). |
91 | 62 |
|
646 | 63 |
[author:] |
64 |
Claus Gittinger |
|
91 | 65 |
|
646 | 66 |
[see also:] |
67 |
DialogBox |
|
68 |
" |
|
69 |
! |
|
91 | 70 |
|
646 | 71 |
examples |
72 |
" |
|
73 |
[exBegin] |
|
74 |
|box| |
|
97 | 75 |
|
646 | 76 |
box := OptionBox title:'hello' numberOfOptions:4. |
77 |
box showAtPointer |
|
78 |
[exEnd] |
|
97 | 79 |
|
80 |
||
646 | 81 |
[exBegin] |
82 |
|box| |
|
83 |
box := OptionBox title:'hello' numberOfOptions:3. |
|
84 |
box buttonTitles:#('one' 'two' 'three'). |
|
85 |
box showAtPointer |
|
86 |
[exEnd] |
|
97 | 87 |
|
646 | 88 |
performing an action: |
97 | 89 |
|
646 | 90 |
[exBegin] |
91 |
|box| |
|
92 |
box := OptionBox title:'hello' numberOfOptions:3. |
|
93 |
box buttonTitles:#('one' 'two' 'three'). |
|
94 |
box action:[:which | Transcript show:'button '; |
|
95 |
show: which; |
|
655 | 96 |
showCR:' was pressed']. |
646 | 97 |
box showAtPointer |
98 |
[exEnd] |
|
97 | 99 |
|
646 | 100 |
returning a value: |
101 |
[exBegin] |
|
102 |
|what| |
|
133 | 103 |
|
5893 | 104 |
what := OptionBox |
646 | 105 |
request:('text has not been accepted.\\Your modifications will be lost when continuing.') withCRs |
106 |
label:' Attention' |
|
2969
eb87f1aedd6c
Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents:
2898
diff
changeset
|
107 |
image:(WarningBox iconBitmap) |
3211 | 108 |
buttonLabels:#('Abort' 'Accept' 'Continue') |
646 | 109 |
values:#(#abort #accept #continue). |
655 | 110 |
Transcript showCR:what. |
646 | 111 |
[exEnd] |
3211 | 112 |
|
113 |
||
114 |
use callBack-hook to intercept creation: |
|
115 |
[exBegin] |
|
116 |
|what| |
|
117 |
||
118 |
AboutToOpenBoxNotificationSignal handle:[:ex | |
|
119 |
|box| |
|
120 |
||
121 |
box := ex parameter. |
|
5893 | 122 |
box verticalPanel |
3211 | 123 |
add:(CheckBox label:'Do no show this Dialog again.' |
124 |
model:false asValue). |
|
125 |
ex proceed. |
|
126 |
] do:[ |
|
5893 | 127 |
what := OptionBox |
3211 | 128 |
request:('bla bla bla bla.\\You must bla bla bla!!') withCRs |
129 |
label:' Attention' |
|
130 |
image:(WarningBox iconBitmap) |
|
131 |
buttonLabels:#('Abort' 'Accept' 'Continue') |
|
132 |
values:#(#abort #accept #continue) |
|
133 |
default:#continue. |
|
134 |
]. |
|
135 |
Transcript showCR:what. |
|
136 |
[exEnd] |
|
7 | 137 |
" |
197 | 138 |
! ! |
139 |
||
847 | 140 |
!OptionBox class methodsFor:'instance creation'! |
197 | 141 |
|
142 |
title:titleString numberOfOptions:nOptions |
|
143 |
"create a new optionBox with title, aTitleString and nOptions options" |
|
144 |
||
145 |
|box| |
|
146 |
||
5027 | 147 |
box := self basicNew numberOfOptions:nOptions. |
148 |
"/ Later... |
|
149 |
"/ box initializeForDevice:Screen current. |
|
197 | 150 |
box device:Screen current. |
151 |
box initialize. |
|
152 |
box title:titleString. |
|
153 |
^ box |
|
7 | 154 |
! ! |
155 |
||
2449 | 156 |
!OptionBox class methodsFor:'easy startup'! |
95 | 157 |
|
2969
eb87f1aedd6c
Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents:
2898
diff
changeset
|
158 |
forRequest:title label:label image:anImage buttonLabels:labels values:values default:defaultValue |
2585 | 159 |
"create a new optionBox and return it. |
160 |
Does not open the box." |
|
161 |
||
162 |
|box| |
|
163 |
||
164 |
box := OptionBox title:title numberOfOptions:(labels size). |
|
165 |
box buttonTitles:labels. |
|
5893 | 166 |
box defaultButtonIndex:(values indexOf:defaultValue). |
2969
eb87f1aedd6c
Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents:
2898
diff
changeset
|
167 |
box label:label; image:anImage. |
2898 | 168 |
values keysAndValuesDo:[:idx :val | |
169 |
val == false ifTrue:[ |
|
170 |
(box buttons at:idx) cursor:(Cursor thumbsDown). |
|
171 |
]. |
|
172 |
val == true ifTrue:[ |
|
173 |
(box buttons at:idx) cursor:(Cursor thumbsUp). |
|
174 |
]. |
|
175 |
]. |
|
2585 | 176 |
^ box |
177 |
||
178 |
"Modified: / 23.2.2000 / 11:59:32 / cg" |
|
179 |
! |
|
180 |
||
5893 | 181 |
request:title buttonLabels:labels values:values |
2668 | 182 |
"create a new optionBox, open it modal and return the value of |
6196 | 183 |
the corresponding values collection. Return nil if canceled" |
2668 | 184 |
|
5893 | 185 |
^ self |
186 |
request:title |
|
187 |
label:title |
|
188 |
buttonLabels:labels |
|
4223 | 189 |
values:values |
2668 | 190 |
|
191 |
" |
|
5893 | 192 |
OptionBox |
2668 | 193 |
request:'please select any' |
194 |
buttonLabels:#('one' 'two' 'three') |
|
5893 | 195 |
values:#(1 2 3) |
2668 | 196 |
" |
4223 | 197 |
|
198 |
"Modified: / 08-02-2011 / 11:22:13 / cg" |
|
6196 | 199 |
"Modified (comment): / 24-08-2017 / 15:03:02 / cg" |
2668 | 200 |
! |
201 |
||
2669 | 202 |
request:title buttonLabels:labels values:values default:defaultValue |
203 |
"create a new optionBox, open it modal and return the value of |
|
6196 | 204 |
the corresponding values collection. Return nil if canceled." |
2669 | 205 |
|
206 |
^ self |
|
5893 | 207 |
request:title label:title image:(YesNoBox iconBitmap) buttonLabels:labels values:values |
2711
e18e9edca978
by default, return nil if cancelled
Claus Gittinger <cg@exept.de>
parents:
2700
diff
changeset
|
208 |
default:defaultValue onCancel:nil |
2669 | 209 |
|
210 |
" |
|
5893 | 211 |
OptionBox |
2669 | 212 |
request:'please select' |
213 |
buttonLabels:#('one' 'two' 'three') |
|
5893 | 214 |
values:#(1 2 3) |
215 |
default:3 |
|
2669 | 216 |
" |
6196 | 217 |
|
218 |
"Modified (comment): / 24-08-2017 / 15:03:07 / cg" |
|
2669 | 219 |
! |
220 |
||
5893 | 221 |
request:title label:label buttonLabels:labels values:values |
2405 | 222 |
"create a new optionBox, open it modal and return the value of |
6196 | 223 |
the corresponding values collection. Return nil if canceled" |
2405 | 224 |
|
5893 | 225 |
^ self |
226 |
request:title |
|
227 |
label:label |
|
4224 | 228 |
image:(YesNoBox iconBitmap) |
5893 | 229 |
buttonLabels:labels |
230 |
values:values |
|
231 |
default:nil |
|
4224 | 232 |
onCancel:nil |
2668 | 233 |
|
234 |
" |
|
5893 | 235 |
OptionBox |
2668 | 236 |
request:'please select' |
237 |
label:'select any' |
|
238 |
buttonLabels:#('one' 'two' 'three') |
|
5893 | 239 |
values:#(1 2 3) |
2668 | 240 |
" |
4224 | 241 |
|
242 |
"Modified: / 08-02-2011 / 11:32:48 / cg" |
|
6196 | 243 |
"Modified (comment): / 24-08-2017 / 15:03:10 / cg" |
2405 | 244 |
! |
245 |
||
246 |
request:title label:label buttonLabels:labels values:values default:defaultValue |
|
247 |
"create a new optionBox, open it modal and return the value of |
|
6196 | 248 |
the corresponding values collection. Return nil if canceled" |
2405 | 249 |
|
250 |
^ self |
|
5893 | 251 |
request:title label:label image:(YesNoBox iconBitmap) buttonLabels:labels values:values |
2711
e18e9edca978
by default, return nil if cancelled
Claus Gittinger <cg@exept.de>
parents:
2700
diff
changeset
|
252 |
default:defaultValue onCancel:nil |
2668 | 253 |
|
254 |
" |
|
5893 | 255 |
OptionBox |
2668 | 256 |
request:'please select' |
257 |
label:'select any' |
|
258 |
buttonLabels:#('one' 'two' 'three') |
|
5893 | 259 |
values:#(1 2 3) |
260 |
default:3 |
|
2668 | 261 |
" |
6196 | 262 |
|
263 |
"Modified (comment): / 24-08-2017 / 15:03:15 / cg" |
|
2405 | 264 |
! |
265 |
||
266 |
request:title label:label buttonLabels:labels values:values default:defaultValue onCancel:cancelValue |
|
267 |
"create a new optionBox, open it modal and return the value of |
|
6196 | 268 |
the corresponding values collection. Return cancelValue if canceled." |
2405 | 269 |
|
270 |
^ self |
|
5893 | 271 |
request:title label:label image:(YesNoBox iconBitmap) buttonLabels:labels values:values |
2405 | 272 |
default:defaultValue onCancel:cancelValue |
2668 | 273 |
|
274 |
" |
|
5893 | 275 |
OptionBox |
2668 | 276 |
request:'please select' |
277 |
label:'select any' |
|
278 |
buttonLabels:#('one' 'two' 'three') |
|
5893 | 279 |
values:#(1 2 3) |
280 |
default:3 |
|
281 |
onCancel:2 |
|
2668 | 282 |
" |
6196 | 283 |
|
284 |
"Modified (comment): / 24-08-2017 / 15:03:18 / cg" |
|
2405 | 285 |
! |
286 |
||
5893 | 287 |
request:title label:label image:anImage buttonLabels:labels values:values |
133 | 288 |
"create a new optionBox, open it modal and return the value of |
6196 | 289 |
the corresponding values collection. Return nil, if canceled." |
133 | 290 |
|
5893 | 291 |
^ self |
292 |
request:title label:label image:anImage buttonLabels:labels values:values |
|
2711
e18e9edca978
by default, return nil if cancelled
Claus Gittinger <cg@exept.de>
parents:
2700
diff
changeset
|
293 |
default:nil onCancel:nil |
2668 | 294 |
|
295 |
" |
|
5893 | 296 |
OptionBox |
2668 | 297 |
request:'please select' |
298 |
label:'select any' |
|
2969
eb87f1aedd6c
Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents:
2898
diff
changeset
|
299 |
image:(WarningBox iconBitmap) |
2668 | 300 |
buttonLabels:#('one' 'two' 'three') |
301 |
values:#(1 2 3) |
|
302 |
" |
|
6196 | 303 |
|
304 |
"Modified (comment): / 24-08-2017 / 15:03:31 / cg" |
|
133 | 305 |
! |
306 |
||
2969
eb87f1aedd6c
Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents:
2898
diff
changeset
|
307 |
request:title label:label image:anImage buttonLabels:labels values:values default:defaultValue |
95 | 308 |
"create a new optionBox, open it modal and return the value of |
6196 | 309 |
the corresponding values collection. Return nil if canceled." |
95 | 310 |
|
2390 | 311 |
^ self |
5893 | 312 |
request:title label:label image:anImage buttonLabels:labels values:values |
2711
e18e9edca978
by default, return nil if cancelled
Claus Gittinger <cg@exept.de>
parents:
2700
diff
changeset
|
313 |
default:defaultValue onCancel:nil |
2668 | 314 |
|
315 |
" |
|
5893 | 316 |
OptionBox |
2668 | 317 |
request:'please select' |
318 |
label:'select any' |
|
2969
eb87f1aedd6c
Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents:
2898
diff
changeset
|
319 |
image:(WarningBox iconBitmap) |
2668 | 320 |
buttonLabels:#('one' 'two' 'three') |
321 |
values:#(1 2 3) |
|
322 |
default:3 |
|
323 |
" |
|
6196 | 324 |
|
325 |
"Modified (comment): / 24-08-2017 / 15:03:34 / cg" |
|
2390 | 326 |
! |
327 |
||
2969
eb87f1aedd6c
Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents:
2898
diff
changeset
|
328 |
request:title label:label image:anImage buttonLabels:labels values:values default:defaultValue onCancel:cancelValue |
2390 | 329 |
"create a new optionBox, open it modal and return the value of |
6196 | 330 |
the corresponding values collection. Return cancelValue if canceled." |
2390 | 331 |
|
2162 | 332 |
|box retVal| |
95 | 333 |
|
2390 | 334 |
retVal := cancelValue. |
2585 | 335 |
box := self |
5893 | 336 |
forRequest:title |
337 |
label:label |
|
338 |
image:anImage |
|
339 |
buttonLabels:labels |
|
340 |
values:values |
|
2585 | 341 |
default:defaultValue. |
342 |
||
2162 | 343 |
box action:[:n | retVal := values at:n]. |
3211 | 344 |
self showAndThenDestroyBox:box. |
2389 | 345 |
|
2162 | 346 |
^ retVal |
95 | 347 |
|
348 |
" |
|
5893 | 349 |
OptionBox |
2668 | 350 |
request:'please select' |
351 |
label:'select any' |
|
2969
eb87f1aedd6c
Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents:
2898
diff
changeset
|
352 |
image:(WarningBox iconBitmap) |
2668 | 353 |
buttonLabels:#('one' 'two' 'three') |
354 |
values:#(1 2 3) |
|
355 |
default:3 |
|
356 |
onCancel:nil |
|
95 | 357 |
" |
920 | 358 |
|
6196 | 359 |
"Modified: / 23-02-2000 / 11:59:32 / cg" |
360 |
"Modified (comment): / 24-08-2017 / 15:03:36 / cg" |
|
95 | 361 |
! ! |
362 |
||
2969
eb87f1aedd6c
Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents:
2898
diff
changeset
|
363 |
!OptionBox class methodsFor:'obsolete'! |
eb87f1aedd6c
Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents:
2898
diff
changeset
|
364 |
|
eb87f1aedd6c
Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents:
2898
diff
changeset
|
365 |
forRequest:title label:label form:anImage buttonLabels:labels values:values default:defaultValue |
eb87f1aedd6c
Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents:
2898
diff
changeset
|
366 |
"create a new optionBox and return it. |
eb87f1aedd6c
Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents:
2898
diff
changeset
|
367 |
Does not open the box." |
eb87f1aedd6c
Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents:
2898
diff
changeset
|
368 |
|
eb87f1aedd6c
Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents:
2898
diff
changeset
|
369 |
<resource:#obsolete> |
eb87f1aedd6c
Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents:
2898
diff
changeset
|
370 |
|
eb87f1aedd6c
Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents:
2898
diff
changeset
|
371 |
self forRequest:title label:label image:anImage buttonLabels:labels values:values default:defaultValue |
eb87f1aedd6c
Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents:
2898
diff
changeset
|
372 |
! |
eb87f1aedd6c
Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents:
2898
diff
changeset
|
373 |
|
5893 | 374 |
request:title label:label form:aForm buttonLabels:labels values:values |
2969
eb87f1aedd6c
Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents:
2898
diff
changeset
|
375 |
"create a new optionBox, open it modal and return the value of |
6196 | 376 |
the corresponding values collection. Return nil, if canceled." |
2969
eb87f1aedd6c
Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents:
2898
diff
changeset
|
377 |
|
eb87f1aedd6c
Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents:
2898
diff
changeset
|
378 |
<resource:#obsolete> |
eb87f1aedd6c
Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents:
2898
diff
changeset
|
379 |
|
5893 | 380 |
^ self |
381 |
request:title label:label image:aForm buttonLabels:labels values:values |
|
2969
eb87f1aedd6c
Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents:
2898
diff
changeset
|
382 |
default:nil onCancel:nil |
6196 | 383 |
|
384 |
"Modified (comment): / 24-08-2017 / 15:03:22 / cg" |
|
2969
eb87f1aedd6c
Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents:
2898
diff
changeset
|
385 |
! |
eb87f1aedd6c
Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents:
2898
diff
changeset
|
386 |
|
eb87f1aedd6c
Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents:
2898
diff
changeset
|
387 |
request:title label:label form:aForm buttonLabels:labels values:values default:defaultValue |
eb87f1aedd6c
Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents:
2898
diff
changeset
|
388 |
"create a new optionBox, open it modal and return the value of |
6196 | 389 |
the corresponding values collection. Return nil if canceled." |
2969
eb87f1aedd6c
Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents:
2898
diff
changeset
|
390 |
|
eb87f1aedd6c
Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents:
2898
diff
changeset
|
391 |
<resource:#obsolete> |
eb87f1aedd6c
Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents:
2898
diff
changeset
|
392 |
|
eb87f1aedd6c
Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents:
2898
diff
changeset
|
393 |
^ self |
5893 | 394 |
request:title |
395 |
label:label |
|
396 |
image:aForm |
|
397 |
buttonLabels:labels |
|
398 |
values:values |
|
399 |
default:defaultValue |
|
2991 | 400 |
onCancel:nil |
6196 | 401 |
|
402 |
"Modified (comment): / 24-08-2017 / 15:03:25 / cg" |
|
2969
eb87f1aedd6c
Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents:
2898
diff
changeset
|
403 |
! |
eb87f1aedd6c
Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents:
2898
diff
changeset
|
404 |
|
eb87f1aedd6c
Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents:
2898
diff
changeset
|
405 |
request:title label:label form:aForm buttonLabels:labels values:values default:defaultValue onCancel:cancelValue |
eb87f1aedd6c
Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents:
2898
diff
changeset
|
406 |
"create a new optionBox, open it modal and return the value of |
6196 | 407 |
the corresponding values collection. Return cancelValue if canceled." |
2969
eb87f1aedd6c
Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents:
2898
diff
changeset
|
408 |
|
eb87f1aedd6c
Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents:
2898
diff
changeset
|
409 |
<resource:#obsolete> |
eb87f1aedd6c
Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents:
2898
diff
changeset
|
410 |
|
eb87f1aedd6c
Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents:
2898
diff
changeset
|
411 |
^ self request:title label:label image:aForm buttonLabels:labels values:values default:defaultValue onCancel:cancelValue |
6196 | 412 |
|
413 |
"Modified (comment): / 24-08-2017 / 15:03:28 / cg" |
|
2969
eb87f1aedd6c
Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents:
2898
diff
changeset
|
414 |
! ! |
eb87f1aedd6c
Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents:
2898
diff
changeset
|
415 |
|
197 | 416 |
!OptionBox methodsFor:'accessing'! |
417 |
||
418 |
action:actionBlock |
|
419 |
"define a single the action for all buttons. |
|
420 |
The action will be evaluated with the button index as argument." |
|
421 |
||
422 |
buttons keysAndValuesDo:[:index :button | |
|
423 |
button action:[ |
|
424 |
button turnOffWithoutRedraw. |
|
425 |
self hide. |
|
426 |
actionBlock value:index |
|
427 |
] |
|
428 |
]. |
|
429 |
! |
|
430 |
||
431 |
actions:actionBlocks |
|
432 |
"define the actions" |
|
0 | 433 |
|
197 | 434 |
actions := actionBlocks |
435 |
! |
|
436 |
||
437 |
buttonTitles:titles actions:actionBlocks |
|
438 |
"define both button titles and actions" |
|
439 |
||
440 |
self buttonTitles:titles. |
|
441 |
actions := actionBlocks. |
|
442 |
! |
|
0 | 443 |
|
197 | 444 |
defaultButtonIndex:index |
847 | 445 |
"define which button is the default (i.e. return-) button. |
446 |
By default, no returnButton is setup. The argument must be an |
|
447 |
index 1..nButtons, or nil" |
|
448 |
||
197 | 449 |
defaultButtonIndex notNil ifTrue:[ |
847 | 450 |
(buttons at:defaultButtonIndex) isReturnButton:false |
197 | 451 |
]. |
452 |
(index notNil and:[index ~~ 0]) ifTrue:[ |
|
847 | 453 |
defaultButtonIndex := index. |
454 |
defaultButtonIndex notNil ifTrue:[ |
|
5893 | 455 |
(buttons at:defaultButtonIndex) isReturnButton:true |
847 | 456 |
]. |
197 | 457 |
] |
847 | 458 |
|
459 |
"Modified: 18.10.1996 / 14:53:36 / cg" |
|
197 | 460 |
! |
461 |
||
462 |
numberOfOptions |
|
463 |
"return the number of options" |
|
464 |
||
465 |
^ buttons size |
|
466 |
! |
|
467 |
||
468 |
numberOfOptions:nOptions |
|
847 | 469 |
"set the number of options - this is a private interface" |
197 | 470 |
|
5109 | 471 |
buttons := OrderedCollection newWithSize:nOptions. |
472 |
actions := OrderedCollection newWithSize:nOptions |
|
847 | 473 |
|
474 |
"Modified: 18.10.1996 / 14:54:30 / cg" |
|
740
2d5cb01c7e11
no need for focusSequence - DialogBox does it
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
475 |
! ! |
2d5cb01c7e11
no need for focusSequence - DialogBox does it
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
476 |
|
3208
7b4c5a215af9
use panels, to allow for hooks to add more widgets.
Claus Gittinger <cg@exept.de>
parents:
3201
diff
changeset
|
477 |
!OptionBox methodsFor:'accessing-components'! |
7b4c5a215af9
use panels, to allow for hooks to add more widgets.
Claus Gittinger <cg@exept.de>
parents:
3201
diff
changeset
|
478 |
|
7b4c5a215af9
use panels, to allow for hooks to add more widgets.
Claus Gittinger <cg@exept.de>
parents:
3201
diff
changeset
|
479 |
buttons |
7b4c5a215af9
use panels, to allow for hooks to add more widgets.
Claus Gittinger <cg@exept.de>
parents:
3201
diff
changeset
|
480 |
"return the buttons collection" |
7b4c5a215af9
use panels, to allow for hooks to add more widgets.
Claus Gittinger <cg@exept.de>
parents:
3201
diff
changeset
|
481 |
|
7b4c5a215af9
use panels, to allow for hooks to add more widgets.
Claus Gittinger <cg@exept.de>
parents:
3201
diff
changeset
|
482 |
^ buttons |
7b4c5a215af9
use panels, to allow for hooks to add more widgets.
Claus Gittinger <cg@exept.de>
parents:
3201
diff
changeset
|
483 |
! |
7b4c5a215af9
use panels, to allow for hooks to add more widgets.
Claus Gittinger <cg@exept.de>
parents:
3201
diff
changeset
|
484 |
|
7b4c5a215af9
use panels, to allow for hooks to add more widgets.
Claus Gittinger <cg@exept.de>
parents:
3201
diff
changeset
|
485 |
labelPanel |
7b4c5a215af9
use panels, to allow for hooks to add more widgets.
Claus Gittinger <cg@exept.de>
parents:
3201
diff
changeset
|
486 |
^ labelPanel |
7b4c5a215af9
use panels, to allow for hooks to add more widgets.
Claus Gittinger <cg@exept.de>
parents:
3201
diff
changeset
|
487 |
! ! |
7b4c5a215af9
use panels, to allow for hooks to add more widgets.
Claus Gittinger <cg@exept.de>
parents:
3201
diff
changeset
|
488 |
|
2227 | 489 |
!OptionBox methodsFor:'accessing-look'! |
740
2d5cb01c7e11
no need for focusSequence - DialogBox does it
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
490 |
|
2d5cb01c7e11
no need for focusSequence - DialogBox does it
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
491 |
buttonTitles:titles |
2d5cb01c7e11
no need for focusSequence - DialogBox does it
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
492 |
"set the button titles" |
2d5cb01c7e11
no need for focusSequence - DialogBox does it
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
493 |
|
2d5cb01c7e11
no need for focusSequence - DialogBox does it
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
494 |
titles keysAndValuesDo:[:index :aString | |
3733 | 495 |
|b| |
740
2d5cb01c7e11
no need for focusSequence - DialogBox does it
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
496 |
|
3733 | 497 |
(b := buttons at:index) label:aString. |
498 |
b name: (b name? ''), index printString. |
|
499 |
b resize. |
|
740
2d5cb01c7e11
no need for focusSequence - DialogBox does it
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
500 |
]. |
2d5cb01c7e11
no need for focusSequence - DialogBox does it
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
501 |
shown ifTrue:[self resize] |
2d5cb01c7e11
no need for focusSequence - DialogBox does it
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
502 |
! |
2d5cb01c7e11
no need for focusSequence - DialogBox does it
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
503 |
|
2d5cb01c7e11
no need for focusSequence - DialogBox does it
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
504 |
form:aFormOrImage |
2969
eb87f1aedd6c
Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents:
2898
diff
changeset
|
505 |
"historical leftover - define a form to be displayed left of the title" |
2212
7475e8be57bb
recompute label origin, if the form changes
Claus Gittinger <cg@exept.de>
parents:
2162
diff
changeset
|
506 |
|
2969
eb87f1aedd6c
Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents:
2898
diff
changeset
|
507 |
<resource:#obsolete> |
2212
7475e8be57bb
recompute label origin, if the form changes
Claus Gittinger <cg@exept.de>
parents:
2162
diff
changeset
|
508 |
|
2969
eb87f1aedd6c
Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents:
2898
diff
changeset
|
509 |
self image:aFormOrImage |
740
2d5cb01c7e11
no need for focusSequence - DialogBox does it
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
510 |
! |
2d5cb01c7e11
no need for focusSequence - DialogBox does it
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
511 |
|
2d5cb01c7e11
no need for focusSequence - DialogBox does it
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
512 |
formLabel |
2d5cb01c7e11
no need for focusSequence - DialogBox does it
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
513 |
"return the label-view which displays a bitmap" |
2d5cb01c7e11
no need for focusSequence - DialogBox does it
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
514 |
|
2d5cb01c7e11
no need for focusSequence - DialogBox does it
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
515 |
^ formLabel |
197 | 516 |
! |
0 | 517 |
|
2476 | 518 |
image:aFormOrImage |
519 |
"set the image shown in the label-view" |
|
520 |
||
2969
eb87f1aedd6c
Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents:
2898
diff
changeset
|
521 |
|mm| |
2476 | 522 |
|
2969
eb87f1aedd6c
Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents:
2898
diff
changeset
|
523 |
mm := ViewSpacing. |
eb87f1aedd6c
Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents:
2898
diff
changeset
|
524 |
formLabel label:aFormOrImage. |
eb87f1aedd6c
Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents:
2898
diff
changeset
|
525 |
textLabel origin:((mm + formLabel width + mm) @ mm). |
2476 | 526 |
! |
527 |
||
2328 | 528 |
textLabel |
529 |
"return the label-view which displays a message string" |
|
530 |
||
531 |
^ textLabel |
|
532 |
! |
|
533 |
||
0 | 534 |
title:aString |
16 | 535 |
"set the boxes title" |
0 | 536 |
|
16 | 537 |
aString ~= textLabel label ifTrue:[ |
59 | 538 |
textLabel label:aString withoutSeparators. |
110 | 539 |
textLabel forceResize. |
97 | 540 |
shown ifTrue:[self resize] |
16 | 541 |
] |
0 | 542 |
! |
543 |
||
97 | 544 |
title:aString numberOfOptions:nOptions |
545 |
"set the boxes title and number of options" |
|
546 |
||
547 |
self title:aString. |
|
548 |
buttons grow:nOptions. |
|
549 |
actions grow:nOptions |
|
197 | 550 |
! ! |
97 | 551 |
|
197 | 552 |
!OptionBox methodsFor:'events'! |
77 | 553 |
|
197 | 554 |
keyPress:aKey x:x y:y |
2700 | 555 |
"return-key duplicates ok-function if acceptReturnAsOK is true" |
77 | 556 |
|
4490 | 557 |
"/ <resource: #keyboard (#Return)> |
490 | 558 |
|
3804
8a4b07e9ee4e
no need to care for RETURN-keyPress; its already done by the keyboard processor
Claus Gittinger <cg@exept.de>
parents:
3757
diff
changeset
|
559 |
"/ now done by keyboard processor |
8a4b07e9ee4e
no need to care for RETURN-keyPress; its already done by the keyboard processor
Claus Gittinger <cg@exept.de>
parents:
3757
diff
changeset
|
560 |
"/ |action| |
8a4b07e9ee4e
no need to care for RETURN-keyPress; its already done by the keyboard processor
Claus Gittinger <cg@exept.de>
parents:
3757
diff
changeset
|
561 |
"/ |
8a4b07e9ee4e
no need to care for RETURN-keyPress; its already done by the keyboard processor
Claus Gittinger <cg@exept.de>
parents:
3757
diff
changeset
|
562 |
"/ defaultButtonIndex notNil ifTrue:[ |
8a4b07e9ee4e
no need to care for RETURN-keyPress; its already done by the keyboard processor
Claus Gittinger <cg@exept.de>
parents:
3757
diff
changeset
|
563 |
"/ (aKey == #Return) ifTrue:[ |
8a4b07e9ee4e
no need to care for RETURN-keyPress; its already done by the keyboard processor
Claus Gittinger <cg@exept.de>
parents:
3757
diff
changeset
|
564 |
"/ self hide. |
8a4b07e9ee4e
no need to care for RETURN-keyPress; its already done by the keyboard processor
Claus Gittinger <cg@exept.de>
parents:
3757
diff
changeset
|
565 |
"/ action := actions at:defaultButtonIndex. |
8a4b07e9ee4e
no need to care for RETURN-keyPress; its already done by the keyboard processor
Claus Gittinger <cg@exept.de>
parents:
3757
diff
changeset
|
566 |
"/ action value |
8a4b07e9ee4e
no need to care for RETURN-keyPress; its already done by the keyboard processor
Claus Gittinger <cg@exept.de>
parents:
3757
diff
changeset
|
567 |
"/ ] |
8a4b07e9ee4e
no need to care for RETURN-keyPress; its already done by the keyboard processor
Claus Gittinger <cg@exept.de>
parents:
3757
diff
changeset
|
568 |
"/ ]. |
197 | 569 |
super keyPress:aKey x:x y:y |
490 | 570 |
|
571 |
"Modified: 7.3.1996 / 13:17:36 / cg" |
|
197 | 572 |
! ! |
0 | 573 |
|
2523 | 574 |
!OptionBox methodsFor:'initialization'! |
7 | 575 |
|
197 | 576 |
initFormBitmap |
6235 | 577 |
self initYesNoBitmap |
578 |
||
579 |
"Modified: / 28-11-2017 / 14:33:16 / cg" |
|
580 |
! |
|
581 |
||
582 |
initInfoBitmap |
|
583 |
InfoBitmap isNil ifTrue:[ |
|
584 |
InfoBitmap := InfoBox iconBitmap. |
|
585 |
]. |
|
586 |
formLabel label:InfoBitmap |
|
587 |
||
588 |
"Created: / 28-11-2017 / 14:31:51 / cg" |
|
589 |
! |
|
590 |
||
591 |
initWarnBitmap |
|
197 | 592 |
WarnBitmap isNil ifTrue:[ |
1914 | 593 |
WarnBitmap := WarningBox iconBitmap. |
5893 | 594 |
"/ WarnBitmap := Image fromFile:'bitmaps/Warning.xbm' resolution:100 on:Display |
0 | 595 |
]. |
2969
eb87f1aedd6c
Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents:
2898
diff
changeset
|
596 |
formLabel label:WarnBitmap |
899 | 597 |
|
6235 | 598 |
"Created: / 28-11-2017 / 14:31:31 / cg" |
599 |
! |
|
600 |
||
601 |
initYesNoBitmap |
|
602 |
YesNoBitmap isNil ifTrue:[ |
|
603 |
YesNoBitmap := YesNoBox iconBitmap. |
|
604 |
]. |
|
605 |
formLabel label:YesNoBitmap |
|
606 |
||
607 |
"Created: / 28-11-2017 / 14:32:45 / cg" |
|
0 | 608 |
! |
609 |
||
610 |
initialize |
|
4383 | 611 |
|mm vPanelLayout| |
0 | 612 |
|
613 |
super initialize. |
|
614 |
||
372 | 615 |
mm := ViewSpacing. |
616 |
||
3208
7b4c5a215af9
use panels, to allow for hooks to add more widgets.
Claus Gittinger <cg@exept.de>
parents:
3201
diff
changeset
|
617 |
verticalPanel := VerticalPanelView in:self. |
7b4c5a215af9
use panels, to allow for hooks to add more widgets.
Claus Gittinger <cg@exept.de>
parents:
3201
diff
changeset
|
618 |
vPanelLayout := LayoutFrame origin:(mm @ mm) corner:(1.0@1.0). |
4903 | 619 |
vPanelLayout bottomOffset:(gc font height + (mm * 5)) negated. |
3208
7b4c5a215af9
use panels, to allow for hooks to add more widgets.
Claus Gittinger <cg@exept.de>
parents:
3201
diff
changeset
|
620 |
vPanelLayout rightOffset:mm negated. |
7b4c5a215af9
use panels, to allow for hooks to add more widgets.
Claus Gittinger <cg@exept.de>
parents:
3201
diff
changeset
|
621 |
verticalPanel geometryLayout:vPanelLayout. |
7b4c5a215af9
use panels, to allow for hooks to add more widgets.
Claus Gittinger <cg@exept.de>
parents:
3201
diff
changeset
|
622 |
verticalPanel horizontalLayout:#fit. |
7b4c5a215af9
use panels, to allow for hooks to add more widgets.
Claus Gittinger <cg@exept.de>
parents:
3201
diff
changeset
|
623 |
verticalPanel verticalLayout:#bottomFit. |
7b4c5a215af9
use panels, to allow for hooks to add more widgets.
Claus Gittinger <cg@exept.de>
parents:
3201
diff
changeset
|
624 |
|
7b4c5a215af9
use panels, to allow for hooks to add more widgets.
Claus Gittinger <cg@exept.de>
parents:
3201
diff
changeset
|
625 |
labelPanel := HorizontalPanelView in:verticalPanel. |
7b4c5a215af9
use panels, to allow for hooks to add more widgets.
Claus Gittinger <cg@exept.de>
parents:
3201
diff
changeset
|
626 |
labelPanel horizontalLayout:#leftSpace. |
7b4c5a215af9
use panels, to allow for hooks to add more widgets.
Claus Gittinger <cg@exept.de>
parents:
3201
diff
changeset
|
627 |
labelPanel verticalLayout:#topSpace. |
3613
0a1963025199
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3260
diff
changeset
|
628 |
labelPanel height:(labelPanel preferredHeight + (mm * 4)). |
3208
7b4c5a215af9
use panels, to allow for hooks to add more widgets.
Claus Gittinger <cg@exept.de>
parents:
3201
diff
changeset
|
629 |
|
7b4c5a215af9
use panels, to allow for hooks to add more widgets.
Claus Gittinger <cg@exept.de>
parents:
3201
diff
changeset
|
630 |
formLabel := Label in:labelPanel. |
38 | 631 |
self initFormBitmap. |
0 | 632 |
formLabel borderWidth:0. |
3208
7b4c5a215af9
use panels, to allow for hooks to add more widgets.
Claus Gittinger <cg@exept.de>
parents:
3201
diff
changeset
|
633 |
"/ formLabel origin:(mm @ mm). |
0 | 634 |
|
3208
7b4c5a215af9
use panels, to allow for hooks to add more widgets.
Claus Gittinger <cg@exept.de>
parents:
3201
diff
changeset
|
635 |
textLabel := Label label:'Select' in:labelPanel. |
0 | 636 |
textLabel borderWidth:0. |
3208
7b4c5a215af9
use panels, to allow for hooks to add more widgets.
Claus Gittinger <cg@exept.de>
parents:
3201
diff
changeset
|
637 |
"/ textLabel origin:((mm + formLabel width + mm) @ mm). |
7b4c5a215af9
use panels, to allow for hooks to add more widgets.
Claus Gittinger <cg@exept.de>
parents:
3201
diff
changeset
|
638 |
|
7b4c5a215af9
use panels, to allow for hooks to add more widgets.
Claus Gittinger <cg@exept.de>
parents:
3201
diff
changeset
|
639 |
verticalPanel resize. |
4383 | 640 |
"/ cannot be done here - verticalPanel still has its defaul height and may be |
641 |
"/ not yet filled... |
|
642 |
"/ yPosition := verticalPanel height + (mm * 3). |
|
0 | 643 |
|
1612
e7d3bc88a533
oops - two buttonPanels where created (MD's fix).
Claus Gittinger <cg@exept.de>
parents:
953
diff
changeset
|
644 |
"/ buttonPanel isNil ifTrue:[ |
e7d3bc88a533
oops - two buttonPanels where created (MD's fix).
Claus Gittinger <cg@exept.de>
parents:
953
diff
changeset
|
645 |
"/ buttonPanel := HorizontalPanelView origin:(0.0 @ 1.0) corner:(1.0 @ 1.0) in:self. |
e7d3bc88a533
oops - two buttonPanels where created (MD's fix).
Claus Gittinger <cg@exept.de>
parents:
953
diff
changeset
|
646 |
"/ ]. |
5893 | 647 |
buttonPanel |
3208
7b4c5a215af9
use panels, to allow for hooks to add more widgets.
Claus Gittinger <cg@exept.de>
parents:
3201
diff
changeset
|
648 |
bottomInset:0 "mm"; |
5916 | 649 |
topInset:(gc font height + (mm * 4) + ViewSpacing + ViewSpacing) negated. |
5893 | 650 |
buttonPanel |
651 |
borderWidth:0; |
|
372 | 652 |
horizontalLayout:#fitSpace. |
59 | 653 |
|
4383 | 654 |
1 to:(buttons size) do:[:index | |
372 | 655 |
|button| |
7 | 656 |
|
372 | 657 |
button := Button label:'press'. |
658 |
button action:[ |
|
659 |
(buttons at:index) turnOffWithoutRedraw. |
|
660 |
self hide. |
|
3804
8a4b07e9ee4e
no need to care for RETURN-keyPress; its already done by the keyboard processor
Claus Gittinger <cg@exept.de>
parents:
3757
diff
changeset
|
661 |
(actions at:index) value |
372 | 662 |
]. |
133 | 663 |
"/ index == nButt ifTrue:[ |
664 |
"/ button isReturnButton:true |
|
665 |
"/ ]. |
|
372 | 666 |
buttonPanel addSubView:button. |
667 |
buttons at:index put:button. |
|
91 | 668 |
]. |
669 |
||
670 |
" |
|
671 |
|box| |
|
672 |
||
673 |
box := OptionBox title:'hello' numberOfOptions:4. |
|
674 |
box open |
|
675 |
" |
|
372 | 676 |
|
4383 | 677 |
"Modified: / 28-02-2012 / 15:56:57 / cg" |
133 | 678 |
! ! |
679 |
||
63 | 680 |
!OptionBox methodsFor:'queries'! |
0 | 681 |
|
5893 | 682 |
preferredExtent |
59 | 683 |
"return a size to make everything fit into myself" |
684 |
||
3208
7b4c5a215af9
use panels, to allow for hooks to add more widgets.
Claus Gittinger <cg@exept.de>
parents:
3201
diff
changeset
|
685 |
|w w1 h buttonPanelsPref vPanelsPref mm| |
0 | 686 |
|
3757
551f24a728dc
changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents:
3743
diff
changeset
|
687 |
"/ If I have an explicit preferredExtent.. |
551f24a728dc
changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents:
3743
diff
changeset
|
688 |
explicitExtent notNil ifTrue:[ |
551f24a728dc
changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents:
3743
diff
changeset
|
689 |
^ explicitExtent |
551f24a728dc
changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents:
3743
diff
changeset
|
690 |
]. |
799 | 691 |
|
3757
551f24a728dc
changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents:
3743
diff
changeset
|
692 |
"/ If I have a cached preferredExtent value.. |
713
0c38ad51016d
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
693 |
preferredExtent notNil ifTrue:[ |
0c38ad51016d
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
694 |
^ preferredExtent |
0c38ad51016d
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
695 |
]. |
0c38ad51016d
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
696 |
|
371 | 697 |
mm := ViewSpacing. |
698 |
||
3208
7b4c5a215af9
use panels, to allow for hooks to add more widgets.
Claus Gittinger <cg@exept.de>
parents:
3201
diff
changeset
|
699 |
vPanelsPref := verticalPanel preferredExtent. |
371 | 700 |
w1 := (mm * 3) + formLabel width + textLabel width. |
3208
7b4c5a215af9
use panels, to allow for hooks to add more widgets.
Claus Gittinger <cg@exept.de>
parents:
3201
diff
changeset
|
701 |
buttonPanelsPref := buttonPanel preferredExtent. |
7b4c5a215af9
use panels, to allow for hooks to add more widgets.
Claus Gittinger <cg@exept.de>
parents:
3201
diff
changeset
|
702 |
w := w1 max:buttonPanelsPref x. |
7b4c5a215af9
use panels, to allow for hooks to add more widgets.
Claus Gittinger <cg@exept.de>
parents:
3201
diff
changeset
|
703 |
w := w max:vPanelsPref x. |
38 | 704 |
|
3208
7b4c5a215af9
use panels, to allow for hooks to add more widgets.
Claus Gittinger <cg@exept.de>
parents:
3201
diff
changeset
|
705 |
h := mm |
7b4c5a215af9
use panels, to allow for hooks to add more widgets.
Claus Gittinger <cg@exept.de>
parents:
3201
diff
changeset
|
706 |
+ vPanelsPref y |
7b4c5a215af9
use panels, to allow for hooks to add more widgets.
Claus Gittinger <cg@exept.de>
parents:
3201
diff
changeset
|
707 |
+ mm |
7b4c5a215af9
use panels, to allow for hooks to add more widgets.
Claus Gittinger <cg@exept.de>
parents:
3201
diff
changeset
|
708 |
+ buttonPanelsPref y |
7b4c5a215af9
use panels, to allow for hooks to add more widgets.
Claus Gittinger <cg@exept.de>
parents:
3201
diff
changeset
|
709 |
+ mm. |
0 | 710 |
|
3905
9005cad02a02
preferredExtent computation (care for additional components)
Claus Gittinger <cg@exept.de>
parents:
3804
diff
changeset
|
711 |
self subViews do:[:v | |
9005cad02a02
preferredExtent computation (care for additional components)
Claus Gittinger <cg@exept.de>
parents:
3804
diff
changeset
|
712 |
(v ~~ verticalPanel and:[v ~~ buttonPanel]) ifTrue:[ |
9005cad02a02
preferredExtent computation (care for additional components)
Claus Gittinger <cg@exept.de>
parents:
3804
diff
changeset
|
713 |
h := h + v preferredExtent y. |
9005cad02a02
preferredExtent computation (care for additional components)
Claus Gittinger <cg@exept.de>
parents:
3804
diff
changeset
|
714 |
w := w max:(v preferredExtent x). |
9005cad02a02
preferredExtent computation (care for additional components)
Claus Gittinger <cg@exept.de>
parents:
3804
diff
changeset
|
715 |
]. |
9005cad02a02
preferredExtent computation (care for additional components)
Claus Gittinger <cg@exept.de>
parents:
3804
diff
changeset
|
716 |
]. |
9005cad02a02
preferredExtent computation (care for additional components)
Claus Gittinger <cg@exept.de>
parents:
3804
diff
changeset
|
717 |
|
9005cad02a02
preferredExtent computation (care for additional components)
Claus Gittinger <cg@exept.de>
parents:
3804
diff
changeset
|
718 |
preferredExtent := super preferredExtent max:(w @ h). |
9005cad02a02
preferredExtent computation (care for additional components)
Claus Gittinger <cg@exept.de>
parents:
3804
diff
changeset
|
719 |
^ preferredExtent |
371 | 720 |
|
799 | 721 |
"Modified: 19.7.1996 / 20:45:11 / cg" |
0 | 722 |
! ! |
197 | 723 |
|
847 | 724 |
!OptionBox class methodsFor:'documentation'! |
243 | 725 |
|
726 |
version |
|
5893 | 727 |
^ '$Header$' |
4223 | 728 |
! |
729 |
||
730 |
version_CVS |
|
5893 | 731 |
^ '$Header$' |
243 | 732 |
! ! |
4490 | 733 |