author | Jan Vrany <jan.vrany@fit.cvut.cz> |
Fri, 26 Jan 2018 11:43:24 +0000 | |
branch | jv |
changeset 6279 | 232954e959f7 |
parent 5916 | d00575627127 |
child 6196 | 2ce864a88bb4 |
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' |
355 | 18 |
classVariableNames:'WarnBitmap' |
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 |
2711
e18e9edca978
by default, return nil if cancelled
Claus Gittinger <cg@exept.de>
parents:
2700
diff
changeset
|
183 |
the corresponding values collection. Return nil if cancelled" |
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" |
|
2668 | 199 |
! |
200 |
||
2669 | 201 |
request:title buttonLabels:labels values:values default:defaultValue |
202 |
"create a new optionBox, open it modal and return the value of |
|
2711
e18e9edca978
by default, return nil if cancelled
Claus Gittinger <cg@exept.de>
parents:
2700
diff
changeset
|
203 |
the corresponding values collection. Return nil if cancelled." |
2669 | 204 |
|
205 |
^ self |
|
5893 | 206 |
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
|
207 |
default:defaultValue onCancel:nil |
2669 | 208 |
|
209 |
" |
|
5893 | 210 |
OptionBox |
2669 | 211 |
request:'please select' |
212 |
buttonLabels:#('one' 'two' 'three') |
|
5893 | 213 |
values:#(1 2 3) |
214 |
default:3 |
|
2669 | 215 |
" |
216 |
! |
|
217 |
||
5893 | 218 |
request:title label:label buttonLabels:labels values:values |
2405 | 219 |
"create a new optionBox, open it modal and return the value of |
2711
e18e9edca978
by default, return nil if cancelled
Claus Gittinger <cg@exept.de>
parents:
2700
diff
changeset
|
220 |
the corresponding values collection. Return nil if cancelled" |
2405 | 221 |
|
5893 | 222 |
^ self |
223 |
request:title |
|
224 |
label:label |
|
4224 | 225 |
image:(YesNoBox iconBitmap) |
5893 | 226 |
buttonLabels:labels |
227 |
values:values |
|
228 |
default:nil |
|
4224 | 229 |
onCancel:nil |
2668 | 230 |
|
231 |
" |
|
5893 | 232 |
OptionBox |
2668 | 233 |
request:'please select' |
234 |
label:'select any' |
|
235 |
buttonLabels:#('one' 'two' 'three') |
|
5893 | 236 |
values:#(1 2 3) |
2668 | 237 |
" |
4224 | 238 |
|
239 |
"Modified: / 08-02-2011 / 11:32:48 / cg" |
|
2405 | 240 |
! |
241 |
||
242 |
request:title label:label buttonLabels:labels values:values default:defaultValue |
|
243 |
"create a new optionBox, open it modal and return the value of |
|
2711
e18e9edca978
by default, return nil if cancelled
Claus Gittinger <cg@exept.de>
parents:
2700
diff
changeset
|
244 |
the corresponding values collection. Return nil if cancelled" |
2405 | 245 |
|
246 |
^ self |
|
5893 | 247 |
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
|
248 |
default:defaultValue onCancel:nil |
2668 | 249 |
|
250 |
" |
|
5893 | 251 |
OptionBox |
2668 | 252 |
request:'please select' |
253 |
label:'select any' |
|
254 |
buttonLabels:#('one' 'two' 'three') |
|
5893 | 255 |
values:#(1 2 3) |
256 |
default:3 |
|
2668 | 257 |
" |
2405 | 258 |
! |
259 |
||
260 |
request:title label:label buttonLabels:labels values:values default:defaultValue onCancel:cancelValue |
|
261 |
"create a new optionBox, open it modal and return the value of |
|
2711
e18e9edca978
by default, return nil if cancelled
Claus Gittinger <cg@exept.de>
parents:
2700
diff
changeset
|
262 |
the corresponding values collection. Return cancelValue if cancelled." |
2405 | 263 |
|
264 |
^ self |
|
5893 | 265 |
request:title label:label image:(YesNoBox iconBitmap) buttonLabels:labels values:values |
2405 | 266 |
default:defaultValue onCancel:cancelValue |
2668 | 267 |
|
268 |
" |
|
5893 | 269 |
OptionBox |
2668 | 270 |
request:'please select' |
271 |
label:'select any' |
|
272 |
buttonLabels:#('one' 'two' 'three') |
|
5893 | 273 |
values:#(1 2 3) |
274 |
default:3 |
|
275 |
onCancel:2 |
|
2668 | 276 |
" |
2405 | 277 |
! |
278 |
||
5893 | 279 |
request:title label:label image:anImage buttonLabels:labels values:values |
133 | 280 |
"create a new optionBox, open it modal and return the value of |
2711
e18e9edca978
by default, return nil if cancelled
Claus Gittinger <cg@exept.de>
parents:
2700
diff
changeset
|
281 |
the corresponding values collection. Return nil, if cancelled." |
133 | 282 |
|
5893 | 283 |
^ self |
284 |
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
|
285 |
default:nil onCancel:nil |
2668 | 286 |
|
287 |
" |
|
5893 | 288 |
OptionBox |
2668 | 289 |
request:'please select' |
290 |
label:'select any' |
|
2969
eb87f1aedd6c
Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents:
2898
diff
changeset
|
291 |
image:(WarningBox iconBitmap) |
2668 | 292 |
buttonLabels:#('one' 'two' 'three') |
293 |
values:#(1 2 3) |
|
294 |
" |
|
133 | 295 |
! |
296 |
||
2969
eb87f1aedd6c
Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents:
2898
diff
changeset
|
297 |
request:title label:label image:anImage buttonLabels:labels values:values default:defaultValue |
95 | 298 |
"create a new optionBox, open it modal and return the value of |
2711
e18e9edca978
by default, return nil if cancelled
Claus Gittinger <cg@exept.de>
parents:
2700
diff
changeset
|
299 |
the corresponding values collection. Return nil if cancelled." |
95 | 300 |
|
2390 | 301 |
^ self |
5893 | 302 |
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
|
303 |
default:defaultValue onCancel:nil |
2668 | 304 |
|
305 |
" |
|
5893 | 306 |
OptionBox |
2668 | 307 |
request:'please select' |
308 |
label:'select any' |
|
2969
eb87f1aedd6c
Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents:
2898
diff
changeset
|
309 |
image:(WarningBox iconBitmap) |
2668 | 310 |
buttonLabels:#('one' 'two' 'three') |
311 |
values:#(1 2 3) |
|
312 |
default:3 |
|
313 |
" |
|
2390 | 314 |
! |
315 |
||
2969
eb87f1aedd6c
Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents:
2898
diff
changeset
|
316 |
request:title label:label image:anImage buttonLabels:labels values:values default:defaultValue onCancel:cancelValue |
2390 | 317 |
"create a new optionBox, open it modal and return the value of |
2711
e18e9edca978
by default, return nil if cancelled
Claus Gittinger <cg@exept.de>
parents:
2700
diff
changeset
|
318 |
the corresponding values collection. Return cancelValue if cancelled." |
2390 | 319 |
|
2162 | 320 |
|box retVal| |
95 | 321 |
|
2390 | 322 |
retVal := cancelValue. |
2585 | 323 |
box := self |
5893 | 324 |
forRequest:title |
325 |
label:label |
|
326 |
image:anImage |
|
327 |
buttonLabels:labels |
|
328 |
values:values |
|
2585 | 329 |
default:defaultValue. |
330 |
||
2162 | 331 |
box action:[:n | retVal := values at:n]. |
3211 | 332 |
self showAndThenDestroyBox:box. |
2389 | 333 |
|
2162 | 334 |
^ retVal |
95 | 335 |
|
336 |
" |
|
5893 | 337 |
OptionBox |
2668 | 338 |
request:'please select' |
339 |
label:'select any' |
|
2969
eb87f1aedd6c
Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents:
2898
diff
changeset
|
340 |
image:(WarningBox iconBitmap) |
2668 | 341 |
buttonLabels:#('one' 'two' 'three') |
342 |
values:#(1 2 3) |
|
343 |
default:3 |
|
344 |
onCancel:nil |
|
95 | 345 |
" |
920 | 346 |
|
2162 | 347 |
"Modified: / 23.2.2000 / 11:59:32 / cg" |
95 | 348 |
! ! |
349 |
||
2969
eb87f1aedd6c
Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents:
2898
diff
changeset
|
350 |
!OptionBox class methodsFor:'obsolete'! |
eb87f1aedd6c
Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents:
2898
diff
changeset
|
351 |
|
eb87f1aedd6c
Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents:
2898
diff
changeset
|
352 |
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
|
353 |
"create a new optionBox and return it. |
eb87f1aedd6c
Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents:
2898
diff
changeset
|
354 |
Does not open the box." |
eb87f1aedd6c
Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents:
2898
diff
changeset
|
355 |
|
eb87f1aedd6c
Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents:
2898
diff
changeset
|
356 |
<resource:#obsolete> |
eb87f1aedd6c
Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents:
2898
diff
changeset
|
357 |
|
eb87f1aedd6c
Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents:
2898
diff
changeset
|
358 |
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
|
359 |
! |
eb87f1aedd6c
Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents:
2898
diff
changeset
|
360 |
|
5893 | 361 |
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
|
362 |
"create a new optionBox, open it modal and return the value of |
eb87f1aedd6c
Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents:
2898
diff
changeset
|
363 |
the corresponding values collection. Return nil, if cancelled." |
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 |
<resource:#obsolete> |
eb87f1aedd6c
Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents:
2898
diff
changeset
|
366 |
|
5893 | 367 |
^ self |
368 |
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
|
369 |
default:nil onCancel:nil |
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 |
|
eb87f1aedd6c
Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents:
2898
diff
changeset
|
372 |
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
|
373 |
"create a new optionBox, open it modal and return the value of |
eb87f1aedd6c
Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents:
2898
diff
changeset
|
374 |
the corresponding values collection. Return nil if cancelled." |
eb87f1aedd6c
Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents:
2898
diff
changeset
|
375 |
|
eb87f1aedd6c
Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents:
2898
diff
changeset
|
376 |
<resource:#obsolete> |
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 |
^ self |
5893 | 379 |
request:title |
380 |
label:label |
|
381 |
image:aForm |
|
382 |
buttonLabels:labels |
|
383 |
values:values |
|
384 |
default:defaultValue |
|
2991 | 385 |
onCancel:nil |
2969
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 |
|
eb87f1aedd6c
Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents:
2898
diff
changeset
|
388 |
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
|
389 |
"create a new optionBox, open it modal and return the value of |
eb87f1aedd6c
Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents:
2898
diff
changeset
|
390 |
the corresponding values collection. Return cancelValue if cancelled." |
eb87f1aedd6c
Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents:
2898
diff
changeset
|
391 |
|
eb87f1aedd6c
Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents:
2898
diff
changeset
|
392 |
<resource:#obsolete> |
eb87f1aedd6c
Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents:
2898
diff
changeset
|
393 |
|
eb87f1aedd6c
Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents:
2898
diff
changeset
|
394 |
^ self request:title label:label image: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
|
395 |
! ! |
eb87f1aedd6c
Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents:
2898
diff
changeset
|
396 |
|
197 | 397 |
!OptionBox methodsFor:'accessing'! |
398 |
||
399 |
action:actionBlock |
|
400 |
"define a single the action for all buttons. |
|
401 |
The action will be evaluated with the button index as argument." |
|
402 |
||
403 |
buttons keysAndValuesDo:[:index :button | |
|
404 |
button action:[ |
|
405 |
button turnOffWithoutRedraw. |
|
406 |
self hide. |
|
407 |
actionBlock value:index |
|
408 |
] |
|
409 |
]. |
|
410 |
! |
|
411 |
||
412 |
actions:actionBlocks |
|
413 |
"define the actions" |
|
0 | 414 |
|
197 | 415 |
actions := actionBlocks |
416 |
! |
|
417 |
||
418 |
buttonTitles:titles actions:actionBlocks |
|
419 |
"define both button titles and actions" |
|
420 |
||
421 |
self buttonTitles:titles. |
|
422 |
actions := actionBlocks. |
|
423 |
! |
|
0 | 424 |
|
197 | 425 |
defaultButtonIndex:index |
847 | 426 |
"define which button is the default (i.e. return-) button. |
427 |
By default, no returnButton is setup. The argument must be an |
|
428 |
index 1..nButtons, or nil" |
|
429 |
||
197 | 430 |
defaultButtonIndex notNil ifTrue:[ |
847 | 431 |
(buttons at:defaultButtonIndex) isReturnButton:false |
197 | 432 |
]. |
433 |
(index notNil and:[index ~~ 0]) ifTrue:[ |
|
847 | 434 |
defaultButtonIndex := index. |
435 |
defaultButtonIndex notNil ifTrue:[ |
|
5893 | 436 |
(buttons at:defaultButtonIndex) isReturnButton:true |
847 | 437 |
]. |
197 | 438 |
] |
847 | 439 |
|
440 |
"Modified: 18.10.1996 / 14:53:36 / cg" |
|
197 | 441 |
! |
442 |
||
443 |
numberOfOptions |
|
444 |
"return the number of options" |
|
445 |
||
446 |
^ buttons size |
|
447 |
! |
|
448 |
||
449 |
numberOfOptions:nOptions |
|
847 | 450 |
"set the number of options - this is a private interface" |
197 | 451 |
|
5109 | 452 |
buttons := OrderedCollection newWithSize:nOptions. |
453 |
actions := OrderedCollection newWithSize:nOptions |
|
847 | 454 |
|
455 |
"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
|
456 |
! ! |
2d5cb01c7e11
no need for focusSequence - DialogBox does it
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
457 |
|
3208
7b4c5a215af9
use panels, to allow for hooks to add more widgets.
Claus Gittinger <cg@exept.de>
parents:
3201
diff
changeset
|
458 |
!OptionBox methodsFor:'accessing-components'! |
7b4c5a215af9
use panels, to allow for hooks to add more widgets.
Claus Gittinger <cg@exept.de>
parents:
3201
diff
changeset
|
459 |
|
7b4c5a215af9
use panels, to allow for hooks to add more widgets.
Claus Gittinger <cg@exept.de>
parents:
3201
diff
changeset
|
460 |
buttons |
7b4c5a215af9
use panels, to allow for hooks to add more widgets.
Claus Gittinger <cg@exept.de>
parents:
3201
diff
changeset
|
461 |
"return the buttons collection" |
7b4c5a215af9
use panels, to allow for hooks to add more widgets.
Claus Gittinger <cg@exept.de>
parents:
3201
diff
changeset
|
462 |
|
7b4c5a215af9
use panels, to allow for hooks to add more widgets.
Claus Gittinger <cg@exept.de>
parents:
3201
diff
changeset
|
463 |
^ buttons |
7b4c5a215af9
use panels, to allow for hooks to add more widgets.
Claus Gittinger <cg@exept.de>
parents:
3201
diff
changeset
|
464 |
! |
7b4c5a215af9
use panels, to allow for hooks to add more widgets.
Claus Gittinger <cg@exept.de>
parents:
3201
diff
changeset
|
465 |
|
7b4c5a215af9
use panels, to allow for hooks to add more widgets.
Claus Gittinger <cg@exept.de>
parents:
3201
diff
changeset
|
466 |
labelPanel |
7b4c5a215af9
use panels, to allow for hooks to add more widgets.
Claus Gittinger <cg@exept.de>
parents:
3201
diff
changeset
|
467 |
^ labelPanel |
7b4c5a215af9
use panels, to allow for hooks to add more widgets.
Claus Gittinger <cg@exept.de>
parents:
3201
diff
changeset
|
468 |
! ! |
7b4c5a215af9
use panels, to allow for hooks to add more widgets.
Claus Gittinger <cg@exept.de>
parents:
3201
diff
changeset
|
469 |
|
2227 | 470 |
!OptionBox methodsFor:'accessing-look'! |
740
2d5cb01c7e11
no need for focusSequence - DialogBox does it
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
471 |
|
2d5cb01c7e11
no need for focusSequence - DialogBox does it
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
472 |
buttonTitles:titles |
2d5cb01c7e11
no need for focusSequence - DialogBox does it
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
473 |
"set the button titles" |
2d5cb01c7e11
no need for focusSequence - DialogBox does it
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
474 |
|
2d5cb01c7e11
no need for focusSequence - DialogBox does it
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
475 |
titles keysAndValuesDo:[:index :aString | |
3733 | 476 |
|b| |
740
2d5cb01c7e11
no need for focusSequence - DialogBox does it
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
477 |
|
3733 | 478 |
(b := buttons at:index) label:aString. |
479 |
b name: (b name? ''), index printString. |
|
480 |
b resize. |
|
740
2d5cb01c7e11
no need for focusSequence - DialogBox does it
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
481 |
]. |
2d5cb01c7e11
no need for focusSequence - DialogBox does it
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
482 |
shown ifTrue:[self resize] |
2d5cb01c7e11
no need for focusSequence - DialogBox does it
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
483 |
! |
2d5cb01c7e11
no need for focusSequence - DialogBox does it
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
484 |
|
2d5cb01c7e11
no need for focusSequence - DialogBox does it
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
485 |
form:aFormOrImage |
2969
eb87f1aedd6c
Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents:
2898
diff
changeset
|
486 |
"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
|
487 |
|
2969
eb87f1aedd6c
Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents:
2898
diff
changeset
|
488 |
<resource:#obsolete> |
2212
7475e8be57bb
recompute label origin, if the form changes
Claus Gittinger <cg@exept.de>
parents:
2162
diff
changeset
|
489 |
|
2969
eb87f1aedd6c
Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents:
2898
diff
changeset
|
490 |
self image:aFormOrImage |
740
2d5cb01c7e11
no need for focusSequence - DialogBox does it
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
491 |
! |
2d5cb01c7e11
no need for focusSequence - DialogBox does it
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
492 |
|
2d5cb01c7e11
no need for focusSequence - DialogBox does it
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
493 |
formLabel |
2d5cb01c7e11
no need for focusSequence - DialogBox does it
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
494 |
"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
|
495 |
|
2d5cb01c7e11
no need for focusSequence - DialogBox does it
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
496 |
^ formLabel |
197 | 497 |
! |
0 | 498 |
|
2476 | 499 |
image:aFormOrImage |
500 |
"set the image shown in the label-view" |
|
501 |
||
2969
eb87f1aedd6c
Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents:
2898
diff
changeset
|
502 |
|mm| |
2476 | 503 |
|
2969
eb87f1aedd6c
Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents:
2898
diff
changeset
|
504 |
mm := ViewSpacing. |
eb87f1aedd6c
Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents:
2898
diff
changeset
|
505 |
formLabel label:aFormOrImage. |
eb87f1aedd6c
Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents:
2898
diff
changeset
|
506 |
textLabel origin:((mm + formLabel width + mm) @ mm). |
2476 | 507 |
! |
508 |
||
2328 | 509 |
textLabel |
510 |
"return the label-view which displays a message string" |
|
511 |
||
512 |
^ textLabel |
|
513 |
! |
|
514 |
||
0 | 515 |
title:aString |
16 | 516 |
"set the boxes title" |
0 | 517 |
|
16 | 518 |
aString ~= textLabel label ifTrue:[ |
59 | 519 |
textLabel label:aString withoutSeparators. |
110 | 520 |
textLabel forceResize. |
97 | 521 |
shown ifTrue:[self resize] |
16 | 522 |
] |
0 | 523 |
! |
524 |
||
97 | 525 |
title:aString numberOfOptions:nOptions |
526 |
"set the boxes title and number of options" |
|
527 |
||
528 |
self title:aString. |
|
529 |
buttons grow:nOptions. |
|
530 |
actions grow:nOptions |
|
197 | 531 |
! ! |
97 | 532 |
|
197 | 533 |
!OptionBox methodsFor:'events'! |
77 | 534 |
|
197 | 535 |
keyPress:aKey x:x y:y |
2700 | 536 |
"return-key duplicates ok-function if acceptReturnAsOK is true" |
77 | 537 |
|
4490 | 538 |
"/ <resource: #keyboard (#Return)> |
490 | 539 |
|
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
|
540 |
"/ 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
|
541 |
"/ |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
|
542 |
"/ |
8a4b07e9ee4e
no need to care for RETURN-keyPress; its already done by the keyboard processor
Claus Gittinger <cg@exept.de>
parents:
3757
diff
changeset
|
543 |
"/ 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
|
544 |
"/ (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
|
545 |
"/ 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
|
546 |
"/ 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
|
547 |
"/ 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
|
548 |
"/ ] |
8a4b07e9ee4e
no need to care for RETURN-keyPress; its already done by the keyboard processor
Claus Gittinger <cg@exept.de>
parents:
3757
diff
changeset
|
549 |
"/ ]. |
197 | 550 |
super keyPress:aKey x:x y:y |
490 | 551 |
|
552 |
"Modified: 7.3.1996 / 13:17:36 / cg" |
|
197 | 553 |
! ! |
0 | 554 |
|
2523 | 555 |
!OptionBox methodsFor:'initialization'! |
7 | 556 |
|
197 | 557 |
initFormBitmap |
558 |
WarnBitmap isNil ifTrue:[ |
|
1914 | 559 |
WarnBitmap := WarningBox iconBitmap. |
5893 | 560 |
"/ WarnBitmap := Image fromFile:'bitmaps/Warning.xbm' resolution:100 on:Display |
0 | 561 |
]. |
2969
eb87f1aedd6c
Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents:
2898
diff
changeset
|
562 |
formLabel label:WarnBitmap |
899 | 563 |
|
1914 | 564 |
"Modified: / 25.5.1999 / 16:08:06 / cg" |
0 | 565 |
! |
566 |
||
567 |
initialize |
|
4383 | 568 |
|mm vPanelLayout| |
0 | 569 |
|
570 |
super initialize. |
|
571 |
||
372 | 572 |
mm := ViewSpacing. |
573 |
||
3208
7b4c5a215af9
use panels, to allow for hooks to add more widgets.
Claus Gittinger <cg@exept.de>
parents:
3201
diff
changeset
|
574 |
verticalPanel := VerticalPanelView in:self. |
7b4c5a215af9
use panels, to allow for hooks to add more widgets.
Claus Gittinger <cg@exept.de>
parents:
3201
diff
changeset
|
575 |
vPanelLayout := LayoutFrame origin:(mm @ mm) corner:(1.0@1.0). |
4903 | 576 |
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
|
577 |
vPanelLayout rightOffset:mm negated. |
7b4c5a215af9
use panels, to allow for hooks to add more widgets.
Claus Gittinger <cg@exept.de>
parents:
3201
diff
changeset
|
578 |
verticalPanel geometryLayout:vPanelLayout. |
7b4c5a215af9
use panels, to allow for hooks to add more widgets.
Claus Gittinger <cg@exept.de>
parents:
3201
diff
changeset
|
579 |
verticalPanel horizontalLayout:#fit. |
7b4c5a215af9
use panels, to allow for hooks to add more widgets.
Claus Gittinger <cg@exept.de>
parents:
3201
diff
changeset
|
580 |
verticalPanel verticalLayout:#bottomFit. |
7b4c5a215af9
use panels, to allow for hooks to add more widgets.
Claus Gittinger <cg@exept.de>
parents:
3201
diff
changeset
|
581 |
|
7b4c5a215af9
use panels, to allow for hooks to add more widgets.
Claus Gittinger <cg@exept.de>
parents:
3201
diff
changeset
|
582 |
labelPanel := HorizontalPanelView in:verticalPanel. |
7b4c5a215af9
use panels, to allow for hooks to add more widgets.
Claus Gittinger <cg@exept.de>
parents:
3201
diff
changeset
|
583 |
labelPanel horizontalLayout:#leftSpace. |
7b4c5a215af9
use panels, to allow for hooks to add more widgets.
Claus Gittinger <cg@exept.de>
parents:
3201
diff
changeset
|
584 |
labelPanel verticalLayout:#topSpace. |
3613
0a1963025199
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3260
diff
changeset
|
585 |
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
|
586 |
|
7b4c5a215af9
use panels, to allow for hooks to add more widgets.
Claus Gittinger <cg@exept.de>
parents:
3201
diff
changeset
|
587 |
formLabel := Label in:labelPanel. |
38 | 588 |
self initFormBitmap. |
0 | 589 |
formLabel borderWidth:0. |
3208
7b4c5a215af9
use panels, to allow for hooks to add more widgets.
Claus Gittinger <cg@exept.de>
parents:
3201
diff
changeset
|
590 |
"/ formLabel origin:(mm @ mm). |
0 | 591 |
|
3208
7b4c5a215af9
use panels, to allow for hooks to add more widgets.
Claus Gittinger <cg@exept.de>
parents:
3201
diff
changeset
|
592 |
textLabel := Label label:'Select' in:labelPanel. |
0 | 593 |
textLabel borderWidth:0. |
3208
7b4c5a215af9
use panels, to allow for hooks to add more widgets.
Claus Gittinger <cg@exept.de>
parents:
3201
diff
changeset
|
594 |
"/ 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
|
595 |
|
7b4c5a215af9
use panels, to allow for hooks to add more widgets.
Claus Gittinger <cg@exept.de>
parents:
3201
diff
changeset
|
596 |
verticalPanel resize. |
4383 | 597 |
"/ cannot be done here - verticalPanel still has its defaul height and may be |
598 |
"/ not yet filled... |
|
599 |
"/ yPosition := verticalPanel height + (mm * 3). |
|
0 | 600 |
|
1612
e7d3bc88a533
oops - two buttonPanels where created (MD's fix).
Claus Gittinger <cg@exept.de>
parents:
953
diff
changeset
|
601 |
"/ buttonPanel isNil ifTrue:[ |
e7d3bc88a533
oops - two buttonPanels where created (MD's fix).
Claus Gittinger <cg@exept.de>
parents:
953
diff
changeset
|
602 |
"/ 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
|
603 |
"/ ]. |
5893 | 604 |
buttonPanel |
3208
7b4c5a215af9
use panels, to allow for hooks to add more widgets.
Claus Gittinger <cg@exept.de>
parents:
3201
diff
changeset
|
605 |
bottomInset:0 "mm"; |
5916 | 606 |
topInset:(gc font height + (mm * 4) + ViewSpacing + ViewSpacing) negated. |
5893 | 607 |
buttonPanel |
608 |
borderWidth:0; |
|
372 | 609 |
horizontalLayout:#fitSpace. |
59 | 610 |
|
4383 | 611 |
1 to:(buttons size) do:[:index | |
372 | 612 |
|button| |
7 | 613 |
|
372 | 614 |
button := Button label:'press'. |
615 |
button action:[ |
|
616 |
(buttons at:index) turnOffWithoutRedraw. |
|
617 |
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
|
618 |
(actions at:index) value |
372 | 619 |
]. |
133 | 620 |
"/ index == nButt ifTrue:[ |
621 |
"/ button isReturnButton:true |
|
622 |
"/ ]. |
|
372 | 623 |
buttonPanel addSubView:button. |
624 |
buttons at:index put:button. |
|
91 | 625 |
]. |
626 |
||
627 |
" |
|
628 |
|box| |
|
629 |
||
630 |
box := OptionBox title:'hello' numberOfOptions:4. |
|
631 |
box open |
|
632 |
" |
|
372 | 633 |
|
4383 | 634 |
"Modified: / 28-02-2012 / 15:56:57 / cg" |
133 | 635 |
! ! |
636 |
||
63 | 637 |
!OptionBox methodsFor:'queries'! |
0 | 638 |
|
5893 | 639 |
preferredExtent |
59 | 640 |
"return a size to make everything fit into myself" |
641 |
||
3208
7b4c5a215af9
use panels, to allow for hooks to add more widgets.
Claus Gittinger <cg@exept.de>
parents:
3201
diff
changeset
|
642 |
|w w1 h buttonPanelsPref vPanelsPref mm| |
0 | 643 |
|
3757
551f24a728dc
changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents:
3743
diff
changeset
|
644 |
"/ If I have an explicit preferredExtent.. |
551f24a728dc
changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents:
3743
diff
changeset
|
645 |
explicitExtent notNil ifTrue:[ |
551f24a728dc
changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents:
3743
diff
changeset
|
646 |
^ explicitExtent |
551f24a728dc
changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents:
3743
diff
changeset
|
647 |
]. |
799 | 648 |
|
3757
551f24a728dc
changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents:
3743
diff
changeset
|
649 |
"/ If I have a cached preferredExtent value.. |
713
0c38ad51016d
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
650 |
preferredExtent notNil ifTrue:[ |
0c38ad51016d
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
651 |
^ preferredExtent |
0c38ad51016d
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
652 |
]. |
0c38ad51016d
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
653 |
|
371 | 654 |
mm := ViewSpacing. |
655 |
||
3208
7b4c5a215af9
use panels, to allow for hooks to add more widgets.
Claus Gittinger <cg@exept.de>
parents:
3201
diff
changeset
|
656 |
vPanelsPref := verticalPanel preferredExtent. |
371 | 657 |
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
|
658 |
buttonPanelsPref := buttonPanel preferredExtent. |
7b4c5a215af9
use panels, to allow for hooks to add more widgets.
Claus Gittinger <cg@exept.de>
parents:
3201
diff
changeset
|
659 |
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
|
660 |
w := w max:vPanelsPref x. |
38 | 661 |
|
3208
7b4c5a215af9
use panels, to allow for hooks to add more widgets.
Claus Gittinger <cg@exept.de>
parents:
3201
diff
changeset
|
662 |
h := mm |
7b4c5a215af9
use panels, to allow for hooks to add more widgets.
Claus Gittinger <cg@exept.de>
parents:
3201
diff
changeset
|
663 |
+ vPanelsPref y |
7b4c5a215af9
use panels, to allow for hooks to add more widgets.
Claus Gittinger <cg@exept.de>
parents:
3201
diff
changeset
|
664 |
+ mm |
7b4c5a215af9
use panels, to allow for hooks to add more widgets.
Claus Gittinger <cg@exept.de>
parents:
3201
diff
changeset
|
665 |
+ buttonPanelsPref y |
7b4c5a215af9
use panels, to allow for hooks to add more widgets.
Claus Gittinger <cg@exept.de>
parents:
3201
diff
changeset
|
666 |
+ mm. |
0 | 667 |
|
3905
9005cad02a02
preferredExtent computation (care for additional components)
Claus Gittinger <cg@exept.de>
parents:
3804
diff
changeset
|
668 |
self subViews do:[:v | |
9005cad02a02
preferredExtent computation (care for additional components)
Claus Gittinger <cg@exept.de>
parents:
3804
diff
changeset
|
669 |
(v ~~ verticalPanel and:[v ~~ buttonPanel]) ifTrue:[ |
9005cad02a02
preferredExtent computation (care for additional components)
Claus Gittinger <cg@exept.de>
parents:
3804
diff
changeset
|
670 |
h := h + v preferredExtent y. |
9005cad02a02
preferredExtent computation (care for additional components)
Claus Gittinger <cg@exept.de>
parents:
3804
diff
changeset
|
671 |
w := w max:(v preferredExtent x). |
9005cad02a02
preferredExtent computation (care for additional components)
Claus Gittinger <cg@exept.de>
parents:
3804
diff
changeset
|
672 |
]. |
9005cad02a02
preferredExtent computation (care for additional components)
Claus Gittinger <cg@exept.de>
parents:
3804
diff
changeset
|
673 |
]. |
9005cad02a02
preferredExtent computation (care for additional components)
Claus Gittinger <cg@exept.de>
parents:
3804
diff
changeset
|
674 |
|
9005cad02a02
preferredExtent computation (care for additional components)
Claus Gittinger <cg@exept.de>
parents:
3804
diff
changeset
|
675 |
preferredExtent := super preferredExtent max:(w @ h). |
9005cad02a02
preferredExtent computation (care for additional components)
Claus Gittinger <cg@exept.de>
parents:
3804
diff
changeset
|
676 |
^ preferredExtent |
371 | 677 |
|
799 | 678 |
"Modified: 19.7.1996 / 20:45:11 / cg" |
0 | 679 |
! ! |
197 | 680 |
|
847 | 681 |
!OptionBox class methodsFor:'documentation'! |
243 | 682 |
|
683 |
version |
|
5893 | 684 |
^ '$Header$' |
4223 | 685 |
! |
686 |
||
687 |
version_CVS |
|
5893 | 688 |
^ '$Header$' |
243 | 689 |
! ! |
4490 | 690 |