author | Claus Gittinger <cg@exept.de> |
Thu, 10 Aug 2000 00:18:02 +0200 | |
changeset 2208 | a37459b4dffa |
parent 2174 | 1245fc1a0654 |
child 2262 | 2d42623317f0 |
permissions | -rw-r--r-- |
20 | 1 |
" |
2 |
COPYRIGHT (c) 1994 by Claus Gittinger |
|
59 | 3 |
All Rights Reserved |
20 | 4 |
|
5 |
This software is furnished under a license and may be used |
|
6 |
only in accordance with the terms of that license and with the |
|
7 |
inclusion of the above copyright notice. This software may not |
|
8 |
be provided or otherwise made available to, or used by, any |
|
9 |
other person. No title to or ownership of the software is |
|
10 |
hereby transferred. |
|
11 |
" |
|
12 |
||
2172
411ac4dcf8b4
action invocation for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
13 |
"{ Package: 'stx:libwidg' }" |
411ac4dcf8b4
action invocation for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
14 |
|
20 | 15 |
Button subclass:#PopUpList |
1758 | 16 |
instanceVariableNames:'menu menuAction values useIndex listMsg defaultLabel listHolder |
17 |
showHandle' |
|
327
5cd2a6f4f28e
fixes to allow use of ListEntries (and an example)
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
18 |
classVariableNames:'' |
5cd2a6f4f28e
fixes to allow use of ListEntries (and an example)
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
19 |
poolDictionaries:'' |
5cd2a6f4f28e
fixes to allow use of ListEntries (and an example)
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
20 |
category:'Views-Interactors' |
20 | 21 |
! |
22 |
||
998 | 23 |
!PopUpList class methodsFor:'documentation'! |
38 | 24 |
|
25 |
copyright |
|
26 |
" |
|
27 |
COPYRIGHT (c) 1994 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 |
||
39 |
documentation |
|
40 |
" |
|
41 |
a PopUpList is basically a button with a popup menu. |
|
42 |
The PopUpLists label is showing the current selection from the |
|
43 |
list. |
|
121 | 44 |
When an entry is selected, an actionBlock (if nonNil) is evaluated |
45 |
and (if nonNil), the model is notified via the changeMessage. |
|
125 | 46 |
|
1052
59f182d1304f
added list- and selectionHolders
Claus Gittinger <cg@exept.de>
parents:
1035
diff
changeset
|
47 |
If no model is set, the list is assumed to be a static list, which |
59f182d1304f
added list- and selectionHolders
Claus Gittinger <cg@exept.de>
parents:
1035
diff
changeset
|
48 |
is defined via #list:, and the popUpList evaluates the action block, |
59f182d1304f
added list- and selectionHolders
Claus Gittinger <cg@exept.de>
parents:
1035
diff
changeset
|
49 |
as defined via #action:. |
59f182d1304f
added list- and selectionHolders
Claus Gittinger <cg@exept.de>
parents:
1035
diff
changeset
|
50 |
|
1065 | 51 |
If a model is provided, it should return the current selected items index via the |
52 |
aspectMessage (default is #selection or: #selectionIndex, depending on the setting |
|
53 |
of useIndex) and the list via the listMessage (default is #list). |
|
54 |
If the listMessage was set to nil, the list is not aquired from the model |
|
55 |
and can be set explicitely via #list:. |
|
1052
59f182d1304f
added list- and selectionHolders
Claus Gittinger <cg@exept.de>
parents:
1035
diff
changeset
|
56 |
|
1065 | 57 |
The defaults are set to allow a PopUpList to be used with a SelectionInList |
1063 | 58 |
as model without further setup. |
1077 | 59 |
A simple valueHolder may also be used without further setup. |
121 | 60 |
(if used with some other model, either use an adaptor, or set the |
1063 | 61 |
change/aspect and/or listMessage to something else ..) |
125 | 62 |
|
1065 | 63 |
If a listHolder is set, this one is always asked for the list instead of the |
64 |
model, via the #value message. |
|
65 |
This allows the popUpListView to aquire the list and value from different places. |
|
66 |
||
67 |
||
1070 | 68 |
Notice: PopUpList and ComboListView provide a similar protocol and functionality. |
69 |
||
1065 | 70 |
|
585 | 71 |
[Instance variables:] |
125 | 72 |
|
1063 | 73 |
menu helpers for the popup menu |
74 |
menuAction |
|
75 |
values |
|
1052
59f182d1304f
added list- and selectionHolders
Claus Gittinger <cg@exept.de>
parents:
1035
diff
changeset
|
76 |
|
1063 | 77 |
useIndex <Boolean> if true, the index of the selected entry |
78 |
is passed to the action block and the |
|
79 |
model in a change-message. |
|
80 |
If false (the default), the value is passed. |
|
81 |
Notice that the default changeMessage is |
|
82 |
#selection:, which is not ok to be used |
|
83 |
with useIndex:true and a selectionInList model. |
|
84 |
(set the changeMessage to #selectionIndex: then) |
|
125 | 85 |
|
1063 | 86 |
listMsg <Symbol> message to aquire a new list from the |
87 |
model. Default is #list. |
|
1052
59f182d1304f
added list- and selectionHolders
Claus Gittinger <cg@exept.de>
parents:
1035
diff
changeset
|
88 |
|
125 | 89 |
|
1063 | 90 |
listHolder <Object> if non-nil, this object is assumed to return the |
91 |
list via the listMsg (instead of the model). |
|
92 |
Default is nil. |
|
585 | 93 |
|
94 |
[see also:] |
|
1070 | 95 |
SelectionInList ValueHolder |
1063 | 96 |
SelectionInListView |
1070 | 97 |
ComboListView |
585 | 98 |
|
99 |
[author:] |
|
1063 | 100 |
Claus Gittinger |
63 | 101 |
" |
102 |
! |
|
38 | 103 |
|
63 | 104 |
examples |
105 |
" |
|
1063 | 106 |
non-MVC use: |
107 |
[exBegin] |
|
38 | 108 |
|p| |
109 |
p := PopUpList label:'healthy fruit'. |
|
119 | 110 |
p list:#('apples' 'bananas' 'grape' 'lemon' 'margaritas'). |
38 | 111 |
p open |
1063 | 112 |
[exEnd] |
38 | 113 |
|
114 |
||
115 |
with an initial selection: |
|
1063 | 116 |
[exBegin] |
38 | 117 |
|p| |
118 |
p := PopUpList label:'dummy'. |
|
119 | 119 |
p list:#('apples' 'bananas' 'grape' 'lemon' 'margaritas'). |
38 | 120 |
p selection:'apples'. |
121 |
p open |
|
1063 | 122 |
[exEnd] |
38 | 123 |
|
124 |
||
125 |
with separating lines: |
|
1063 | 126 |
[exBegin] |
38 | 127 |
|p| |
119 | 128 |
p := PopUpList label:'fruit'. |
129 |
p list:#('apples' 'bananas' 'grape' 'lemon' '-' 'margaritas'). |
|
38 | 130 |
p selection:'apples'. |
131 |
p open |
|
1063 | 132 |
[exEnd] |
77 | 133 |
|
134 |
||
1772 | 135 |
draw without menu-handle: |
136 |
[exBegin] |
|
137 |
|p| |
|
138 |
p := PopUpList label:'fruit'. |
|
139 |
p list:#('apples' 'bananas' 'grape' 'lemon' '-' 'margaritas'). |
|
140 |
p showHandle:false. |
|
141 |
p open |
|
142 |
[exEnd] |
|
143 |
||
144 |
||
77 | 145 |
with an action: |
1063 | 146 |
[exBegin] |
77 | 147 |
|p| |
148 |
p := PopUpList label:'dummy'. |
|
119 | 149 |
p list:#('apples' 'bananas' 'grape' 'lemon' '-' 'margaritas'). |
77 | 150 |
p selection:'apples'. |
655 | 151 |
p action:[:what | Transcript showCR:'you selected: ' , what]. |
77 | 152 |
p open |
1063 | 153 |
[exEnd] |
77 | 154 |
|
155 |
||
119 | 156 |
sometimes, you may like the index instead of the value: |
327
5cd2a6f4f28e
fixes to allow use of ListEntries (and an example)
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
157 |
(notice, that the separating line counts, so you have to take care ...) |
1063 | 158 |
[exBegin] |
119 | 159 |
|p| |
160 |
p := PopUpList label:'dummy'. |
|
161 |
p list:#('apples' 'bananas' 'grape' 'lemon' '-' 'margaritas'). |
|
162 |
p selection:'apples'. |
|
655 | 163 |
p action:[:what | Transcript show:'you selected: '; showCR:what]. |
119 | 164 |
p useIndex:true. |
165 |
p open |
|
1063 | 166 |
[exEnd] |
119 | 167 |
|
168 |
||
169 |
since the list is actually a popupMenu, you can add double-separators: |
|
1071 | 170 |
also, here values are different from the labels |
1063 | 171 |
[exBegin] |
119 | 172 |
|p| |
173 |
p := PopUpList label:'dummy'. |
|
174 |
p list:#('apples' 'bananas' 'grape' 'lemon' |
|
1063 | 175 |
'=' |
176 |
'margaritas' 'pina colada' |
|
177 |
'=' |
|
178 |
'smalltalk' 'c++' 'eiffel' 'java'). |
|
119 | 179 |
p values:#(apples bananas grape lemon |
1063 | 180 |
nil |
181 |
'mhmh - so good' 'makes headache' |
|
182 |
nil |
|
183 |
'great' 'another headache' 'not bad' 'neat'). |
|
327
5cd2a6f4f28e
fixes to allow use of ListEntries (and an example)
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
184 |
p selection:'apples'. |
655 | 185 |
p action:[:what | Transcript show:'you selected: '; showCR:what]. |
327
5cd2a6f4f28e
fixes to allow use of ListEntries (and an example)
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
186 |
p open |
1063 | 187 |
[exEnd] |
327
5cd2a6f4f28e
fixes to allow use of ListEntries (and an example)
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
188 |
|
5cd2a6f4f28e
fixes to allow use of ListEntries (and an example)
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
189 |
|
5cd2a6f4f28e
fixes to allow use of ListEntries (and an example)
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
190 |
since the list is actually represented by a menuView, |
5cd2a6f4f28e
fixes to allow use of ListEntries (and an example)
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
191 |
which itself is inheriting from listView, which itself can display |
5cd2a6f4f28e
fixes to allow use of ListEntries (and an example)
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
192 |
things different from strings, arbitrary lists can be constructed: |
1066
d324041c0aaf
examples and values-handling
Claus Gittinger <cg@exept.de>
parents:
1065
diff
changeset
|
193 |
(see ListEntry, LabelAndIcon and Text classes) |
1063 | 194 |
[exBegin] |
327
5cd2a6f4f28e
fixes to allow use of ListEntries (and an example)
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
195 |
|p l| |
5cd2a6f4f28e
fixes to allow use of ListEntries (and an example)
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
196 |
p := PopUpList label:'dummy'. |
5cd2a6f4f28e
fixes to allow use of ListEntries (and an example)
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
197 |
l := OrderedCollection new. |
1065 | 198 |
l add:(Text string:'apples' color:Color red). |
199 |
l add:(Text string:'bananas' color:Color red). |
|
200 |
l add:(Text string:'grape' color:Color red). |
|
201 |
l add:(Text string:'lemon' color:Color red). |
|
327
5cd2a6f4f28e
fixes to allow use of ListEntries (and an example)
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
202 |
l add:'='. |
1065 | 203 |
l add:(Text string:'margaritas' color:Color green darkened darkened). |
204 |
l add:(Text string:'pina colada' color:Color green darkened darkened). |
|
327
5cd2a6f4f28e
fixes to allow use of ListEntries (and an example)
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
205 |
l add:'='. |
1065 | 206 |
l add:(Text string:'smalltalk' color:Color blue). |
207 |
l add:(Text string:'c++' color:Color blue). |
|
208 |
l add:(Text string:'eiffel' color:Color blue). |
|
209 |
l add:(Text string:'java' color:Color blue). |
|
327
5cd2a6f4f28e
fixes to allow use of ListEntries (and an example)
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
210 |
p list:l. |
5cd2a6f4f28e
fixes to allow use of ListEntries (and an example)
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
211 |
p values:#(apples bananas grape lemon |
1063 | 212 |
nil |
213 |
'mhmh - so good' 'makes headache' |
|
214 |
nil |
|
215 |
'great' 'another headache' 'not bad' 'neat'). |
|
119 | 216 |
p selection:'apples'. |
655 | 217 |
p action:[:what | Transcript show:'you selected: '; showCR:what]. |
119 | 218 |
p open |
1063 | 219 |
[exEnd] |
119 | 220 |
|
221 |
||
77 | 222 |
with values different from the label strings: |
1063 | 223 |
[exBegin] |
77 | 224 |
|p| |
225 |
p := PopUpList label:'dummy'. |
|
119 | 226 |
p list:#('apples' 'bananas' 'grape' 'lemon' '-' 'margaritas'). |
77 | 227 |
p selection:'apples'. |
228 |
p values:#(10 20 30 40 nil 50). |
|
655 | 229 |
p action:[:what | Transcript show:'you selected: '; showCR:what]. |
77 | 230 |
p open |
1063 | 231 |
[exEnd] |
119 | 232 |
|
121 | 233 |
|
1069 | 234 |
with values different from the label strings: |
235 |
[exBegin] |
|
236 |
|p| |
|
237 |
||
238 |
p := PopUpList label:'language selection'. |
|
239 |
p list:( #( |
|
240 |
'usa' |
|
241 |
'uk' |
|
242 |
'france' |
|
243 |
'germany' |
|
244 |
'italy' |
|
245 |
) collect:[:country | |
|
246 |
LabelAndIcon |
|
247 |
icon:(Image fromFile:'bitmaps/xpmBitmaps/countries/' , country , '.xpm') |
|
248 |
string:country |
|
249 |
] |
|
250 |
). |
|
251 |
p values:#(us england france germany italy). |
|
252 |
||
253 |
p action:[:what | Transcript show:'you selected: '; showCR:what]. |
|
254 |
p open |
|
255 |
[exEnd] |
|
256 |
||
257 |
||
1064 | 258 |
with a model (see in the inspector, how the index-holders value changes) |
1063 | 259 |
the defaults are setup to allow a SelectionInList directly as model: |
260 |
[exBegin] |
|
119 | 261 |
|p model| |
262 |
||
263 |
model := SelectionInList with:#('apples' 'bananas' 'grape' 'lemon' 'margaritas'). |
|
264 |
||
265 |
p := PopUpList label:'healthy fruit'. |
|
266 |
p model:model. |
|
267 |
p open. |
|
1063 | 268 |
model inspect |
269 |
[exEnd] |
|
121 | 270 |
|
20 | 271 |
|
1071 | 272 |
model provides selection; list is explicit: |
273 |
must change the aspect, since the default setup is for a SelectionInList |
|
274 |
[exBegin] |
|
275 |
|model top b| |
|
276 |
||
277 |
model := 'foo' asValue. |
|
278 |
||
279 |
top := StandardSystemView new. |
|
280 |
top extent:(300 @ 200). |
|
281 |
||
282 |
b := PopUpList in:top. |
|
283 |
b origin:(0.0 @ 0.0) corner:(1.0 @ 0.0). |
|
284 |
b bottomInset:(b preferredExtent y negated). |
|
285 |
||
286 |
b list:#('hello' 'world' 'this' 'is' 'st/x'). |
|
287 |
b model:model; aspect:#value; change:#value:. |
|
288 |
||
289 |
top openModal. |
|
290 |
Transcript showCR:('comboBox''s value: ' , model value). |
|
291 |
[exEnd] |
|
292 |
||
293 |
||
125 | 294 |
a popupList and a SelectionInListView on the same model: |
1063 | 295 |
[exBegin] |
125 | 296 |
|p slv model| |
297 |
||
298 |
model := SelectionInList with:#('apples' 'bananas' 'grape' 'lemon' 'margaritas'). |
|
299 |
model selection:'apples'. |
|
300 |
||
301 |
p := PopUpList on:model. |
|
1064 | 302 |
p open. |
303 |
||
304 |
slv := SelectionInListView on:model. |
|
305 |
slv open. |
|
306 |
[exEnd] |
|
307 |
||
308 |
||
309 |
dynamically changing the list (click button(s) to change): |
|
310 |
[exBegin] |
|
311 |
|p slv model b| |
|
312 |
||
313 |
model := SelectionInList with:#('apples' 'bananas' 'grape' 'lemon' 'margaritas'). |
|
314 |
model selection:'apples'. |
|
315 |
||
316 |
p := PopUpList on:model. |
|
125 | 317 |
p open. |
318 |
||
319 |
slv := SelectionInListView on:model. |
|
320 |
slv open. |
|
321 |
||
1064 | 322 |
b := Button label:'long list' action:[model list:#('1' '2' '3' '4' '5' '6')]. |
323 |
b open. |
|
324 |
b := Button label:'short list' action:[model list:#('1' '2' '3')]. |
|
325 |
b open. |
|
326 |
||
1063 | 327 |
[exEnd] |
328 |
||
329 |
||
125 | 330 |
|
127 | 331 |
two PopUpLists on the same model, different aspects: |
1063 | 332 |
[exBegin] |
121 | 333 |
|top panel p model| |
20 | 334 |
|
121 | 335 |
model := Plug new. |
655 | 336 |
model respondTo:#eat: with:[:val | Transcript showCR:'eat: ' , val]. |
337 |
model respondTo:#drink: with:[:val | Transcript showCR:'drink: ' , val]. |
|
121 | 338 |
model respondTo:#meals with:[#(taco burrito enchilada)]. |
327
5cd2a6f4f28e
fixes to allow use of ListEntries (and an example)
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
339 |
model respondTo:#drinks with:[#(margarita water corona)]. |
20 | 340 |
|
121 | 341 |
top := StandardSystemView new. |
342 |
top extent:(100@100). |
|
343 |
panel := VerticalPanelView origin:0.0@0.0 corner:1.0@1.0 in:top. |
|
344 |
panel horizontalLayout:#fitSpace. |
|
77 | 345 |
|
121 | 346 |
p := PopUpList label:'meals'. |
126 | 347 |
p model:model; listMessage:#meals; aspect:nil; change:#eat:. |
121 | 348 |
panel add:p. |
119 | 349 |
|
121 | 350 |
p := PopUpList label:'drinks'. |
126 | 351 |
p model:model; listMessage:#drinks; aspect:nil; change:#drink:. |
121 | 352 |
panel add:p. |
77 | 353 |
|
121 | 354 |
top open |
1063 | 355 |
[exEnd] |
1052
59f182d1304f
added list- and selectionHolders
Claus Gittinger <cg@exept.de>
parents:
1035
diff
changeset
|
356 |
|
59f182d1304f
added list- and selectionHolders
Claus Gittinger <cg@exept.de>
parents:
1035
diff
changeset
|
357 |
|
59f182d1304f
added list- and selectionHolders
Claus Gittinger <cg@exept.de>
parents:
1035
diff
changeset
|
358 |
with separate list- and indexHolders: |
1063 | 359 |
[exBegin] |
1052
59f182d1304f
added list- and selectionHolders
Claus Gittinger <cg@exept.de>
parents:
1035
diff
changeset
|
360 |
|p selectionHolder listHolder| |
59f182d1304f
added list- and selectionHolders
Claus Gittinger <cg@exept.de>
parents:
1035
diff
changeset
|
361 |
|
59f182d1304f
added list- and selectionHolders
Claus Gittinger <cg@exept.de>
parents:
1035
diff
changeset
|
362 |
listHolder := #('apples' 'bananas' 'grape' 'lemon' 'margaritas') asValue. |
59f182d1304f
added list- and selectionHolders
Claus Gittinger <cg@exept.de>
parents:
1035
diff
changeset
|
363 |
selectionHolder := 'apples' asValue. |
59f182d1304f
added list- and selectionHolders
Claus Gittinger <cg@exept.de>
parents:
1035
diff
changeset
|
364 |
|
59f182d1304f
added list- and selectionHolders
Claus Gittinger <cg@exept.de>
parents:
1035
diff
changeset
|
365 |
p := PopUpList label:'healthy fruit'. |
59f182d1304f
added list- and selectionHolders
Claus Gittinger <cg@exept.de>
parents:
1035
diff
changeset
|
366 |
p listHolder:listHolder. |
1066
d324041c0aaf
examples and values-handling
Claus Gittinger <cg@exept.de>
parents:
1065
diff
changeset
|
367 |
p model:selectionHolder; aspect:#value; change:#value:. |
1052
59f182d1304f
added list- and selectionHolders
Claus Gittinger <cg@exept.de>
parents:
1035
diff
changeset
|
368 |
p open. |
59f182d1304f
added list- and selectionHolders
Claus Gittinger <cg@exept.de>
parents:
1035
diff
changeset
|
369 |
selectionHolder inspect |
1063 | 370 |
[exEnd] |
1052
59f182d1304f
added list- and selectionHolders
Claus Gittinger <cg@exept.de>
parents:
1035
diff
changeset
|
371 |
|
59f182d1304f
added list- and selectionHolders
Claus Gittinger <cg@exept.de>
parents:
1035
diff
changeset
|
372 |
same, using index: |
1063 | 373 |
[exBegin] |
1052
59f182d1304f
added list- and selectionHolders
Claus Gittinger <cg@exept.de>
parents:
1035
diff
changeset
|
374 |
|p selectionIndexHolder listHolder| |
59f182d1304f
added list- and selectionHolders
Claus Gittinger <cg@exept.de>
parents:
1035
diff
changeset
|
375 |
|
59f182d1304f
added list- and selectionHolders
Claus Gittinger <cg@exept.de>
parents:
1035
diff
changeset
|
376 |
listHolder := #('apples' 'bananas' 'grape' 'lemon' 'margaritas') asValue. |
59f182d1304f
added list- and selectionHolders
Claus Gittinger <cg@exept.de>
parents:
1035
diff
changeset
|
377 |
selectionIndexHolder := 3 asValue. |
59f182d1304f
added list- and selectionHolders
Claus Gittinger <cg@exept.de>
parents:
1035
diff
changeset
|
378 |
|
59f182d1304f
added list- and selectionHolders
Claus Gittinger <cg@exept.de>
parents:
1035
diff
changeset
|
379 |
p := PopUpList new. |
59f182d1304f
added list- and selectionHolders
Claus Gittinger <cg@exept.de>
parents:
1035
diff
changeset
|
380 |
p listHolder:listHolder. |
1066
d324041c0aaf
examples and values-handling
Claus Gittinger <cg@exept.de>
parents:
1065
diff
changeset
|
381 |
p model:selectionIndexHolder; aspect:#value; change:#value:. |
1052
59f182d1304f
added list- and selectionHolders
Claus Gittinger <cg@exept.de>
parents:
1035
diff
changeset
|
382 |
p useIndex:true. |
59f182d1304f
added list- and selectionHolders
Claus Gittinger <cg@exept.de>
parents:
1035
diff
changeset
|
383 |
p open. |
59f182d1304f
added list- and selectionHolders
Claus Gittinger <cg@exept.de>
parents:
1035
diff
changeset
|
384 |
selectionIndexHolder inspect |
1063 | 385 |
[exEnd] |
1052
59f182d1304f
added list- and selectionHolders
Claus Gittinger <cg@exept.de>
parents:
1035
diff
changeset
|
386 |
|
1066
d324041c0aaf
examples and values-handling
Claus Gittinger <cg@exept.de>
parents:
1065
diff
changeset
|
387 |
using different values: |
d324041c0aaf
examples and values-handling
Claus Gittinger <cg@exept.de>
parents:
1065
diff
changeset
|
388 |
[exBegin] |
d324041c0aaf
examples and values-handling
Claus Gittinger <cg@exept.de>
parents:
1065
diff
changeset
|
389 |
|p selectionHolder listHolder values| |
d324041c0aaf
examples and values-handling
Claus Gittinger <cg@exept.de>
parents:
1065
diff
changeset
|
390 |
|
d324041c0aaf
examples and values-handling
Claus Gittinger <cg@exept.de>
parents:
1065
diff
changeset
|
391 |
listHolder := #('apples' 'bananas' 'grape' 'lemon' 'margaritas') asValue. |
d324041c0aaf
examples and values-handling
Claus Gittinger <cg@exept.de>
parents:
1065
diff
changeset
|
392 |
values := #(apples bananas grape lemon alcohol). |
d324041c0aaf
examples and values-handling
Claus Gittinger <cg@exept.de>
parents:
1065
diff
changeset
|
393 |
|
d324041c0aaf
examples and values-handling
Claus Gittinger <cg@exept.de>
parents:
1065
diff
changeset
|
394 |
selectionHolder := #alcohol asValue. |
d324041c0aaf
examples and values-handling
Claus Gittinger <cg@exept.de>
parents:
1065
diff
changeset
|
395 |
|
d324041c0aaf
examples and values-handling
Claus Gittinger <cg@exept.de>
parents:
1065
diff
changeset
|
396 |
p := PopUpList label:'healthy fruit'. |
d324041c0aaf
examples and values-handling
Claus Gittinger <cg@exept.de>
parents:
1065
diff
changeset
|
397 |
p listHolder:listHolder. |
d324041c0aaf
examples and values-handling
Claus Gittinger <cg@exept.de>
parents:
1065
diff
changeset
|
398 |
p model:selectionHolder; aspect:#value; change:#value:. |
d324041c0aaf
examples and values-handling
Claus Gittinger <cg@exept.de>
parents:
1065
diff
changeset
|
399 |
p values:values. |
d324041c0aaf
examples and values-handling
Claus Gittinger <cg@exept.de>
parents:
1065
diff
changeset
|
400 |
p open. |
d324041c0aaf
examples and values-handling
Claus Gittinger <cg@exept.de>
parents:
1065
diff
changeset
|
401 |
selectionHolder inspect |
d324041c0aaf
examples and values-handling
Claus Gittinger <cg@exept.de>
parents:
1065
diff
changeset
|
402 |
[exEnd] |
d324041c0aaf
examples and values-handling
Claus Gittinger <cg@exept.de>
parents:
1065
diff
changeset
|
403 |
|
1052
59f182d1304f
added list- and selectionHolders
Claus Gittinger <cg@exept.de>
parents:
1035
diff
changeset
|
404 |
|
121 | 405 |
" |
20 | 406 |
! ! |
407 |
||
998 | 408 |
!PopUpList class methodsFor:'defaults'! |
125 | 409 |
|
410 |
defaultAspectMessage |
|
411 |
^ #selection |
|
412 |
! |
|
413 |
||
414 |
defaultChangeMessage |
|
415 |
^ #selection: |
|
205 | 416 |
! |
417 |
||
418 |
defaultListMessage |
|
419 |
^ #list |
|
420 |
! ! |
|
421 |
||
422 |
!PopUpList methodsFor:'accessing'! |
|
423 |
||
424 |
contents |
|
425 |
^ self label |
|
426 |
! |
|
427 |
||
428 |
contents:con |
|
429 |
^ self selection:con |
|
430 |
||
684 | 431 |
"Modified: 25.5.1996 / 14:20:57 / cg" |
205 | 432 |
! |
433 |
||
1035 | 434 |
defaultLabel:aString |
435 |
"set the defaultLabel, to be shown if nothing is selected" |
|
436 |
||
1368 | 437 |
defaultLabel := aString. |
438 |
shown ifFalse:[ |
|
439 |
super label:defaultLabel |
|
440 |
]. |
|
441 |
||
442 |
"Modified: / 29.10.1997 / 15:50:10 / cg" |
|
1035 | 443 |
! |
444 |
||
1086
76da3ddb3372
label: only affects the actual label, if there is no model.
Claus Gittinger <cg@exept.de>
parents:
1083
diff
changeset
|
445 |
label:aString |
76da3ddb3372
label: only affects the actual label, if there is no model.
Claus Gittinger <cg@exept.de>
parents:
1083
diff
changeset
|
446 |
self defaultLabel:aString. |
76da3ddb3372
label: only affects the actual label, if there is no model.
Claus Gittinger <cg@exept.de>
parents:
1083
diff
changeset
|
447 |
model isNil ifTrue:[ |
1368 | 448 |
super label:aString suppressResize:(self shown) |
1086
76da3ddb3372
label: only affects the actual label, if there is no model.
Claus Gittinger <cg@exept.de>
parents:
1083
diff
changeset
|
449 |
]. |
76da3ddb3372
label: only affects the actual label, if there is no model.
Claus Gittinger <cg@exept.de>
parents:
1083
diff
changeset
|
450 |
|
1368 | 451 |
"Created: / 1.3.1997 / 02:09:02 / cg" |
452 |
"Modified: / 29.10.1997 / 15:49:50 / cg" |
|
1086
76da3ddb3372
label: only affects the actual label, if there is no model.
Claus Gittinger <cg@exept.de>
parents:
1083
diff
changeset
|
453 |
! |
76da3ddb3372
label: only affects the actual label, if there is no model.
Claus Gittinger <cg@exept.de>
parents:
1083
diff
changeset
|
454 |
|
205 | 455 |
list |
456 |
"return the list - i.e. the values shown in the pop-up list" |
|
457 |
||
458 |
^ menu labels |
|
459 |
! |
|
460 |
||
461 |
list:aList |
|
462 |
"set the list - i.e. the values shown in the pop-up list" |
|
463 |
||
464 |
self createMenuFor:aList. |
|
465 |
realized ifTrue:[ |
|
466 |
self computeLabelSize |
|
467 |
] |
|
468 |
||
469 |
" |
|
470 |
|p| |
|
471 |
p := PopUpList label:'fruit ?'. |
|
472 |
p list:#('apples' 'bananas' 'grape' 'lemon' 'margaritas'). |
|
655 | 473 |
p action:[:val | Transcript showCR:'selected: ' , val printString]. |
205 | 474 |
p open |
475 |
" |
|
476 |
! |
|
477 |
||
478 |
selection:indexOrString |
|
479 |
"set (force) a selection - usually done to set |
|
480 |
an initial selection without updating others" |
|
481 |
||
1839
75f77fcf458b
fix: defaultLabel with nil-selection and not useIndex.
Claus Gittinger <cg@exept.de>
parents:
1772
diff
changeset
|
482 |
|index menuLabels newLabel| |
205 | 483 |
|
1052
59f182d1304f
added list- and selectionHolders
Claus Gittinger <cg@exept.de>
parents:
1035
diff
changeset
|
484 |
menu isNil ifTrue:[ |
1066
d324041c0aaf
examples and values-handling
Claus Gittinger <cg@exept.de>
parents:
1065
diff
changeset
|
485 |
self getListFromModel. |
1052
59f182d1304f
added list- and selectionHolders
Claus Gittinger <cg@exept.de>
parents:
1035
diff
changeset
|
486 |
]. |
59f182d1304f
added list- and selectionHolders
Claus Gittinger <cg@exept.de>
parents:
1035
diff
changeset
|
487 |
menu isNil ifTrue:[^ self]. |
1368 | 488 |
menuLabels := menu labels. |
1052
59f182d1304f
added list- and selectionHolders
Claus Gittinger <cg@exept.de>
parents:
1035
diff
changeset
|
489 |
|
1066
d324041c0aaf
examples and values-handling
Claus Gittinger <cg@exept.de>
parents:
1065
diff
changeset
|
490 |
(useIndex not and:[values notNil]) ifTrue:[ |
d324041c0aaf
examples and values-handling
Claus Gittinger <cg@exept.de>
parents:
1065
diff
changeset
|
491 |
index := values indexOf:indexOrString |
d324041c0aaf
examples and values-handling
Claus Gittinger <cg@exept.de>
parents:
1065
diff
changeset
|
492 |
] ifFalse:[ |
1237 | 493 |
indexOrString isNumber ifTrue:[ |
494 |
index := indexOrString |
|
495 |
] ifFalse:[ |
|
1368 | 496 |
index := menuLabels indexOf:indexOrString. |
1237 | 497 |
]. |
1079 | 498 |
"/ fails if list consists of symbols ... |
499 |
"/ index := menu indexOf:indexOrString. |
|
1066
d324041c0aaf
examples and values-handling
Claus Gittinger <cg@exept.de>
parents:
1065
diff
changeset
|
500 |
]. |
1368 | 501 |
index > menuLabels size ifTrue:[ |
502 |
index := 0 |
|
503 |
]. |
|
504 |
||
1035 | 505 |
index == 0 ifTrue:[ |
1839
75f77fcf458b
fix: defaultLabel with nil-selection and not useIndex.
Claus Gittinger <cg@exept.de>
parents:
1772
diff
changeset
|
506 |
newLabel := defaultLabel |
75f77fcf458b
fix: defaultLabel with nil-selection and not useIndex.
Claus Gittinger <cg@exept.de>
parents:
1772
diff
changeset
|
507 |
] ifFalse:[ |
75f77fcf458b
fix: defaultLabel with nil-selection and not useIndex.
Claus Gittinger <cg@exept.de>
parents:
1772
diff
changeset
|
508 |
newLabel := (menuLabels at:index) printString |
1035 | 509 |
]. |
205 | 510 |
|
511 |
"kludge: dont want label to resize ..." |
|
1839
75f77fcf458b
fix: defaultLabel with nil-selection and not useIndex.
Claus Gittinger <cg@exept.de>
parents:
1772
diff
changeset
|
512 |
self label:newLabel suppressResize:true. |
205 | 513 |
|
514 |
" |
|
515 |
|p| |
|
516 |
p := PopUpList label:'what fruit ?'. |
|
517 |
p list:#('apples' 'bananas' 'grape' 'lemon' 'margaritas'). |
|
518 |
p selection:'grape'. |
|
519 |
p open |
|
520 |
||
521 |
|p| |
|
522 |
p := PopUpList label:'what fruit ?'. |
|
523 |
p list:#('apples' 'bananas' 'grape' 'lemon' 'margaritas'). |
|
524 |
p selection:'blabla'. |
|
525 |
p open |
|
1066
d324041c0aaf
examples and values-handling
Claus Gittinger <cg@exept.de>
parents:
1065
diff
changeset
|
526 |
|
d324041c0aaf
examples and values-handling
Claus Gittinger <cg@exept.de>
parents:
1065
diff
changeset
|
527 |
|p| |
d324041c0aaf
examples and values-handling
Claus Gittinger <cg@exept.de>
parents:
1065
diff
changeset
|
528 |
p := PopUpList label:'what fruit ?'. |
d324041c0aaf
examples and values-handling
Claus Gittinger <cg@exept.de>
parents:
1065
diff
changeset
|
529 |
p list:#('apples' 'bananas' 'grape' 'lemon' 'margaritas'). |
d324041c0aaf
examples and values-handling
Claus Gittinger <cg@exept.de>
parents:
1065
diff
changeset
|
530 |
p defaultLabel:'nothing selected'. |
d324041c0aaf
examples and values-handling
Claus Gittinger <cg@exept.de>
parents:
1065
diff
changeset
|
531 |
p selection:'blabla'. |
d324041c0aaf
examples and values-handling
Claus Gittinger <cg@exept.de>
parents:
1065
diff
changeset
|
532 |
p open |
205 | 533 |
" |
327
5cd2a6f4f28e
fixes to allow use of ListEntries (and an example)
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
534 |
|
1368 | 535 |
"Modified: / 29.10.1997 / 15:50:12 / cg" |
205 | 536 |
! |
537 |
||
593 | 538 |
values:aList |
539 |
"set a value list - these are reported via the action or changeSymbol instead of |
|
1052
59f182d1304f
added list- and selectionHolders
Claus Gittinger <cg@exept.de>
parents:
1035
diff
changeset
|
540 |
the label strings." |
593 | 541 |
|
542 |
values := aList. |
|
543 |
||
544 |
" |
|
545 |
|p| |
|
546 |
p := PopUpList label:'fruit ?'. |
|
547 |
p list:#('apples' 'bananas' 'grape' 'lemon' 'margaritas'). |
|
548 |
p values:#(1 2 3 4 'mhmh - good'). |
|
655 | 549 |
p action:[:val | Transcript showCR:'selected: ' , val printString]. |
593 | 550 |
p open. |
551 |
" |
|
1066
d324041c0aaf
examples and values-handling
Claus Gittinger <cg@exept.de>
parents:
1065
diff
changeset
|
552 |
|
d324041c0aaf
examples and values-handling
Claus Gittinger <cg@exept.de>
parents:
1065
diff
changeset
|
553 |
"Modified: 27.2.1997 / 10:24:12 / cg" |
593 | 554 |
! ! |
555 |
||
556 |
!PopUpList methodsFor:'accessing-behavior'! |
|
557 |
||
558 |
action:aOneArgBlock |
|
559 |
"set the action to be performed on selection changes; |
|
560 |
the argument, aOneArgBlock will be evaluated with the |
|
561 |
selection-value as argument" |
|
562 |
||
563 |
menuAction := aOneArgBlock |
|
564 |
! |
|
565 |
||
1098 | 566 |
menu:aMenu default:label |
567 |
menu := aMenu. |
|
568 |
defaultLabel := label |
|
569 |
! |
|
570 |
||
1311 | 571 |
useIndex |
572 |
"tell the popuplist to pass the index (instead of the value) |
|
573 |
to both the actionBlock and model. Notice, that if you use a model, |
|
574 |
the default changeSelector is not ok for using index and a SelectionInList" |
|
575 |
||
576 |
^ useIndex |
|
577 |
! |
|
578 |
||
205 | 579 |
useIndex:aBoolean |
580 |
"tell the popuplist to pass the index (instead of the value) |
|
581 |
to both the actionBlock and model. Notice, that if you use a model, |
|
582 |
the default changeSelector is not ok for using index and a SelectionInList" |
|
583 |
||
584 |
useIndex := aBoolean |
|
585 |
||
586 |
" |
|
587 |
|p| |
|
588 |
p := PopUpList label:'fruit ?'. |
|
589 |
p list:#('apples' 'bananas' 'grape' 'lemon' 'margaritas'). |
|
655 | 590 |
p action:[:val | Transcript showCR:'selected: ' , val printString]. |
205 | 591 |
p open. |
592 |
" |
|
593 |
" |
|
594 |
|p| |
|
595 |
p := PopUpList label:'fruit ?'. |
|
596 |
p list:#('apples' 'bananas' 'grape' 'lemon' 'margaritas'). |
|
655 | 597 |
p action:[:val | Transcript showCR:'selected: ' , val printString]. |
205 | 598 |
p useIndex:true. |
599 |
p open. |
|
600 |
" |
|
125 | 601 |
! ! |
602 |
||
1921 | 603 |
!PopUpList methodsFor:'accessing-look'! |
604 |
||
605 |
showHandle |
|
606 |
"return true if the pull-handle is to be drawn; default is true" |
|
607 |
||
608 |
^ showHandle |
|
609 |
||
610 |
"Created: / 6.3.1999 / 21:26:40 / cg" |
|
611 |
! |
|
612 |
||
613 |
showHandle:aBoolean |
|
614 |
"controls if the pull-handle is to be drawn; default is true" |
|
615 |
||
616 |
showHandle := aBoolean. |
|
617 |
self computeLabelSize |
|
618 |
||
619 |
"Modified: / 6.3.1999 / 21:58:21 / cg" |
|
620 |
! ! |
|
621 |
||
205 | 622 |
!PopUpList methodsFor:'accessing-mvc'! |
623 |
||
624 |
addModelInterfaceTo:aDictionary |
|
625 |
"see comment in View>>modelInterface" |
|
626 |
||
627 |
super addModelInterfaceTo:aDictionary. |
|
628 |
aDictionary at:#listMessage put:listMsg |
|
1063 | 629 |
|
630 |
"Modified: 26.2.1997 / 19:08:04 / cg" |
|
205 | 631 |
! |
632 |
||
1063 | 633 |
listHolder |
634 |
"return the listHolder if any" |
|
635 |
||
636 |
^ listHolder |
|
637 |
! |
|
638 |
||
639 |
listHolder:aValueHolder |
|
640 |
"set the listHolder - if non nil, that one is assumed to provide the |
|
641 |
list via #value. |
|
642 |
If a listHolder was defined, the model is never asked for the list." |
|
643 |
||
644 |
listHolder notNil ifTrue:[ |
|
645 |
listHolder removeDependent:self. |
|
646 |
]. |
|
647 |
listHolder := aValueHolder. |
|
648 |
listHolder notNil ifTrue:[ |
|
649 |
listHolder addDependent:self. |
|
650 |
]. |
|
651 |
shown ifTrue:[ |
|
652 |
self getListFromModel |
|
653 |
] |
|
654 |
||
655 |
"Modified: 26.2.1997 / 19:06:01 / cg" |
|
205 | 656 |
! |
657 |
||
658 |
listMessage |
|
1063 | 659 |
"return the selector by which we ask the model or listHolder for the list. |
660 |
The default is #list. |
|
661 |
If a listHolder was defined, the model is never asked for the list." |
|
205 | 662 |
|
663 |
^ listMsg |
|
1063 | 664 |
|
665 |
"Modified: 26.2.1997 / 19:05:27 / cg" |
|
205 | 666 |
! |
667 |
||
668 |
listMessage:aSelector |
|
669 |
"set the selector by which we ask the model for the list. |
|
1063 | 670 |
The default is #list. |
671 |
If a listHolder was defined, the model is never asked for the list." |
|
205 | 672 |
|
673 |
listMsg := aSelector |
|
1063 | 674 |
|
675 |
"Modified: 26.2.1997 / 19:05:18 / cg" |
|
1083
13e64cc1c493
fetch models value when a model is assigned;
Claus Gittinger <cg@exept.de>
parents:
1079
diff
changeset
|
676 |
! |
13e64cc1c493
fetch models value when a model is assigned;
Claus Gittinger <cg@exept.de>
parents:
1079
diff
changeset
|
677 |
|
13e64cc1c493
fetch models value when a model is assigned;
Claus Gittinger <cg@exept.de>
parents:
1079
diff
changeset
|
678 |
model:aModel |
13e64cc1c493
fetch models value when a model is assigned;
Claus Gittinger <cg@exept.de>
parents:
1079
diff
changeset
|
679 |
super model:aModel. |
13e64cc1c493
fetch models value when a model is assigned;
Claus Gittinger <cg@exept.de>
parents:
1079
diff
changeset
|
680 |
self getListFromModel. |
13e64cc1c493
fetch models value when a model is assigned;
Claus Gittinger <cg@exept.de>
parents:
1079
diff
changeset
|
681 |
self getSelectionFromModel. |
13e64cc1c493
fetch models value when a model is assigned;
Claus Gittinger <cg@exept.de>
parents:
1079
diff
changeset
|
682 |
|
13e64cc1c493
fetch models value when a model is assigned;
Claus Gittinger <cg@exept.de>
parents:
1079
diff
changeset
|
683 |
"Created: 28.2.1997 / 19:12:08 / cg" |
205 | 684 |
! ! |
685 |
||
686 |
!PopUpList methodsFor:'change & update'! |
|
687 |
||
688 |
update:something with:aParameter from:changedObject |
|
1052
59f182d1304f
added list- and selectionHolders
Claus Gittinger <cg@exept.de>
parents:
1035
diff
changeset
|
689 |
changedObject == listHolder ifTrue:[ |
1063 | 690 |
self getListFromModel. |
691 |
^ self |
|
1052
59f182d1304f
added list- and selectionHolders
Claus Gittinger <cg@exept.de>
parents:
1035
diff
changeset
|
692 |
]. |
205 | 693 |
changedObject == model ifTrue:[ |
1078 | 694 |
aspectMsg notNil ifTrue:[ |
1063 | 695 |
self getSelectionFromModel. |
696 |
]. |
|
1586
e4e6e12cbd1f
ST-80 compatibility changes.
Claus Gittinger <cg@exept.de>
parents:
1492
diff
changeset
|
697 |
listHolder notNil ifTrue:[ |
e4e6e12cbd1f
ST-80 compatibility changes.
Claus Gittinger <cg@exept.de>
parents:
1492
diff
changeset
|
698 |
"/ that one holds the list; |
e4e6e12cbd1f
ST-80 compatibility changes.
Claus Gittinger <cg@exept.de>
parents:
1492
diff
changeset
|
699 |
"/ model holds the value |
e4e6e12cbd1f
ST-80 compatibility changes.
Claus Gittinger <cg@exept.de>
parents:
1492
diff
changeset
|
700 |
self getSelectionFromModel |
e4e6e12cbd1f
ST-80 compatibility changes.
Claus Gittinger <cg@exept.de>
parents:
1492
diff
changeset
|
701 |
] ifFalse:[ |
e4e6e12cbd1f
ST-80 compatibility changes.
Claus Gittinger <cg@exept.de>
parents:
1492
diff
changeset
|
702 |
listMsg notNil ifTrue:[ |
e4e6e12cbd1f
ST-80 compatibility changes.
Claus Gittinger <cg@exept.de>
parents:
1492
diff
changeset
|
703 |
self getListFromModel. |
e4e6e12cbd1f
ST-80 compatibility changes.
Claus Gittinger <cg@exept.de>
parents:
1492
diff
changeset
|
704 |
] |
1063 | 705 |
]. |
706 |
^ self |
|
205 | 707 |
]. |
708 |
super update:something with:aParameter from:changedObject |
|
1063 | 709 |
|
1586
e4e6e12cbd1f
ST-80 compatibility changes.
Claus Gittinger <cg@exept.de>
parents:
1492
diff
changeset
|
710 |
"Modified: / 18.6.1998 / 23:48:47 / cg" |
205 | 711 |
! ! |
712 |
||
713 |
!PopUpList methodsFor:'drawing'! |
|
714 |
||
715 |
drawWith:fgColor and:bgColor |
|
716 |
|mmH mmV mW mH| |
|
136 | 717 |
|
205 | 718 |
controller pressed ifTrue:[ |
1758 | 719 |
super drawWith:enteredFgColor and:enteredBgColor |
205 | 720 |
] ifFalse:[ |
1758 | 721 |
super drawWith:fgColor and:bgColor. |
205 | 722 |
]. |
723 |
||
1758 | 724 |
showHandle ifTrue:[ |
1772 | 725 |
mmH := device horizontalPixelPerMillimeter. |
726 |
mmV := device verticalPixelPerMillimeter. |
|
727 |
mW := (mmH * 2.5) rounded. |
|
728 |
mH := (mmV * 1.5) rounded. |
|
1758 | 729 |
|
1772 | 730 |
self drawEdgesForX:(width - mW - (hSpace*2)) y:(height - mmV rounded |
731 |
// 2) |
|
1758 | 732 |
width:mW height:mH level:2 |
733 |
]. |
|
1772 | 734 |
|
735 |
"Modified: / 6.3.1999 / 21:56:13 / cg" |
|
205 | 736 |
! |
737 |
||
738 |
showActive |
|
739 |
"no need to redraw - will pop menu ontop of me anyway ..." |
|
740 |
||
741 |
^ self |
|
742 |
! |
|
743 |
||
744 |
showPassive |
|
745 |
"no need to redraw - will redraw from unpopped menu anyway ..." |
|
746 |
||
747 |
^ self |
|
748 |
! ! |
|
749 |
||
750 |
!PopUpList methodsFor:'event handling'! |
|
751 |
||
1492 | 752 |
keyPress:key x:x y:y |
753 |
(key == Character space |
|
754 |
or:[key == #Return])ifTrue:[ |
|
755 |
self popMenu. |
|
756 |
^ self |
|
757 |
]. |
|
758 |
super keyPress:key x:x y:y |
|
759 |
||
760 |
"Created: / 21.4.1998 / 20:05:19 / cg" |
|
761 |
! |
|
762 |
||
205 | 763 |
popMenu |
1586
e4e6e12cbd1f
ST-80 compatibility changes.
Claus Gittinger <cg@exept.de>
parents:
1492
diff
changeset
|
764 |
|org mv w theMenu val| |
205 | 765 |
|
766 |
menu notNil ifTrue:[ |
|
1098 | 767 |
theMenu := menu value |
768 |
]. |
|
769 |
||
770 |
theMenu notNil ifTrue:[ |
|
771 |
self turnOffWithoutRedraw. |
|
1035 | 772 |
|
1098 | 773 |
theMenu value labels size == 0 ifTrue:[ |
774 |
^ self |
|
775 |
]. |
|
1035 | 776 |
|
1098 | 777 |
theMenu isView ifTrue:[ |
778 |
"/ oldStyle - theMenu is a PopUpMenu |
|
779 |
theMenu font:font. |
|
136 | 780 |
|
1098 | 781 |
" |
782 |
adjust the menus width to my current width |
|
783 |
" |
|
784 |
mv := theMenu menuView. |
|
785 |
mv create. "/ stupid: it resizes itself upon first create |
|
786 |
w := mv width. "/ to its preferred size. |
|
787 |
w := w max:(self width - (2 * theMenu margin) - (theMenu borderWidth*2)). |
|
788 |
mv width:w. |
|
789 |
mv level:0; borderWidth:0. |
|
205 | 790 |
|
1098 | 791 |
" |
792 |
the popupMenu wants Display coordinates in its showAt: method |
|
793 |
" |
|
794 |
org := device translatePoint:0@0 |
|
795 |
from:(self id) |
|
796 |
to:(device rootView id). |
|
205 | 797 |
|
1098 | 798 |
theMenu showAt:org "resizing:false" |
799 |
] ifFalse:[ |
|
800 |
"/ newStyle - theMenu is a Menu |
|
2174 | 801 |
val := theMenu startUpOrNil. |
1586
e4e6e12cbd1f
ST-80 compatibility changes.
Claus Gittinger <cg@exept.de>
parents:
1492
diff
changeset
|
802 |
(theMenu isKindOf:PopUpMenu) ifFalse:[ |
e4e6e12cbd1f
ST-80 compatibility changes.
Claus Gittinger <cg@exept.de>
parents:
1492
diff
changeset
|
803 |
"/ sigh - brand new ... |
2174 | 804 |
val notNil ifTrue:[ |
805 |
self sendChangeMessage:changeMsg with:val. |
|
806 |
menuAction notNil ifTrue:[ |
|
807 |
menuAction value:val |
|
808 |
] |
|
2172
411ac4dcf8b4
action invocation for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
809 |
]. |
1586
e4e6e12cbd1f
ST-80 compatibility changes.
Claus Gittinger <cg@exept.de>
parents:
1492
diff
changeset
|
810 |
]. |
1098 | 811 |
] |
205 | 812 |
]. |
1586
e4e6e12cbd1f
ST-80 compatibility changes.
Claus Gittinger <cg@exept.de>
parents:
1492
diff
changeset
|
813 |
|
e4e6e12cbd1f
ST-80 compatibility changes.
Claus Gittinger <cg@exept.de>
parents:
1492
diff
changeset
|
814 |
"Modified: / 18.6.1998 / 23:47:39 / cg" |
205 | 815 |
! ! |
816 |
||
817 |
!PopUpList methodsFor:'initialization'! |
|
818 |
||
819 |
defaultControllerClass |
|
820 |
^ PopUpListController |
|
821 |
! |
|
822 |
||
823 |
initialize |
|
824 |
super initialize. |
|
825 |
||
826 |
controller beTriggerOnDown. |
|
827 |
controller action:[self popMenu]. |
|
828 |
useIndex := false. |
|
1035 | 829 |
defaultLabel := 'popup'. |
1758 | 830 |
showHandle := true. |
1840 | 831 |
self adjust:#left. |
1758 | 832 |
|
1086
76da3ddb3372
label: only affects the actual label, if there is no model.
Claus Gittinger <cg@exept.de>
parents:
1083
diff
changeset
|
833 |
super label:defaultLabel. |
1063 | 834 |
|
205 | 835 |
listMsg := self class defaultListMessage. |
836 |
||
837 |
onLevel := offLevel. |
|
1063 | 838 |
|
1086
76da3ddb3372
label: only affects the actual label, if there is no model.
Claus Gittinger <cg@exept.de>
parents:
1083
diff
changeset
|
839 |
"Modified: 1.3.1997 / 02:12:55 / cg" |
136 | 840 |
! ! |
841 |
||
20 | 842 |
!PopUpList methodsFor:'private'! |
843 |
||
844 |
computeLabelSize |
|
845 |
"compute the extent needed to hold the label plus the mark" |
|
846 |
||
1052
59f182d1304f
added list- and selectionHolders
Claus Gittinger <cg@exept.de>
parents:
1035
diff
changeset
|
847 |
|mmH mmV savedLogo longest longestWidth labels| |
20 | 848 |
|
849 |
menu isNil ifTrue:[ |
|
1098 | 850 |
super computeLabelSize |
20 | 851 |
] ifFalse:[ |
1098 | 852 |
"hack: simulate logo change to longest menu entry" |
20 | 853 |
|
1988 | 854 |
font := font onDevice:device. |
1098 | 855 |
longest := logo. |
856 |
logo isNil ifTrue:[ |
|
857 |
longestWidth := 0 |
|
858 |
] ifFalse:[ |
|
859 |
longestWidth := font widthOf:logo. |
|
860 |
]. |
|
861 |
labels := menu value labels. |
|
862 |
labels notNil ifTrue:[ |
|
863 |
labels do:[:entry | |
|
864 |
|this| |
|
1052
59f182d1304f
added list- and selectionHolders
Claus Gittinger <cg@exept.de>
parents:
1035
diff
changeset
|
865 |
|
1098 | 866 |
this := font widthOf:entry printString. |
867 |
this > longestWidth ifTrue:[ |
|
868 |
longest := entry. |
|
869 |
longestWidth := this |
|
870 |
]. |
|
871 |
]. |
|
872 |
]. |
|
873 |
savedLogo := logo. |
|
874 |
logo := longest printString. |
|
875 |
super computeLabelSize. |
|
876 |
logo := savedLogo. |
|
20 | 877 |
]. |
1772 | 878 |
showHandle ifTrue:[ |
879 |
mmH := device horizontalPixelPerMillimeter. |
|
880 |
mmV := device verticalPixelPerMillimeter. |
|
881 |
labelWidth := labelWidth + hSpace + (mmH * 2.5) rounded + hSpace. |
|
882 |
labelHeight := labelHeight max: (mmV * 2) rounded |
|
883 |
] |
|
327
5cd2a6f4f28e
fixes to allow use of ListEntries (and an example)
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
884 |
|
1772 | 885 |
"Modified: / 6.3.1999 / 21:51:14 / cg" |
121 | 886 |
! |
887 |
||
888 |
createMenuFor:aList |
|
1586
e4e6e12cbd1f
ST-80 compatibility changes.
Claus Gittinger <cg@exept.de>
parents:
1492
diff
changeset
|
889 |
(aList isKindOf:Menu) ifTrue:[ |
e4e6e12cbd1f
ST-80 compatibility changes.
Claus Gittinger <cg@exept.de>
parents:
1492
diff
changeset
|
890 |
menu := aList. |
e4e6e12cbd1f
ST-80 compatibility changes.
Claus Gittinger <cg@exept.de>
parents:
1492
diff
changeset
|
891 |
^ self. |
e4e6e12cbd1f
ST-80 compatibility changes.
Claus Gittinger <cg@exept.de>
parents:
1492
diff
changeset
|
892 |
]. |
e4e6e12cbd1f
ST-80 compatibility changes.
Claus Gittinger <cg@exept.de>
parents:
1492
diff
changeset
|
893 |
|
121 | 894 |
menu := PopUpMenu |
1586
e4e6e12cbd1f
ST-80 compatibility changes.
Claus Gittinger <cg@exept.de>
parents:
1492
diff
changeset
|
895 |
labels:aList |
e4e6e12cbd1f
ST-80 compatibility changes.
Claus Gittinger <cg@exept.de>
parents:
1492
diff
changeset
|
896 |
selectors:#select: |
e4e6e12cbd1f
ST-80 compatibility changes.
Claus Gittinger <cg@exept.de>
parents:
1492
diff
changeset
|
897 |
args:(1 to:aList size) |
e4e6e12cbd1f
ST-80 compatibility changes.
Claus Gittinger <cg@exept.de>
parents:
1492
diff
changeset
|
898 |
receiver:self |
e4e6e12cbd1f
ST-80 compatibility changes.
Claus Gittinger <cg@exept.de>
parents:
1492
diff
changeset
|
899 |
for:self. |
e4e6e12cbd1f
ST-80 compatibility changes.
Claus Gittinger <cg@exept.de>
parents:
1492
diff
changeset
|
900 |
|
e4e6e12cbd1f
ST-80 compatibility changes.
Claus Gittinger <cg@exept.de>
parents:
1492
diff
changeset
|
901 |
"Modified: / 18.6.1998 / 23:20:16 / cg" |
128 | 902 |
! |
903 |
||
1066
d324041c0aaf
examples and values-handling
Claus Gittinger <cg@exept.de>
parents:
1065
diff
changeset
|
904 |
getListFromModel |
d324041c0aaf
examples and values-handling
Claus Gittinger <cg@exept.de>
parents:
1065
diff
changeset
|
905 |
"if I have a listHolder, ask it for the list; |
d324041c0aaf
examples and values-handling
Claus Gittinger <cg@exept.de>
parents:
1065
diff
changeset
|
906 |
otherwise, if I have a model and a listMsg, get my list from there" |
d324041c0aaf
examples and values-handling
Claus Gittinger <cg@exept.de>
parents:
1065
diff
changeset
|
907 |
|
d324041c0aaf
examples and values-handling
Claus Gittinger <cg@exept.de>
parents:
1065
diff
changeset
|
908 |
listHolder notNil ifTrue:[ |
1586
e4e6e12cbd1f
ST-80 compatibility changes.
Claus Gittinger <cg@exept.de>
parents:
1492
diff
changeset
|
909 |
self list:listHolder value. |
1587 | 910 |
"/ model notNil ifTrue:[ |
911 |
"/ self halt. |
|
912 |
"/ ] |
|
1066
d324041c0aaf
examples and values-handling
Claus Gittinger <cg@exept.de>
parents:
1065
diff
changeset
|
913 |
] ifFalse:[ |
d324041c0aaf
examples and values-handling
Claus Gittinger <cg@exept.de>
parents:
1065
diff
changeset
|
914 |
(listMsg notNil and:[model notNil]) ifTrue:[ |
1067 | 915 |
(model respondsTo:listMsg) ifTrue:[ |
916 |
self list:(model perform:listMsg). |
|
917 |
] |
|
1066
d324041c0aaf
examples and values-handling
Claus Gittinger <cg@exept.de>
parents:
1065
diff
changeset
|
918 |
]. |
d324041c0aaf
examples and values-handling
Claus Gittinger <cg@exept.de>
parents:
1065
diff
changeset
|
919 |
] |
d324041c0aaf
examples and values-handling
Claus Gittinger <cg@exept.de>
parents:
1065
diff
changeset
|
920 |
|
1587 | 921 |
"Modified: / 19.6.1998 / 01:54:17 / cg" |
1066
d324041c0aaf
examples and values-handling
Claus Gittinger <cg@exept.de>
parents:
1065
diff
changeset
|
922 |
! |
d324041c0aaf
examples and values-handling
Claus Gittinger <cg@exept.de>
parents:
1065
diff
changeset
|
923 |
|
d324041c0aaf
examples and values-handling
Claus Gittinger <cg@exept.de>
parents:
1065
diff
changeset
|
924 |
getSelectionFromModel |
d324041c0aaf
examples and values-handling
Claus Gittinger <cg@exept.de>
parents:
1065
diff
changeset
|
925 |
"if I have a model and an aspectMsg, get my current value from it" |
d324041c0aaf
examples and values-handling
Claus Gittinger <cg@exept.de>
parents:
1065
diff
changeset
|
926 |
|
1839
75f77fcf458b
fix: defaultLabel with nil-selection and not useIndex.
Claus Gittinger <cg@exept.de>
parents:
1772
diff
changeset
|
927 |
|aspect val newLabel| |
1075
662f7e5069fd
allow use of a valueHolder, without setting change/aspect
Claus Gittinger <cg@exept.de>
parents:
1071
diff
changeset
|
928 |
|
1066
d324041c0aaf
examples and values-handling
Claus Gittinger <cg@exept.de>
parents:
1065
diff
changeset
|
929 |
(model notNil and:[aspectMsg notNil]) ifTrue:[ |
1075
662f7e5069fd
allow use of a valueHolder, without setting change/aspect
Claus Gittinger <cg@exept.de>
parents:
1071
diff
changeset
|
930 |
"/ kludge - try #value if aspect is the default and |
662f7e5069fd
allow use of a valueHolder, without setting change/aspect
Claus Gittinger <cg@exept.de>
parents:
1071
diff
changeset
|
931 |
"/ not understood by the model |
662f7e5069fd
allow use of a valueHolder, without setting change/aspect
Claus Gittinger <cg@exept.de>
parents:
1071
diff
changeset
|
932 |
"/ this allows a valueHolder to be used, even |
662f7e5069fd
allow use of a valueHolder, without setting change/aspect
Claus Gittinger <cg@exept.de>
parents:
1071
diff
changeset
|
933 |
"/ if the aspectMessage was not setup correctly. |
662f7e5069fd
allow use of a valueHolder, without setting change/aspect
Claus Gittinger <cg@exept.de>
parents:
1071
diff
changeset
|
934 |
|
662f7e5069fd
allow use of a valueHolder, without setting change/aspect
Claus Gittinger <cg@exept.de>
parents:
1071
diff
changeset
|
935 |
aspect := aspectMsg. |
662f7e5069fd
allow use of a valueHolder, without setting change/aspect
Claus Gittinger <cg@exept.de>
parents:
1071
diff
changeset
|
936 |
aspect == self class defaultAspectMessage ifTrue:[ |
662f7e5069fd
allow use of a valueHolder, without setting change/aspect
Claus Gittinger <cg@exept.de>
parents:
1071
diff
changeset
|
937 |
(model respondsTo:aspect) ifFalse:[ |
662f7e5069fd
allow use of a valueHolder, without setting change/aspect
Claus Gittinger <cg@exept.de>
parents:
1071
diff
changeset
|
938 |
aspect := #value |
662f7e5069fd
allow use of a valueHolder, without setting change/aspect
Claus Gittinger <cg@exept.de>
parents:
1071
diff
changeset
|
939 |
] |
662f7e5069fd
allow use of a valueHolder, without setting change/aspect
Claus Gittinger <cg@exept.de>
parents:
1071
diff
changeset
|
940 |
]. |
1586
e4e6e12cbd1f
ST-80 compatibility changes.
Claus Gittinger <cg@exept.de>
parents:
1492
diff
changeset
|
941 |
val := (model perform:aspect). |
e4e6e12cbd1f
ST-80 compatibility changes.
Claus Gittinger <cg@exept.de>
parents:
1492
diff
changeset
|
942 |
|
e4e6e12cbd1f
ST-80 compatibility changes.
Claus Gittinger <cg@exept.de>
parents:
1492
diff
changeset
|
943 |
useIndex ifFalse:[ |
1839
75f77fcf458b
fix: defaultLabel with nil-selection and not useIndex.
Claus Gittinger <cg@exept.de>
parents:
1772
diff
changeset
|
944 |
val isNil ifTrue:[ |
75f77fcf458b
fix: defaultLabel with nil-selection and not useIndex.
Claus Gittinger <cg@exept.de>
parents:
1772
diff
changeset
|
945 |
newLabel := defaultLabel |
75f77fcf458b
fix: defaultLabel with nil-selection and not useIndex.
Claus Gittinger <cg@exept.de>
parents:
1772
diff
changeset
|
946 |
] ifFalse:[ |
75f77fcf458b
fix: defaultLabel with nil-selection and not useIndex.
Claus Gittinger <cg@exept.de>
parents:
1772
diff
changeset
|
947 |
newLabel := val printString. |
75f77fcf458b
fix: defaultLabel with nil-selection and not useIndex.
Claus Gittinger <cg@exept.de>
parents:
1772
diff
changeset
|
948 |
]. |
75f77fcf458b
fix: defaultLabel with nil-selection and not useIndex.
Claus Gittinger <cg@exept.de>
parents:
1772
diff
changeset
|
949 |
^ self label:newLabel suppressResize:true. |
1586
e4e6e12cbd1f
ST-80 compatibility changes.
Claus Gittinger <cg@exept.de>
parents:
1492
diff
changeset
|
950 |
]. |
e4e6e12cbd1f
ST-80 compatibility changes.
Claus Gittinger <cg@exept.de>
parents:
1492
diff
changeset
|
951 |
self selection:val |
1066
d324041c0aaf
examples and values-handling
Claus Gittinger <cg@exept.de>
parents:
1065
diff
changeset
|
952 |
]. |
d324041c0aaf
examples and values-handling
Claus Gittinger <cg@exept.de>
parents:
1065
diff
changeset
|
953 |
|
1586
e4e6e12cbd1f
ST-80 compatibility changes.
Claus Gittinger <cg@exept.de>
parents:
1492
diff
changeset
|
954 |
"Modified: / 18.6.1998 / 23:54:34 / cg" |
121 | 955 |
! ! |
956 |
||
205 | 957 |
!PopUpList methodsFor:'private-controller access'! |
121 | 958 |
|
205 | 959 |
menu |
960 |
"return the menu component" |
|
125 | 961 |
|
205 | 962 |
^ menu |
126 | 963 |
! ! |
964 |
||
136 | 965 |
!PopUpList methodsFor:'queries'! |
966 |
||
967 |
preferredExtent |
|
968 |
"redefined to make certain that the menu is fully defined" |
|
969 |
||
799 | 970 |
"/ If I have an explicit preferredExtent .. |
971 |
||
714
5ff02d2d9fa7
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
694
diff
changeset
|
972 |
preferredExtent notNil ifTrue:[ |
1052
59f182d1304f
added list- and selectionHolders
Claus Gittinger <cg@exept.de>
parents:
1035
diff
changeset
|
973 |
^ preferredExtent |
714
5ff02d2d9fa7
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
694
diff
changeset
|
974 |
]. |
5ff02d2d9fa7
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
694
diff
changeset
|
975 |
|
136 | 976 |
menu isNil ifTrue:[ |
1052
59f182d1304f
added list- and selectionHolders
Claus Gittinger <cg@exept.de>
parents:
1035
diff
changeset
|
977 |
self getListFromModel |
136 | 978 |
]. |
979 |
self computeLabelSize. |
|
980 |
^ super preferredExtent. |
|
714
5ff02d2d9fa7
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
694
diff
changeset
|
981 |
|
799 | 982 |
"Modified: 19.7.1996 / 20:45:16 / cg" |
155 | 983 |
! |
984 |
||
985 |
specClass |
|
1376 | 986 |
"XXX no longer needed (inherited default works here)" |
987 |
||
155 | 988 |
self class == PopUpList ifTrue:[^ PopUpListSpec]. |
1052
59f182d1304f
added list- and selectionHolders
Claus Gittinger <cg@exept.de>
parents:
1035
diff
changeset
|
989 |
^ super specClass |
1376 | 990 |
|
991 |
"Modified: / 31.10.1997 / 19:48:02 / cg" |
|
136 | 992 |
! ! |
993 |
||
20 | 994 |
!PopUpList methodsFor:'user actions'! |
995 |
||
1069 | 996 |
select:anIndex |
119 | 997 |
"this is sent from the popupmenu when an entry was selected" |
998 |
||
1368 | 999 |
|value menuLabels label chg| |
77 | 1000 |
|
1368 | 1001 |
menuLabels := menu labels. |
1069 | 1002 |
values isNil ifTrue:[ |
1003 |
value := anIndex. |
|
1004 |
useIndex ifFalse:[ |
|
1368 | 1005 |
value := menuLabels at:anIndex. |
1069 | 1006 |
] |
1007 |
] ifFalse:[ |
|
1008 |
value := values at:anIndex |
|
1009 |
]. |
|
1010 |
||
1142
406d3829ddcc
always change my label on select:;
Claus Gittinger <cg@exept.de>
parents:
1098
diff
changeset
|
1011 |
"/ model isNil ifTrue:[ |
1066
d324041c0aaf
examples and values-handling
Claus Gittinger <cg@exept.de>
parents:
1065
diff
changeset
|
1012 |
"/ if there is a model, |
d324041c0aaf
examples and values-handling
Claus Gittinger <cg@exept.de>
parents:
1065
diff
changeset
|
1013 |
"/ the update will change my logo ... |
d324041c0aaf
examples and values-handling
Claus Gittinger <cg@exept.de>
parents:
1065
diff
changeset
|
1014 |
|
1368 | 1015 |
"/ self sizeFixed:true. |
1016 |
label := menuLabels at:anIndex. |
|
1017 |
super label:label printString suppressResize:true. |
|
1142
406d3829ddcc
always change my label on select:;
Claus Gittinger <cg@exept.de>
parents:
1098
diff
changeset
|
1018 |
"/ ]. |
327
5cd2a6f4f28e
fixes to allow use of ListEntries (and an example)
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
1019 |
|
1075
662f7e5069fd
allow use of a valueHolder, without setting change/aspect
Claus Gittinger <cg@exept.de>
parents:
1071
diff
changeset
|
1020 |
(model notNil and:[changeMsg notNil]) ifTrue:[ |
662f7e5069fd
allow use of a valueHolder, without setting change/aspect
Claus Gittinger <cg@exept.de>
parents:
1071
diff
changeset
|
1021 |
"/ |
662f7e5069fd
allow use of a valueHolder, without setting change/aspect
Claus Gittinger <cg@exept.de>
parents:
1071
diff
changeset
|
1022 |
"/ ST-80 way of doing it |
662f7e5069fd
allow use of a valueHolder, without setting change/aspect
Claus Gittinger <cg@exept.de>
parents:
1071
diff
changeset
|
1023 |
"/ tell my model - if any |
662f7e5069fd
allow use of a valueHolder, without setting change/aspect
Claus Gittinger <cg@exept.de>
parents:
1071
diff
changeset
|
1024 |
"/ |
662f7e5069fd
allow use of a valueHolder, without setting change/aspect
Claus Gittinger <cg@exept.de>
parents:
1071
diff
changeset
|
1025 |
|
662f7e5069fd
allow use of a valueHolder, without setting change/aspect
Claus Gittinger <cg@exept.de>
parents:
1071
diff
changeset
|
1026 |
"/ kludge - try #value: if changeMsg is the default and |
662f7e5069fd
allow use of a valueHolder, without setting change/aspect
Claus Gittinger <cg@exept.de>
parents:
1071
diff
changeset
|
1027 |
"/ not understood by the model |
662f7e5069fd
allow use of a valueHolder, without setting change/aspect
Claus Gittinger <cg@exept.de>
parents:
1071
diff
changeset
|
1028 |
"/ this allows a valueHolder to be used, even |
662f7e5069fd
allow use of a valueHolder, without setting change/aspect
Claus Gittinger <cg@exept.de>
parents:
1071
diff
changeset
|
1029 |
"/ if the aspectMessage was not setup correctly. |
662f7e5069fd
allow use of a valueHolder, without setting change/aspect
Claus Gittinger <cg@exept.de>
parents:
1071
diff
changeset
|
1030 |
|
662f7e5069fd
allow use of a valueHolder, without setting change/aspect
Claus Gittinger <cg@exept.de>
parents:
1071
diff
changeset
|
1031 |
chg := changeMsg. |
662f7e5069fd
allow use of a valueHolder, without setting change/aspect
Claus Gittinger <cg@exept.de>
parents:
1071
diff
changeset
|
1032 |
chg == self class defaultChangeMessage ifTrue:[ |
662f7e5069fd
allow use of a valueHolder, without setting change/aspect
Claus Gittinger <cg@exept.de>
parents:
1071
diff
changeset
|
1033 |
(model respondsTo:chg) ifFalse:[ |
1076 | 1034 |
chg := #value: |
1075
662f7e5069fd
allow use of a valueHolder, without setting change/aspect
Claus Gittinger <cg@exept.de>
parents:
1071
diff
changeset
|
1035 |
] |
662f7e5069fd
allow use of a valueHolder, without setting change/aspect
Claus Gittinger <cg@exept.de>
parents:
1071
diff
changeset
|
1036 |
]. |
662f7e5069fd
allow use of a valueHolder, without setting change/aspect
Claus Gittinger <cg@exept.de>
parents:
1071
diff
changeset
|
1037 |
|
662f7e5069fd
allow use of a valueHolder, without setting change/aspect
Claus Gittinger <cg@exept.de>
parents:
1071
diff
changeset
|
1038 |
self sendChangeMessage:chg with:value. |
662f7e5069fd
allow use of a valueHolder, without setting change/aspect
Claus Gittinger <cg@exept.de>
parents:
1071
diff
changeset
|
1039 |
]. |
1052
59f182d1304f
added list- and selectionHolders
Claus Gittinger <cg@exept.de>
parents:
1035
diff
changeset
|
1040 |
|
59f182d1304f
added list- and selectionHolders
Claus Gittinger <cg@exept.de>
parents:
1035
diff
changeset
|
1041 |
"/ |
59f182d1304f
added list- and selectionHolders
Claus Gittinger <cg@exept.de>
parents:
1035
diff
changeset
|
1042 |
"/ ST/X action blocks |
59f182d1304f
added list- and selectionHolders
Claus Gittinger <cg@exept.de>
parents:
1035
diff
changeset
|
1043 |
"/ |
59f182d1304f
added list- and selectionHolders
Claus Gittinger <cg@exept.de>
parents:
1035
diff
changeset
|
1044 |
menuAction notNil ifTrue:[ |
1063 | 1045 |
menuAction value:value. |
1052
59f182d1304f
added list- and selectionHolders
Claus Gittinger <cg@exept.de>
parents:
1035
diff
changeset
|
1046 |
]. |
327
5cd2a6f4f28e
fixes to allow use of ListEntries (and an example)
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
1047 |
|
1369 | 1048 |
"Modified: / 29.10.1997 / 21:08:50 / cg" |
20 | 1049 |
! ! |
121 | 1050 |
|
998 | 1051 |
!PopUpList class methodsFor:'documentation'! |
121 | 1052 |
|
205 | 1053 |
version |
2174 | 1054 |
^ '$Header: /cvs/stx/stx/libwidg/PopUpList.st,v 1.65 2000-04-01 14:30:31 cg Exp $' |
121 | 1055 |
! ! |