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