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