author | Claus Gittinger <cg@exept.de> |
Tue, 11 May 2004 14:50:21 +0200 | |
changeset 2704 | 0a09fd78eb54 |
parent 1826 | 080df5e45c3c |
child 2825 | b27f9e7776d7 |
permissions | -rw-r--r-- |
1302 | 1 |
" |
332 | 2 |
COPYRIGHT (c) 1996 by eXept Software AG / Claus Gittinger |
1295 | 3 |
All Rights Reserved |
332 | 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 |
||
14 |
||
1826 | 15 |
"{ Package: 'stx:libwidg2' }" |
16 |
||
131 | 17 |
ComboView subclass:#ComboListView |
1729 | 18 |
instanceVariableNames:'useIndex values' |
19 |
classVariableNames:'' |
|
20 |
poolDictionaries:'' |
|
21 |
category:'Views-Interactors' |
|
131 | 22 |
! |
23 |
||
270 | 24 |
!ComboListView class methodsFor:'documentation'! |
131 | 25 |
|
332 | 26 |
copyright |
27 |
" |
|
28 |
COPYRIGHT (c) 1996 by eXept Software AG / Claus Gittinger |
|
1295 | 29 |
All Rights Reserved |
332 | 30 |
|
31 |
This software is furnished under a license and may be used |
|
32 |
only in accordance with the terms of that license and with the |
|
33 |
inclusion of the above copyright notice. This software may not |
|
34 |
be provided or otherwise made available to, or used by, any |
|
35 |
other person. No title to or ownership of the software is |
|
36 |
hereby transferred. |
|
37 |
" |
|
38 |
||
39 |
||
40 |
! |
|
41 |
||
131 | 42 |
documentation |
43 |
" |
|
44 |
A ComboListView combines an label with a drop down list of default inputs; |
|
45 |
choosing any from the pulled list sets the string in the label. |
|
46 |
||
47 |
This is the same as a PopUpList or SelectionInListView, bit looks different. |
|
48 |
||
310 | 49 |
The preferred model is a SelectionInList, but a simple valueHolder |
50 |
may also be used. |
|
51 |
If some other model is to be used, the changeMessage and aspectMessage |
|
52 |
should be defined as appropriate (or an aspectAdaptor should be used). |
|
53 |
If a listHolder is set, that one is assumed to provide the list of |
|
54 |
items in the popped menu; |
|
55 |
otherwise, if listMessage is nonNil, the model is assumed to also provide the |
|
56 |
list as displayed in the popped menu. |
|
275 | 57 |
|
58 |
[author:] |
|
1281 | 59 |
Claus Gittinger |
275 | 60 |
|
61 |
[see also:] |
|
1281 | 62 |
ComboView |
63 |
PopUpList SelectionInListView |
|
64 |
ComboBoxView ExtendedComboBox |
|
65 |
PullDownMenu Label EntryField |
|
131 | 66 |
" |
67 |
! |
|
68 |
||
69 |
examples |
|
70 |
" |
|
307
b33b48f2a1a3
examples; protocol now compatible with PopUpList
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
71 |
non-MVC use; |
b33b48f2a1a3
examples; protocol now compatible with PopUpList
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
72 |
set the list explicitely: |
1826 | 73 |
[exBegin] |
682 | 74 |
|top comboList| |
75 |
||
76 |
top := StandardSystemView new. |
|
77 |
top extent:(300 @ 200). |
|
78 |
||
79 |
comboList := ComboListView in:top. |
|
80 |
comboList origin:(0.0 @ 0.0) corner:(1.0 @ 0.0). |
|
81 |
comboList bottomInset:(comboList preferredExtent y negated). |
|
82 |
||
83 |
comboList list:#('hello' 'world' 'this' 'is' 'st/x'). |
|
84 |
top open. |
|
85 |
[exEnd] |
|
86 |
||
87 |
||
88 |
||
89 |
with callBack: |
|
90 |
[exBegin] |
|
91 |
|top comboList| |
|
131 | 92 |
|
93 |
top := StandardSystemView new. |
|
94 |
top extent:(300 @ 200). |
|
95 |
||
682 | 96 |
comboList := ComboListView in:top. |
97 |
comboList origin:(0.0 @ 0.0) corner:(1.0 @ 0.0). |
|
98 |
comboList bottomInset:(comboList preferredExtent y negated). |
|
131 | 99 |
|
682 | 100 |
comboList list:#('hello' 'world' 'this' 'is' 'st/x'). |
101 |
comboList action:[:selected | Transcript showCR:selected]. |
|
131 | 102 |
top open. |
682 | 103 |
[exEnd] |
131 | 104 |
|
105 |
||
106 |
||
682 | 107 |
with separating lines: |
108 |
[exBegin] |
|
109 |
|top comboList| |
|
305 | 110 |
|
682 | 111 |
top := StandardSystemView label:'fruit chooser'. |
305 | 112 |
top extent:(300 @ 200). |
113 |
||
682 | 114 |
comboList := ComboListView in:top. |
115 |
comboList origin:(0.0 @ 0.0) corner:(1.0 @ 0.0). |
|
116 |
comboList bottomInset:(comboList preferredExtent y negated). |
|
305 | 117 |
|
682 | 118 |
comboList label:'fruit'. |
119 |
comboList list:#('apples' 'bananas' 'grape' 'lemon' '-' 'margaritas'). |
|
120 |
comboList action:[:selected | Transcript showCR:selected]. |
|
121 |
top open |
|
122 |
[exEnd] |
|
123 |
||
305 | 124 |
|
125 |
||
126 |
||
307
b33b48f2a1a3
examples; protocol now compatible with PopUpList
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
127 |
with values different from the label strings: |
682 | 128 |
[exBegin] |
129 |
|top comboList| |
|
307
b33b48f2a1a3
examples; protocol now compatible with PopUpList
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
130 |
|
682 | 131 |
top := StandardSystemView label:'fruit chooser'. |
132 |
top extent:(300 @ 200). |
|
307
b33b48f2a1a3
examples; protocol now compatible with PopUpList
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
133 |
|
682 | 134 |
comboList := ComboListView in:top. |
135 |
comboList origin:(0.0 @ 0.0) corner:(1.0 @ 0.0). |
|
136 |
comboList bottomInset:(comboList preferredExtent y negated). |
|
307
b33b48f2a1a3
examples; protocol now compatible with PopUpList
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
137 |
|
682 | 138 |
comboList label:'dummy'. |
139 |
comboList list:#('apples' 'bananas' 'grape' 'lemon' '-' 'margaritas'). |
|
140 |
comboList selection:'apples'. |
|
141 |
comboList values:#(10 20 30 40 nil 50). |
|
142 |
comboList action:[:what | Transcript show:'you selected: '; showCR:what]. |
|
143 |
top open |
|
144 |
[exEnd] |
|
307
b33b48f2a1a3
examples; protocol now compatible with PopUpList
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
145 |
|
b33b48f2a1a3
examples; protocol now compatible with PopUpList
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
146 |
|
b33b48f2a1a3
examples; protocol now compatible with PopUpList
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
147 |
sometimes, you may like the index instead of the value: |
b33b48f2a1a3
examples; protocol now compatible with PopUpList
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
148 |
(notice, that the separating line counts, so you have to take care ...) |
682 | 149 |
[exBegin] |
150 |
|top comboList| |
|
151 |
||
152 |
top := StandardSystemView label:'fruit chooser'. |
|
153 |
top extent:(300 @ 200). |
|
307
b33b48f2a1a3
examples; protocol now compatible with PopUpList
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
154 |
|
682 | 155 |
comboList := ComboListView in:top. |
156 |
comboList origin:(0.0 @ 0.0) corner:(1.0 @ 0.0). |
|
157 |
comboList bottomInset:(comboList preferredExtent y negated). |
|
307
b33b48f2a1a3
examples; protocol now compatible with PopUpList
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
158 |
|
682 | 159 |
comboList label:'dummy'. |
160 |
comboList list:#('apples' 'bananas' 'grape' 'lemon' '-' 'margaritas'). |
|
161 |
comboList selection:'apples'. |
|
162 |
comboList action:[:what | Transcript show:'you selected: '; showCR:what]. |
|
163 |
comboList useIndex:true. |
|
164 |
top open |
|
165 |
[exEnd] |
|
307
b33b48f2a1a3
examples; protocol now compatible with PopUpList
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
166 |
|
b33b48f2a1a3
examples; protocol now compatible with PopUpList
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
167 |
since the list is actually represented by a menuView, |
b33b48f2a1a3
examples; protocol now compatible with PopUpList
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
168 |
which itself is inheriting from listView, which itself can display |
b33b48f2a1a3
examples; protocol now compatible with PopUpList
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
169 |
things different from strings, arbitrary lists can be constructed: |
b33b48f2a1a3
examples; protocol now compatible with PopUpList
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
170 |
(see ListEntry, LabelAndIcon and Text classes) |
682 | 171 |
[exBegin] |
172 |
|top comboList l| |
|
173 |
||
174 |
top := StandardSystemView label:'fruit chooser'. |
|
175 |
top extent:(300 @ 200). |
|
176 |
||
177 |
comboList := ComboListView in:top. |
|
178 |
comboList origin:(0.0 @ 0.0) corner:(1.0 @ 0.0). |
|
179 |
comboList bottomInset:(comboList preferredExtent y negated). |
|
307
b33b48f2a1a3
examples; protocol now compatible with PopUpList
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
180 |
|
b33b48f2a1a3
examples; protocol now compatible with PopUpList
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
181 |
l := OrderedCollection new. |
b33b48f2a1a3
examples; protocol now compatible with PopUpList
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
182 |
l add:(Text string:'apples' color:Color red). |
b33b48f2a1a3
examples; protocol now compatible with PopUpList
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
183 |
l add:(Text string:'bananas' color:Color red). |
b33b48f2a1a3
examples; protocol now compatible with PopUpList
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
184 |
l add:(Text string:'grape' color:Color red). |
b33b48f2a1a3
examples; protocol now compatible with PopUpList
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
185 |
l add:(Text string:'lemon' color:Color red). |
b33b48f2a1a3
examples; protocol now compatible with PopUpList
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
186 |
l add:'='. |
b33b48f2a1a3
examples; protocol now compatible with PopUpList
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
187 |
l add:(Text string:'margaritas' color:Color green darkened darkened). |
b33b48f2a1a3
examples; protocol now compatible with PopUpList
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
188 |
l add:(Text string:'pina colada' color:Color green darkened darkened). |
b33b48f2a1a3
examples; protocol now compatible with PopUpList
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
189 |
l add:'='. |
b33b48f2a1a3
examples; protocol now compatible with PopUpList
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
190 |
l add:(Text string:'smalltalk' color:Color blue). |
b33b48f2a1a3
examples; protocol now compatible with PopUpList
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
191 |
l add:(Text string:'c++' color:Color blue). |
b33b48f2a1a3
examples; protocol now compatible with PopUpList
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
192 |
l add:(Text string:'eiffel' color:Color blue). |
b33b48f2a1a3
examples; protocol now compatible with PopUpList
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
193 |
l add:(Text string:'java' color:Color blue). |
682 | 194 |
comboList list:l. |
195 |
comboList values:#(apples bananas grape lemon |
|
196 |
nil |
|
197 |
'mhmh - so good' 'makes headache' |
|
198 |
nil |
|
199 |
'great' 'another headache' 'not bad' 'neat'). |
|
200 |
comboList selection:'apples'. |
|
201 |
comboList action:[:what | Transcript show:'you selected: '; showCR:what]. |
|
202 |
top open |
|
203 |
[exEnd] |
|
307
b33b48f2a1a3
examples; protocol now compatible with PopUpList
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
204 |
|
b33b48f2a1a3
examples; protocol now compatible with PopUpList
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
205 |
with values different from the label strings: |
682 | 206 |
[exBegin] |
207 |
|top comboList| |
|
208 |
||
209 |
top := StandardSystemView label:'language chooser'. |
|
210 |
top extent:(300 @ 200). |
|
211 |
||
212 |
comboList := ComboListView in:top. |
|
213 |
comboList origin:(0.0 @ 0.0) corner:(1.0 @ 0.0). |
|
307
b33b48f2a1a3
examples; protocol now compatible with PopUpList
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
214 |
|
682 | 215 |
comboList list:( #( |
216 |
'usa' |
|
217 |
'uk' |
|
218 |
'france' |
|
219 |
'germany' |
|
220 |
'italy' |
|
221 |
) collect:[:country | |
|
222 |
LabelAndIcon |
|
223 |
icon:(Image fromFile:'bitmaps/xpmBitmaps/countries/' , country , '.xpm') |
|
224 |
string:country |
|
225 |
] |
|
226 |
). |
|
227 |
comboList values:#(us england france germany italy). |
|
307
b33b48f2a1a3
examples; protocol now compatible with PopUpList
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
228 |
|
682 | 229 |
comboList action:[:what | Transcript show:'you selected: '; showCR:what]. |
230 |
comboList bottomInset:(comboList preferredExtent y negated). |
|
231 |
top open |
|
232 |
[exEnd] |
|
307
b33b48f2a1a3
examples; protocol now compatible with PopUpList
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
233 |
|
b33b48f2a1a3
examples; protocol now compatible with PopUpList
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
234 |
|
b33b48f2a1a3
examples; protocol now compatible with PopUpList
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
235 |
with a model (see in the inspector, how the index-holders value changes) |
b33b48f2a1a3
examples; protocol now compatible with PopUpList
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
236 |
the defaults are setup to allow a SelectionInList directly as model: |
682 | 237 |
[exBegin] |
307
b33b48f2a1a3
examples; protocol now compatible with PopUpList
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
238 |
|p model| |
b33b48f2a1a3
examples; protocol now compatible with PopUpList
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
239 |
|
b33b48f2a1a3
examples; protocol now compatible with PopUpList
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
240 |
model := SelectionInList with:#('apples' 'bananas' 'grape' 'lemon' 'margaritas'). |
b33b48f2a1a3
examples; protocol now compatible with PopUpList
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
241 |
|
b33b48f2a1a3
examples; protocol now compatible with PopUpList
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
242 |
p := ComboListView label:'healthy fruit'. |
b33b48f2a1a3
examples; protocol now compatible with PopUpList
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
243 |
p model:model. |
682 | 244 |
p openAt:(Screen current center). |
307
b33b48f2a1a3
examples; protocol now compatible with PopUpList
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
245 |
model inspect |
682 | 246 |
[exEnd] |
307
b33b48f2a1a3
examples; protocol now compatible with PopUpList
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
247 |
|
b33b48f2a1a3
examples; protocol now compatible with PopUpList
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
248 |
model provides selection; list is explicit: |
682 | 249 |
[exBegin] |
131 | 250 |
|model top b| |
251 |
||
252 |
model := 'foo' asValue. |
|
253 |
||
254 |
top := StandardSystemView new. |
|
255 |
top extent:(300 @ 200). |
|
256 |
||
257 |
b := ComboListView in:top. |
|
258 |
b origin:(0.0 @ 0.0) corner:(1.0 @ 0.0). |
|
259 |
b bottomInset:(b preferredExtent y negated). |
|
260 |
||
261 |
b list:#('hello' 'world' 'this' 'is' 'st/x'). |
|
310 | 262 |
b model:model. |
131 | 263 |
|
264 |
top openModal. |
|
184 | 265 |
Transcript showCR:('comboBox''s value: ' , model value). |
682 | 266 |
[exEnd] |
131 | 267 |
|
268 |
||
307
b33b48f2a1a3
examples; protocol now compatible with PopUpList
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
269 |
a comboListView and a SelectionInListView on the same model: |
682 | 270 |
[exBegin] |
307
b33b48f2a1a3
examples; protocol now compatible with PopUpList
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
271 |
|p slv model| |
b33b48f2a1a3
examples; protocol now compatible with PopUpList
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
272 |
|
b33b48f2a1a3
examples; protocol now compatible with PopUpList
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
273 |
model := SelectionInList with:#('apples' 'bananas' 'grape' 'lemon' 'margaritas'). |
b33b48f2a1a3
examples; protocol now compatible with PopUpList
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
274 |
model selection:'apples'. |
b33b48f2a1a3
examples; protocol now compatible with PopUpList
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
275 |
|
b33b48f2a1a3
examples; protocol now compatible with PopUpList
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
276 |
p := ComboListView on:model. |
682 | 277 |
p openAt:(Screen current center). |
307
b33b48f2a1a3
examples; protocol now compatible with PopUpList
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
278 |
|
b33b48f2a1a3
examples; protocol now compatible with PopUpList
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
279 |
slv := SelectionInListView on:model. |
682 | 280 |
slv openAt:(Screen current center + (100@100)). |
281 |
[exEnd] |
|
282 |
||
283 |
||
284 |
like above, using index: |
|
285 |
[exBegin] |
|
286 |
|p slv model| |
|
287 |
||
288 |
model := SelectionInList with:#('apples' 'bananas' 'grape' 'lemon' 'margaritas'). |
|
289 |
model selection:'apples'. |
|
290 |
||
291 |
p := ComboListView on:model. |
|
292 |
p openAt:(Screen current center). |
|
293 |
||
294 |
slv := SelectionInListView on:model. |
|
295 |
slv openAt:(Screen current center + (100@100)). |
|
296 |
[exEnd] |
|
307
b33b48f2a1a3
examples; protocol now compatible with PopUpList
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
297 |
|
b33b48f2a1a3
examples; protocol now compatible with PopUpList
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
298 |
|
b33b48f2a1a3
examples; protocol now compatible with PopUpList
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
299 |
two comboListViews on the same model, different aspects: |
682 | 300 |
[exBegin] |
307
b33b48f2a1a3
examples; protocol now compatible with PopUpList
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
301 |
|top panel p model| |
b33b48f2a1a3
examples; protocol now compatible with PopUpList
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
302 |
|
b33b48f2a1a3
examples; protocol now compatible with PopUpList
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
303 |
model := Plug new. |
b33b48f2a1a3
examples; protocol now compatible with PopUpList
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
304 |
model respondTo:#eat: with:[:val | Transcript showCR:'eat: ' , val]. |
b33b48f2a1a3
examples; protocol now compatible with PopUpList
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
305 |
model respondTo:#drink: with:[:val | Transcript showCR:'drink: ' , val]. |
b33b48f2a1a3
examples; protocol now compatible with PopUpList
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
306 |
model respondTo:#meals with:[#(taco burrito enchilada)]. |
b33b48f2a1a3
examples; protocol now compatible with PopUpList
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
307 |
model respondTo:#drinks with:[#(margarita water corona)]. |
b33b48f2a1a3
examples; protocol now compatible with PopUpList
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
308 |
|
682 | 309 |
top := StandardSystemView label:'meal chooser'. |
307
b33b48f2a1a3
examples; protocol now compatible with PopUpList
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
310 |
top extent:(150@150). |
b33b48f2a1a3
examples; protocol now compatible with PopUpList
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
311 |
panel := VerticalPanelView origin:0.0@0.0 corner:1.0@1.0 in:top. |
b33b48f2a1a3
examples; protocol now compatible with PopUpList
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
312 |
panel horizontalLayout:#fitSpace. |
b33b48f2a1a3
examples; protocol now compatible with PopUpList
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
313 |
|
b33b48f2a1a3
examples; protocol now compatible with PopUpList
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
314 |
p := ComboListView label:'meals'. |
682 | 315 |
p aspect:nil; model:model; listMessage:#meals; change:#eat:. |
307
b33b48f2a1a3
examples; protocol now compatible with PopUpList
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
316 |
panel add:p. |
b33b48f2a1a3
examples; protocol now compatible with PopUpList
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
317 |
|
b33b48f2a1a3
examples; protocol now compatible with PopUpList
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
318 |
p := ComboListView label:'drinks'. |
682 | 319 |
p aspect:nil; model:model; listMessage:#drinks; change:#drink:. |
307
b33b48f2a1a3
examples; protocol now compatible with PopUpList
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
320 |
panel add:p. |
b33b48f2a1a3
examples; protocol now compatible with PopUpList
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
321 |
|
b33b48f2a1a3
examples; protocol now compatible with PopUpList
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
322 |
top open |
682 | 323 |
[exEnd] |
307
b33b48f2a1a3
examples; protocol now compatible with PopUpList
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
324 |
|
b33b48f2a1a3
examples; protocol now compatible with PopUpList
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
325 |
|
b33b48f2a1a3
examples; protocol now compatible with PopUpList
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
326 |
|
b33b48f2a1a3
examples; protocol now compatible with PopUpList
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
327 |
|
b33b48f2a1a3
examples; protocol now compatible with PopUpList
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
328 |
with separate list- and indexHolders: |
682 | 329 |
[exBegin] |
307
b33b48f2a1a3
examples; protocol now compatible with PopUpList
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
330 |
|p selectionHolder listHolder| |
b33b48f2a1a3
examples; protocol now compatible with PopUpList
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
331 |
|
b33b48f2a1a3
examples; protocol now compatible with PopUpList
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
332 |
listHolder := #('apples' 'bananas' 'grape' 'lemon' 'margaritas') asValue. |
b33b48f2a1a3
examples; protocol now compatible with PopUpList
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
333 |
selectionHolder := 'apples' asValue. |
b33b48f2a1a3
examples; protocol now compatible with PopUpList
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
334 |
|
b33b48f2a1a3
examples; protocol now compatible with PopUpList
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
335 |
p := ComboListView label:'healthy fruit'. |
b33b48f2a1a3
examples; protocol now compatible with PopUpList
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
336 |
p listHolder:listHolder. |
310 | 337 |
p model:selectionHolder. |
682 | 338 |
p openAt:(Screen current center). |
307
b33b48f2a1a3
examples; protocol now compatible with PopUpList
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
339 |
selectionHolder inspect |
682 | 340 |
[exEnd] |
307
b33b48f2a1a3
examples; protocol now compatible with PopUpList
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
341 |
|
b33b48f2a1a3
examples; protocol now compatible with PopUpList
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
342 |
using different values: |
682 | 343 |
[exBegin] |
344 |
|p priceHolder listHolder prices priceField| |
|
307
b33b48f2a1a3
examples; protocol now compatible with PopUpList
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
345 |
|
b33b48f2a1a3
examples; protocol now compatible with PopUpList
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
346 |
listHolder := #('apples' 'bananas' 'grape' 'lemon' 'margaritas') asValue. |
682 | 347 |
prices := #(10 10 5 15 50). |
307
b33b48f2a1a3
examples; protocol now compatible with PopUpList
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
348 |
|
682 | 349 |
priceHolder := nil asValue. |
307
b33b48f2a1a3
examples; protocol now compatible with PopUpList
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
350 |
|
682 | 351 |
p := ComboListView new. |
307
b33b48f2a1a3
examples; protocol now compatible with PopUpList
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
352 |
p listHolder:listHolder. |
682 | 353 |
p model:priceHolder. |
354 |
p values:prices. |
|
355 |
p openAt:(Screen current center). |
|
356 |
||
357 |
priceField := EditField new. |
|
358 |
priceField readOnly:true. |
|
359 |
priceField model:(TypeConverter onNumberValue:priceHolder). |
|
360 |
priceField openAt:(Screen current center + (10@10)). |
|
361 |
[exEnd] |
|
307
b33b48f2a1a3
examples; protocol now compatible with PopUpList
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
362 |
|
b33b48f2a1a3
examples; protocol now compatible with PopUpList
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
363 |
|
131 | 364 |
in a dialog: |
682 | 365 |
[exBegin] |
131 | 366 |
|model1 model2 dialog b| |
367 |
||
368 |
model1 := 'foo' asValue. |
|
369 |
model2 := 'bar' asValue. |
|
370 |
||
371 |
dialog := Dialog new. |
|
372 |
(dialog addTextLabel:'ComboList example:') adjust:#left. |
|
373 |
dialog addVerticalSpace. |
|
374 |
||
375 |
(b := dialog addComboListOn:model1 tabable:true). |
|
376 |
b list:#('fee' 'foe' 'foo'). |
|
377 |
dialog addVerticalSpace. |
|
378 |
||
379 |
(b := dialog addComboListOn:model2 tabable:true). |
|
380 |
b list:#('bar' 'baz' 'baloo'). |
|
381 |
dialog addVerticalSpace. |
|
382 |
||
383 |
dialog addOkButton. |
|
384 |
||
385 |
dialog open. |
|
386 |
||
184 | 387 |
Transcript showCR:('1st comboBox''s value: ' , model1 value). |
388 |
Transcript showCR:('2nd comboBox''s value: ' , model2 value). |
|
682 | 389 |
[exEnd] |
131 | 390 |
" |
391 |
! ! |
|
392 |
||
307
b33b48f2a1a3
examples; protocol now compatible with PopUpList
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
393 |
!ComboListView class methodsFor:'defaults'! |
b33b48f2a1a3
examples; protocol now compatible with PopUpList
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
394 |
|
b33b48f2a1a3
examples; protocol now compatible with PopUpList
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
395 |
defaultAspectMessage |
b33b48f2a1a3
examples; protocol now compatible with PopUpList
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
396 |
^ #selection |
b33b48f2a1a3
examples; protocol now compatible with PopUpList
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
397 |
|
b33b48f2a1a3
examples; protocol now compatible with PopUpList
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
398 |
"Created: 27.2.1997 / 15:23:13 / cg" |
b33b48f2a1a3
examples; protocol now compatible with PopUpList
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
399 |
! |
b33b48f2a1a3
examples; protocol now compatible with PopUpList
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
400 |
|
b33b48f2a1a3
examples; protocol now compatible with PopUpList
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
401 |
defaultChangeMessage |
b33b48f2a1a3
examples; protocol now compatible with PopUpList
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
402 |
^ #selection: |
b33b48f2a1a3
examples; protocol now compatible with PopUpList
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
403 |
|
b33b48f2a1a3
examples; protocol now compatible with PopUpList
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
404 |
"Created: 27.2.1997 / 15:23:18 / cg" |
b33b48f2a1a3
examples; protocol now compatible with PopUpList
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
405 |
! ! |
b33b48f2a1a3
examples; protocol now compatible with PopUpList
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
406 |
|
231
3cb7dafa8cd2
allow index-passing (#useIndex:)
Claus Gittinger <cg@exept.de>
parents:
215
diff
changeset
|
407 |
!ComboListView methodsFor:'accessing-behavior'! |
3cb7dafa8cd2
allow index-passing (#useIndex:)
Claus Gittinger <cg@exept.de>
parents:
215
diff
changeset
|
408 |
|
501 | 409 |
useIndex |
410 |
"specify, if the selected components value or its index in the |
|
411 |
list should be sent to the model. The default is its value." |
|
412 |
||
413 |
^ useIndex |
|
414 |
! |
|
415 |
||
231
3cb7dafa8cd2
allow index-passing (#useIndex:)
Claus Gittinger <cg@exept.de>
parents:
215
diff
changeset
|
416 |
useIndex:aBoolean |
3cb7dafa8cd2
allow index-passing (#useIndex:)
Claus Gittinger <cg@exept.de>
parents:
215
diff
changeset
|
417 |
"specify, if the selected components value or its index in the |
3cb7dafa8cd2
allow index-passing (#useIndex:)
Claus Gittinger <cg@exept.de>
parents:
215
diff
changeset
|
418 |
list should be sent to the model. The default is its value." |
3cb7dafa8cd2
allow index-passing (#useIndex:)
Claus Gittinger <cg@exept.de>
parents:
215
diff
changeset
|
419 |
|
3cb7dafa8cd2
allow index-passing (#useIndex:)
Claus Gittinger <cg@exept.de>
parents:
215
diff
changeset
|
420 |
useIndex := aBoolean. |
682 | 421 |
|
684 | 422 |
"/ "/ change the aspectMessage - but only if it has not yet been |
423 |
"/ "/ changed explicitly |
|
424 |
"/ useIndex ifTrue:[ |
|
425 |
"/ changeMsg == #selection: ifTrue:[ |
|
426 |
"/ changeMsg := #selectionIndex:. |
|
427 |
"/ aspectMsg := #selectionIndex. |
|
428 |
"/ ] |
|
429 |
"/ ] ifFalse:[ |
|
430 |
"/ changeMsg == #selectionIndex: ifTrue:[ |
|
431 |
"/ changeMsg := #selection:. |
|
432 |
"/ aspectMsg := #selection. |
|
433 |
"/ ] |
|
434 |
"/ ]. |
|
231
3cb7dafa8cd2
allow index-passing (#useIndex:)
Claus Gittinger <cg@exept.de>
parents:
215
diff
changeset
|
435 |
|
3cb7dafa8cd2
allow index-passing (#useIndex:)
Claus Gittinger <cg@exept.de>
parents:
215
diff
changeset
|
436 |
"Created: 26.7.1996 / 17:44:18 / cg" |
679
bd0e422aab67
fixed model setting & useIndex: handling (aspect)
Claus Gittinger <cg@exept.de>
parents:
598
diff
changeset
|
437 |
"Modified: / 24.1.1998 / 19:06:41 / cg" |
307
b33b48f2a1a3
examples; protocol now compatible with PopUpList
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
438 |
! |
b33b48f2a1a3
examples; protocol now compatible with PopUpList
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
439 |
|
b33b48f2a1a3
examples; protocol now compatible with PopUpList
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
440 |
values:aCollection |
b33b48f2a1a3
examples; protocol now compatible with PopUpList
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
441 |
"specify, which values are to be stuffed into the model or |
b33b48f2a1a3
examples; protocol now compatible with PopUpList
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
442 |
passed via the actionBlock." |
b33b48f2a1a3
examples; protocol now compatible with PopUpList
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
443 |
|
b33b48f2a1a3
examples; protocol now compatible with PopUpList
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
444 |
values := aCollection. |
b33b48f2a1a3
examples; protocol now compatible with PopUpList
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
445 |
|
b33b48f2a1a3
examples; protocol now compatible with PopUpList
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
446 |
"Created: 27.2.1997 / 15:10:12 / cg" |
231
3cb7dafa8cd2
allow index-passing (#useIndex:)
Claus Gittinger <cg@exept.de>
parents:
215
diff
changeset
|
447 |
! ! |
3cb7dafa8cd2
allow index-passing (#useIndex:)
Claus Gittinger <cg@exept.de>
parents:
215
diff
changeset
|
448 |
|
131 | 449 |
!ComboListView methodsFor:'accessing-components'! |
450 |
||
451 |
label |
|
181 | 452 |
"return the label component" |
131 | 453 |
|
454 |
^ field |
|
455 |
||
456 |
"Modified: 28.2.1996 / 15:10:50 / cg" |
|
457 |
"Created: 28.2.1996 / 15:13:51 / cg" |
|
458 |
! ! |
|
459 |
||
215 | 460 |
!ComboListView methodsFor:'accessing-contents'! |
461 |
||
536 | 462 |
contents |
463 |
"get the current value - either in the fields model |
|
464 |
or directly" |
|
465 |
||
466 |
|m| |
|
467 |
||
468 |
(m := field model) notNil ifTrue:[ |
|
1295 | 469 |
^ m value |
536 | 470 |
] ifFalse:[ |
1295 | 471 |
^ field label |
536 | 472 |
] |
473 |
! |
|
474 |
||
215 | 475 |
contents:something |
272 | 476 |
"set the current value - either in the fields model |
477 |
or directly" |
|
478 |
||
215 | 479 |
|m| |
480 |
||
481 |
(m := field model) notNil ifTrue:[ |
|
1295 | 482 |
m value:something |
215 | 483 |
] ifFalse:[ |
1295 | 484 |
field label:something |
215 | 485 |
] |
486 |
||
487 |
"Created: 15.7.1996 / 13:16:49 / cg" |
|
272 | 488 |
"Modified: 5.1.1997 / 00:05:04 / cg" |
307
b33b48f2a1a3
examples; protocol now compatible with PopUpList
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
489 |
! |
b33b48f2a1a3
examples; protocol now compatible with PopUpList
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
490 |
|
b33b48f2a1a3
examples; protocol now compatible with PopUpList
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
491 |
selection:something |
b33b48f2a1a3
examples; protocol now compatible with PopUpList
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
492 |
"set the contents of my field; questionable" |
b33b48f2a1a3
examples; protocol now compatible with PopUpList
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
493 |
|
b33b48f2a1a3
examples; protocol now compatible with PopUpList
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
494 |
self contents:something |
b33b48f2a1a3
examples; protocol now compatible with PopUpList
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
495 |
|
b33b48f2a1a3
examples; protocol now compatible with PopUpList
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
496 |
"Created: 27.2.1997 / 15:07:37 / cg" |
215 | 497 |
! ! |
498 |
||
131 | 499 |
!ComboListView methodsFor:'initialization'! |
500 |
||
231
3cb7dafa8cd2
allow index-passing (#useIndex:)
Claus Gittinger <cg@exept.de>
parents:
215
diff
changeset
|
501 |
initialize |
3cb7dafa8cd2
allow index-passing (#useIndex:)
Claus Gittinger <cg@exept.de>
parents:
215
diff
changeset
|
502 |
useIndex isNil ifTrue:[useIndex := false]. |
307
b33b48f2a1a3
examples; protocol now compatible with PopUpList
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
503 |
|
231
3cb7dafa8cd2
allow index-passing (#useIndex:)
Claus Gittinger <cg@exept.de>
parents:
215
diff
changeset
|
504 |
super initialize. |
3cb7dafa8cd2
allow index-passing (#useIndex:)
Claus Gittinger <cg@exept.de>
parents:
215
diff
changeset
|
505 |
|
3cb7dafa8cd2
allow index-passing (#useIndex:)
Claus Gittinger <cg@exept.de>
parents:
215
diff
changeset
|
506 |
"Created: 26.7.1996 / 17:44:57 / cg" |
307
b33b48f2a1a3
examples; protocol now compatible with PopUpList
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
507 |
"Modified: 27.2.1997 / 15:23:24 / cg" |
231
3cb7dafa8cd2
allow index-passing (#useIndex:)
Claus Gittinger <cg@exept.de>
parents:
215
diff
changeset
|
508 |
! |
3cb7dafa8cd2
allow index-passing (#useIndex:)
Claus Gittinger <cg@exept.de>
parents:
215
diff
changeset
|
509 |
|
131 | 510 |
initializeField |
511 |
field := Label in:self. |
|
519 | 512 |
field level:-1; borderWidth:0. |
131 | 513 |
field adjust:#left. |
514 |
||
515 |
" |
|
516 |
|b| |
|
517 |
||
518 |
b := ComboListView new. |
|
519 |
b list:#('hello' 'world' 'this' 'is' 'st/x'). |
|
520 |
b open |
|
521 |
" |
|
522 |
||
523 |
"Created: 28.2.1996 / 15:13:46 / cg" |
|
524 |
"Modified: 28.2.1996 / 15:18:40 / cg" |
|
525 |
! ! |
|
526 |
||
215 | 527 |
!ComboListView methodsFor:'private'! |
528 |
||
529 |
getValueFromModel |
|
1206 | 530 |
|selection idx aspect newContents| |
278 | 531 |
|
307
b33b48f2a1a3
examples; protocol now compatible with PopUpList
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
532 |
(model notNil and:[aspectMsg notNil]) ifTrue:[ |
682 | 533 |
"/ kludge - try #value if aspect is the default and |
534 |
"/ not understood by the model |
|
535 |
"/ this allows a valueHolder to be used, even |
|
536 |
"/ if the aspectMessage was not setup correctly. |
|
309
f2ae122f6dad
allow use of a valueHolder, without setting change/aspect
Claus Gittinger <cg@exept.de>
parents:
307
diff
changeset
|
537 |
|
682 | 538 |
aspect := aspectMsg. |
539 |
aspect == self class defaultAspectMessage ifTrue:[ |
|
540 |
(model respondsTo:aspect) ifFalse:[ |
|
541 |
aspect := #value |
|
542 |
] |
|
543 |
]. |
|
544 |
||
1729 | 545 |
aspect == #value ifTrue:[ |
546 |
selection := model value |
|
547 |
] ifFalse:[ |
|
548 |
selection := model perform:aspect. |
|
549 |
]. |
|
309
f2ae122f6dad
allow use of a valueHolder, without setting change/aspect
Claus Gittinger <cg@exept.de>
parents:
307
diff
changeset
|
550 |
|
682 | 551 |
selection notNil ifTrue:[ |
552 |
values notNil ifTrue:[ |
|
553 |
idx := values indexOf:selection |
|
554 |
] ifFalse:[ |
|
555 |
useIndex ifTrue:[ |
|
556 |
idx := selection |
|
557 |
] ifFalse:[ |
|
558 |
self contents:selection. |
|
559 |
^ self. |
|
560 |
] |
|
561 |
]. |
|
307
b33b48f2a1a3
examples; protocol now compatible with PopUpList
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
562 |
|
1206 | 563 |
newContents := list at:idx ifAbsent:nil. |
564 |
]. |
|
565 |
self contents:newContents |
|
215 | 566 |
]. |
567 |
||
1729 | 568 |
"Created: / 15.7.1996 / 12:28:53 / cg" |
569 |
"Modified: / 1.3.2000 / 15:20:24 / cg" |
|
215 | 570 |
! ! |
571 |
||
291 | 572 |
!ComboListView methodsFor:'queries'! |
573 |
||
574 |
specClass |
|
598 | 575 |
"XXX no longer needed (inherited default works here)" |
576 |
||
291 | 577 |
self class == ComboListView ifTrue:[ |
1295 | 578 |
^ ComboListSpec |
291 | 579 |
]. |
301 | 580 |
^ super specClass |
291 | 581 |
|
598 | 582 |
"Modified: / 31.10.1997 / 19:49:34 / cg" |
291 | 583 |
! ! |
584 |
||
131 | 585 |
!ComboListView methodsFor:'user interaction'! |
586 |
||
307
b33b48f2a1a3
examples; protocol now compatible with PopUpList
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
587 |
select:anIndex |
b33b48f2a1a3
examples; protocol now compatible with PopUpList
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
588 |
"sent from the popped menu, when an item was selected" |
231
3cb7dafa8cd2
allow index-passing (#useIndex:)
Claus Gittinger <cg@exept.de>
parents:
215
diff
changeset
|
589 |
|
368 | 590 |
|label value chg| |
238 | 591 |
|
307
b33b48f2a1a3
examples; protocol now compatible with PopUpList
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
592 |
values isNil ifTrue:[ |
682 | 593 |
value := anIndex. |
594 |
useIndex ifFalse:[ |
|
595 |
value := list at:anIndex. |
|
596 |
] |
|
283
7441b4d65776
additional action hook - evaluated when selection changes
Claus Gittinger <cg@exept.de>
parents:
278
diff
changeset
|
597 |
] ifFalse:[ |
682 | 598 |
value := values at:anIndex |
283
7441b4d65776
additional action hook - evaluated when selection changes
Claus Gittinger <cg@exept.de>
parents:
278
diff
changeset
|
599 |
]. |
7441b4d65776
additional action hook - evaluated when selection changes
Claus Gittinger <cg@exept.de>
parents:
278
diff
changeset
|
600 |
|
307
b33b48f2a1a3
examples; protocol now compatible with PopUpList
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
601 |
label := list at:anIndex. |
b33b48f2a1a3
examples; protocol now compatible with PopUpList
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
602 |
|
b33b48f2a1a3
examples; protocol now compatible with PopUpList
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
603 |
field label:label. |
b33b48f2a1a3
examples; protocol now compatible with PopUpList
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
604 |
|
293
e707cc62ee30
first tell model - then evaluate action block.
Claus Gittinger <cg@exept.de>
parents:
291
diff
changeset
|
605 |
" |
e707cc62ee30
first tell model - then evaluate action block.
Claus Gittinger <cg@exept.de>
parents:
291
diff
changeset
|
606 |
ST-80 style model notification ... |
e707cc62ee30
first tell model - then evaluate action block.
Claus Gittinger <cg@exept.de>
parents:
291
diff
changeset
|
607 |
this updates the model (typically, a ValueHolder) |
e707cc62ee30
first tell model - then evaluate action block.
Claus Gittinger <cg@exept.de>
parents:
291
diff
changeset
|
608 |
" |
309
f2ae122f6dad
allow use of a valueHolder, without setting change/aspect
Claus Gittinger <cg@exept.de>
parents:
307
diff
changeset
|
609 |
(model notNil and:[changeMsg notNil]) ifTrue:[ |
682 | 610 |
"/ kludge - try #value: if changeMsg is the default and |
611 |
"/ not understood by the model |
|
612 |
"/ this allows a valueHolder to be used, even |
|
613 |
"/ if the aspectMessage was not setup correctly. |
|
309
f2ae122f6dad
allow use of a valueHolder, without setting change/aspect
Claus Gittinger <cg@exept.de>
parents:
307
diff
changeset
|
614 |
|
682 | 615 |
chg := changeMsg. |
616 |
chg == self class defaultChangeMessage ifTrue:[ |
|
617 |
(model respondsTo:chg) ifFalse:[ |
|
618 |
chg := #value: |
|
619 |
] |
|
620 |
]. |
|
309
f2ae122f6dad
allow use of a valueHolder, without setting change/aspect
Claus Gittinger <cg@exept.de>
parents:
307
diff
changeset
|
621 |
|
682 | 622 |
self sendChangeMessage:chg with:value |
231
3cb7dafa8cd2
allow index-passing (#useIndex:)
Claus Gittinger <cg@exept.de>
parents:
215
diff
changeset
|
623 |
]. |
131 | 624 |
pullDownButton turnOff. |
625 |
||
293
e707cc62ee30
first tell model - then evaluate action block.
Claus Gittinger <cg@exept.de>
parents:
291
diff
changeset
|
626 |
" |
e707cc62ee30
first tell model - then evaluate action block.
Claus Gittinger <cg@exept.de>
parents:
291
diff
changeset
|
627 |
ST/X style actionBlock evaluation ... |
e707cc62ee30
first tell model - then evaluate action block.
Claus Gittinger <cg@exept.de>
parents:
291
diff
changeset
|
628 |
" |
283
7441b4d65776
additional action hook - evaluated when selection changes
Claus Gittinger <cg@exept.de>
parents:
278
diff
changeset
|
629 |
action notNil ifTrue:[ |
682 | 630 |
action value:value |
283
7441b4d65776
additional action hook - evaluated when selection changes
Claus Gittinger <cg@exept.de>
parents:
278
diff
changeset
|
631 |
]. |
7441b4d65776
additional action hook - evaluated when selection changes
Claus Gittinger <cg@exept.de>
parents:
278
diff
changeset
|
632 |
|
307
b33b48f2a1a3
examples; protocol now compatible with PopUpList
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
633 |
"Created: 27.2.1997 / 15:18:44 / cg" |
310 | 634 |
"Modified: 28.2.1997 / 13:50:17 / cg" |
131 | 635 |
! ! |
636 |
||
270 | 637 |
!ComboListView class methodsFor:'documentation'! |
131 | 638 |
|
639 |
version |
|
1826 | 640 |
^ '$Header: /cvs/stx/stx/libwidg2/ComboListView.st,v 1.37 2000-09-01 10:14:51 cg Exp $' |
131 | 641 |
! ! |