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