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