author | Claus Gittinger <cg@exept.de> |
Sun, 31 Oct 2010 13:01:12 +0100 | |
changeset 4187 | 16652b9859a7 |
parent 4166 | b47c8508abbe |
child 4298 | 331907254f82 |
permissions | -rw-r--r-- |
0 | 1 |
" |
5 | 2 |
COPYRIGHT (c) 1990 by Claus Gittinger |
59 | 3 |
All Rights Reserved |
0 | 4 |
|
5 |
This software is furnished under a license and may be used |
|
6 |
only in accordance with the terms of that license and with the |
|
7 |
inclusion of the above copyright notice. This software may not |
|
8 |
be provided or otherwise made available to, or used by, any |
|
9 |
other person. No title to or ownership of the software is |
|
10 |
hereby transferred. |
|
11 |
" |
|
2261
260a8cd9905d
added a selectionChanged callback
Claus Gittinger <cg@exept.de>
parents:
1281
diff
changeset
|
12 |
"{ Package: 'stx:libwidg' }" |
260a8cd9905d
added a selectionChanged callback
Claus Gittinger <cg@exept.de>
parents:
1281
diff
changeset
|
13 |
|
0 | 14 |
EnterBox subclass:#ListSelectionBox |
2545 | 15 |
instanceVariableNames:'selectionList selectionChangeCallback useIndex' |
371 | 16 |
classVariableNames:'' |
17 |
poolDictionaries:'' |
|
18 |
category:'Views-DialogBoxes' |
|
0 | 19 |
! |
20 |
||
1273 | 21 |
!ListSelectionBox class methodsFor:'documentation'! |
38 | 22 |
|
23 |
copyright |
|
24 |
" |
|
25 |
COPYRIGHT (c) 1990 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 |
! |
|
0 | 36 |
|
38 | 37 |
documentation |
38 |
" |
|
39 |
this class implements boxes for selection from a list. It offers |
|
40 |
both an ok- and abort-buttons. The ok-button, if pressed will |
|
41 |
evaluate the okAction (see EnterBox>>action). |
|
77 | 42 |
see examples for typical uses. |
43 |
||
44 |
Notice, for file selections there is a specialized FileSelectionBox, |
|
45 |
which supports matchPatterns, changing directory etc. |
|
585 | 46 |
|
47 |
[author:] |
|
48 |
Claus Gittinger |
|
77 | 49 |
" |
50 |
! |
|
51 |
||
52 |
examples |
|
53 |
" |
|
54 |
simple: |
|
593 | 55 |
[exBegin] |
56 |
|box| |
|
38 | 57 |
|
593 | 58 |
box := ListSelectionBox new. |
59 |
box title:'select something:'. |
|
60 |
box list:#('foo' 'bar' 'baz'). |
|
2543 | 61 |
box okAction:[:sel | Transcript show:'the selection was:' ; showCR:sel]. |
593 | 62 |
box showAtPointer |
63 |
[exEnd] |
|
77 | 64 |
|
2541 | 65 |
with index (instead of list-entry) and without an enterField: |
66 |
[exBegin] |
|
67 |
|box| |
|
68 |
||
69 |
box := ListSelectionBox new. |
|
70 |
box title:'select something:'. |
|
71 |
box list:#('foo' 'bar' 'baz'). |
|
72 |
box useIndex:true. |
|
73 |
box okAction:[:sel | Transcript show:'the selection was:' ; showCR:sel]. |
|
74 |
box showAtPointer |
|
75 |
[exEnd] |
|
76 |
||
155 | 77 |
|
77 | 78 |
with a default: |
593 | 79 |
[exBegin] |
80 |
|box| |
|
77 | 81 |
|
593 | 82 |
box := ListSelectionBox new. |
83 |
box title:'select something:'. |
|
84 |
box list:#('foo' 'bar' 'baz'). |
|
2543 | 85 |
box okAction:[:sel | Transcript show:'the selection was:' ; showCR:sel]. |
593 | 86 |
box initialText:'foo'. |
87 |
box showAtPointer |
|
88 |
[exEnd] |
|
155 | 89 |
|
90 |
||
91 |
opening the box modeless (a stand-by box): |
|
92 |
(in this case, the default ok- and abortActions do not hide the box; |
|
93 |
therefore, we have to set those explicitely) |
|
593 | 94 |
[exBegin] |
95 |
|box| |
|
155 | 96 |
|
593 | 97 |
box := ListSelectionBox new. |
98 |
box title:'select something:'. |
|
99 |
box list:#('foo' 'bar' 'baz'). |
|
100 |
box abortText:'close'. |
|
101 |
box okText:'apply'. |
|
2543 | 102 |
box okAction:[:sel | Transcript show:'the selection was:' ; showCR:sel]. |
593 | 103 |
box abortAction:[:dummy | box hide]. |
104 |
box openModeless |
|
105 |
[exEnd] |
|
2280
d9ee8906706e
scroll to make the typed-in string visible in the list (if present)
Claus Gittinger <cg@exept.de>
parents:
2261
diff
changeset
|
106 |
|
d9ee8906706e
scroll to make the typed-in string visible in the list (if present)
Claus Gittinger <cg@exept.de>
parents:
2261
diff
changeset
|
107 |
showing fileNames: |
d9ee8906706e
scroll to make the typed-in string visible in the list (if present)
Claus Gittinger <cg@exept.de>
parents:
2261
diff
changeset
|
108 |
[exBegin] |
d9ee8906706e
scroll to make the typed-in string visible in the list (if present)
Claus Gittinger <cg@exept.de>
parents:
2261
diff
changeset
|
109 |
|box| |
d9ee8906706e
scroll to make the typed-in string visible in the list (if present)
Claus Gittinger <cg@exept.de>
parents:
2261
diff
changeset
|
110 |
|
d9ee8906706e
scroll to make the typed-in string visible in the list (if present)
Claus Gittinger <cg@exept.de>
parents:
2261
diff
changeset
|
111 |
box := ListSelectionBox new. |
d9ee8906706e
scroll to make the typed-in string visible in the list (if present)
Claus Gittinger <cg@exept.de>
parents:
2261
diff
changeset
|
112 |
box title:'select something:'. |
d9ee8906706e
scroll to make the typed-in string visible in the list (if present)
Claus Gittinger <cg@exept.de>
parents:
2261
diff
changeset
|
113 |
box list:('.' asFilename directoryContents). |
2543 | 114 |
box okAction:[:sel | Transcript show:'the selection was:' ; showCR:sel]. |
2280
d9ee8906706e
scroll to make the typed-in string visible in the list (if present)
Claus Gittinger <cg@exept.de>
parents:
2261
diff
changeset
|
115 |
box showAtPointer |
d9ee8906706e
scroll to make the typed-in string visible in the list (if present)
Claus Gittinger <cg@exept.de>
parents:
2261
diff
changeset
|
116 |
[exEnd] |
d9ee8906706e
scroll to make the typed-in string visible in the list (if present)
Claus Gittinger <cg@exept.de>
parents:
2261
diff
changeset
|
117 |
|
d9ee8906706e
scroll to make the typed-in string visible in the list (if present)
Claus Gittinger <cg@exept.de>
parents:
2261
diff
changeset
|
118 |
|
38 | 119 |
" |
197 | 120 |
! ! |
121 |
||
1273 | 122 |
!ListSelectionBox class methodsFor:'instance creation'! |
197 | 123 |
|
124 |
title:titleString okText:okText abortText:abortText list:aList action:aBlock |
|
125 |
"create and return a new listSelectionBox with list already defined" |
|
126 |
||
127 |
|newBox| |
|
128 |
||
2543 | 129 |
newBox := self |
130 |
title:titleString okText:okText abortText:abortText |
|
131 |
action:aBlock. |
|
132 |
newBox list:aList. |
|
133 |
^ newBox |
|
38 | 134 |
! ! |
0 | 135 |
|
1273 | 136 |
!ListSelectionBox class methodsFor:'defaults'! |
0 | 137 |
|
138 |
defaultExtent |
|
571 | 139 |
"return the default extent of my instances. |
140 |
The value returned here is usually ignored, and |
|
141 |
the value from preferredExtent taken instead." |
|
142 |
||
775
ccc53ba319bc
dont ask Display for defaultExtent - ask current screen
Claus Gittinger <cg@exept.de>
parents:
740
diff
changeset
|
143 |
^ (Screen current pixelPerMillimeter * (80 @ 100)) rounded |
571 | 144 |
|
775
ccc53ba319bc
dont ask Display for defaultExtent - ask current screen
Claus Gittinger <cg@exept.de>
parents:
740
diff
changeset
|
145 |
"Modified: 5.7.1996 / 13:53:46 / cg" |
12 | 146 |
! |
147 |
||
148 |
listViewType |
|
149 |
"return the type of listView |
|
150 |
- for easier redefinition in subclasses" |
|
151 |
||
152 |
^ SelectionInListView |
|
0 | 153 |
! ! |
154 |
||
197 | 155 |
!ListSelectionBox methodsFor:'accessing'! |
156 |
||
402
ed4a635f43c6
oops - fixed access to non existing enterField (if noEnterField)
Claus Gittinger <cg@exept.de>
parents:
371
diff
changeset
|
157 |
contents |
ed4a635f43c6
oops - fixed access to non existing enterField (if noEnterField)
Claus Gittinger <cg@exept.de>
parents:
371
diff
changeset
|
158 |
"return my contents" |
ed4a635f43c6
oops - fixed access to non existing enterField (if noEnterField)
Claus Gittinger <cg@exept.de>
parents:
371
diff
changeset
|
159 |
|
ed4a635f43c6
oops - fixed access to non existing enterField (if noEnterField)
Claus Gittinger <cg@exept.de>
parents:
371
diff
changeset
|
160 |
enterField isNil ifTrue:[ |
ed4a635f43c6
oops - fixed access to non existing enterField (if noEnterField)
Claus Gittinger <cg@exept.de>
parents:
371
diff
changeset
|
161 |
^ selectionList selectionValue |
ed4a635f43c6
oops - fixed access to non existing enterField (if noEnterField)
Claus Gittinger <cg@exept.de>
parents:
371
diff
changeset
|
162 |
]. |
ed4a635f43c6
oops - fixed access to non existing enterField (if noEnterField)
Claus Gittinger <cg@exept.de>
parents:
371
diff
changeset
|
163 |
^ super contents |
ed4a635f43c6
oops - fixed access to non existing enterField (if noEnterField)
Claus Gittinger <cg@exept.de>
parents:
371
diff
changeset
|
164 |
|
ed4a635f43c6
oops - fixed access to non existing enterField (if noEnterField)
Claus Gittinger <cg@exept.de>
parents:
371
diff
changeset
|
165 |
"Created: 26.2.1996 / 20:05:47 / cg" |
ed4a635f43c6
oops - fixed access to non existing enterField (if noEnterField)
Claus Gittinger <cg@exept.de>
parents:
371
diff
changeset
|
166 |
! |
ed4a635f43c6
oops - fixed access to non existing enterField (if noEnterField)
Claus Gittinger <cg@exept.de>
parents:
371
diff
changeset
|
167 |
|
3048 | 168 |
initialSelection:selected |
169 |
"select some item in the list" |
|
170 |
||
171 |
||
172 |
selectionList selection:selected |
|
173 |
! |
|
174 |
||
2444 | 175 |
initialText:someString selected:selected |
176 |
"in addition to showing the initial text; optionally also select it in the list" |
|
0 | 177 |
|
2444 | 178 |
super initialText:someString selected:selected. |
179 |
selected ifTrue:[ |
|
180 |
selectionList setSelectElement:someString |
|
181 |
]. |
|
690 | 182 |
|
183 |
"Modified: 26.5.1996 / 15:03:37 / cg" |
|
197 | 184 |
! |
185 |
||
186 |
list:aList |
|
187 |
"set the list to be displayed in selection list" |
|
188 |
||
189 |
selectionList list:aList |
|
841 | 190 |
! |
191 |
||
2261
260a8cd9905d
added a selectionChanged callback
Claus Gittinger <cg@exept.de>
parents:
1281
diff
changeset
|
192 |
selectionChangeCallback:aBlock |
2359 | 193 |
"allows special actions to be hooked in, when the selection changes" |
2261
260a8cd9905d
added a selectionChanged callback
Claus Gittinger <cg@exept.de>
parents:
1281
diff
changeset
|
194 |
|
260a8cd9905d
added a selectionChanged callback
Claus Gittinger <cg@exept.de>
parents:
1281
diff
changeset
|
195 |
selectionChangeCallback := aBlock. |
260a8cd9905d
added a selectionChanged callback
Claus Gittinger <cg@exept.de>
parents:
1281
diff
changeset
|
196 |
! |
260a8cd9905d
added a selectionChanged callback
Claus Gittinger <cg@exept.de>
parents:
1281
diff
changeset
|
197 |
|
841 | 198 |
selectionIndex |
199 |
^ selectionList selection |
|
200 |
||
201 |
"Created: 14.10.1996 / 16:28:50 / cg" |
|
2958 | 202 |
! |
203 |
||
204 |
selectionList |
|
205 |
||
206 |
^selectionList |
|
2546 | 207 |
! ! |
208 |
||
209 |
!ListSelectionBox methodsFor:'accessing-behavior'! |
|
2541 | 210 |
|
211 |
useIndex:aBoolean |
|
212 |
aBoolean ifTrue:[ |
|
213 |
self noEnterField |
|
214 |
]. |
|
2545 | 215 |
useIndex := aBoolean |
197 | 216 |
! ! |
0 | 217 |
|
197 | 218 |
!ListSelectionBox methodsFor:'accessing-components'! |
219 |
||
220 |
listView |
|
221 |
"return the listView component" |
|
222 |
||
223 |
^ selectionList |
|
0 | 224 |
|
197 | 225 |
"Created: 26.10.1995 / 17:08:32 / cg" |
226 |
! ! |
|
227 |
||
228 |
!ListSelectionBox methodsFor:'accessing-look'! |
|
229 |
||
230 |
noEnterField |
|
638 | 231 |
"suppress the enterField - now only existing items are selectable; |
232 |
the default is to present an enterField." |
|
233 |
||
197 | 234 |
enterField destroy. |
235 |
enterField := nil |
|
236 |
||
237 |
"Created: 26.10.1995 / 17:12:38 / cg" |
|
638 | 238 |
"Modified: 12.5.1996 / 21:49:14 / cg" |
2556 | 239 |
! |
240 |
||
241 |
useComboBoxWithList:list |
|
242 |
"change the enterField to be a ComboList" |
|
243 |
||
244 |
self addEnterField:(ComboBoxView new). |
|
245 |
enterField leaveAction:[:key | self okPressed]. |
|
246 |
enterField list:list. |
|
0 | 247 |
! ! |
248 |
||
249 |
!ListSelectionBox methodsFor:'initialization'! |
|
250 |
||
251 |
initialize |
|
1281 | 252 |
|space2 halfSpace v vbw| |
0 | 253 |
|
254 |
super initialize. |
|
255 |
||
2545 | 256 |
useIndex := false. |
4166 | 257 |
"/ label := resources string:'Select or Enter'. |
258 |
label := resources string:'Please Select'. |
|
77 | 259 |
|
0 | 260 |
"need more space than an enterBox" |
261 |
||
262 |
"self height:(height + (font height * 5)). " |
|
263 |
||
264 |
space2 := 2 * ViewSpacing. |
|
125 | 265 |
halfSpace := ViewSpacing // 2. |
0 | 266 |
|
2295 | 267 |
v := HVScrollableView for:(self class listViewType) in:self. |
268 |
v horizontalScrollable:true; horizontalMini:true; autoHideHorizontalScrollBar:true. |
|
0 | 269 |
|
132 | 270 |
"/ old: |
271 |
"/ v origin:[0.0 |
|
125 | 272 |
"/ @ |
132 | 273 |
"/ (enterField origin y + enterField height + ViewSpacing)] |
274 |
"/ extent:[1.0 |
|
125 | 275 |
"/ @ |
132 | 276 |
"/ (height |
125 | 277 |
"/ - ViewSpacing - labelField heightIncludingBorder |
278 |
"/ - ViewSpacing - enterField heightIncludingBorder |
|
279 |
"/ - buttonPanel heightIncludingBorder - ViewSpacing |
|
280 |
"/ - space2) |
|
132 | 281 |
"/ ]. |
282 |
||
283 |
"/ new: |
|
166 | 284 |
v origin:[enterField notNil ifTrue:[ |
412 | 285 |
0.0 @ (enterField origin y + enterField height + ViewSpacing) |
286 |
] ifFalse:[ |
|
287 |
0.0 @ (labelField origin y + labelField height + ViewSpacing) |
|
288 |
] |
|
289 |
] |
|
132 | 290 |
corner:(1.0 @ 1.0). |
3611
a1654baf3f37
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3048
diff
changeset
|
291 |
v bottomInset:(buttonPanel preferredHeight + ViewSpacing). |
132 | 292 |
|
139 | 293 |
vbw := v borderWidth. |
294 |
v leftInset:halfSpace+vbw; |
|
295 |
rightInset:halfSpace+vbw. |
|
110 | 296 |
|
0 | 297 |
selectionList := v scrolledView. |
740
2d5cb01c7e11
no need for focusSequence - DialogBox does it
Claus Gittinger <cg@exept.de>
parents:
724
diff
changeset
|
298 |
self makeTabable:selectionList. |
0 | 299 |
|
300 |
"self updateList." |
|
301 |
||
724 | 302 |
"I am interested in what is done in the selectionList |
132 | 303 |
(could also create a SelectionInList-model and catch its changes ...)" |
304 |
selectionList action:[:lineNr | self selectionChanged]. |
|
305 |
selectionList doubleClickAction:[:lineNr | self doubleClick]. |
|
306 |
||
2511
639be3067ff8
suppress focus from going to listView.
Claus Gittinger <cg@exept.de>
parents:
2500
diff
changeset
|
307 |
selectionList doNotRequestFocusOnPointerEnter:true. |
639be3067ff8
suppress focus from going to listView.
Claus Gittinger <cg@exept.de>
parents:
2500
diff
changeset
|
308 |
|
130 | 309 |
enterField removeDependent:self. "dont want preferredExtent-changes" |
128 | 310 |
|
2280
d9ee8906706e
scroll to make the typed-in string visible in the list (if present)
Claus Gittinger <cg@exept.de>
parents:
2261
diff
changeset
|
311 |
enterField immediateAccept:true. |
d9ee8906706e
scroll to make the typed-in string visible in the list (if present)
Claus Gittinger <cg@exept.de>
parents:
2261
diff
changeset
|
312 |
enterField acceptAction: |
d9ee8906706e
scroll to make the typed-in string visible in the list (if present)
Claus Gittinger <cg@exept.de>
parents:
2261
diff
changeset
|
313 |
[:text | |string index| |
2282 | 314 |
enterField notNil ifTrue:[ |
315 |
string := enterField contents. |
|
316 |
"/ find the first list-entry, starting with entered text |
|
4088 | 317 |
index := (selectionList list ? #()) findFirst:[:line | (line ? '') string startsWith:string string]. |
2282 | 318 |
index ~~ 0 ifTrue:[ |
2659
abd630c5a9fc
scrollToLine instead of makeLineVisible
Claus Gittinger <cg@exept.de>
parents:
2556
diff
changeset
|
319 |
selectionList scrollToLine:index "/ makeLineVisible:index. |
2282 | 320 |
]. |
2280
d9ee8906706e
scroll to make the typed-in string visible in the list (if present)
Claus Gittinger <cg@exept.de>
parents:
2261
diff
changeset
|
321 |
]. |
d9ee8906706e
scroll to make the typed-in string visible in the list (if present)
Claus Gittinger <cg@exept.de>
parents:
2261
diff
changeset
|
322 |
]. |
d9ee8906706e
scroll to make the typed-in string visible in the list (if present)
Claus Gittinger <cg@exept.de>
parents:
2261
diff
changeset
|
323 |
|
38 | 324 |
" |
325 |
mhm: the lists keyboard functions are disabled, |
|
319
d78f5fbdee27
dont forward Cursor-motion to the enterField
Claus Gittinger <cg@exept.de>
parents:
243
diff
changeset
|
326 |
and input passed to the enterfield (except cursor keys) |
38 | 327 |
" |
319
d78f5fbdee27
dont forward Cursor-motion to the enterField
Claus Gittinger <cg@exept.de>
parents:
243
diff
changeset
|
328 |
selectionList delegate:( |
412 | 329 |
KeyboardForwarder |
330 |
toView:enterField |
|
331 |
condition:#noFocus |
|
332 |
filter:[:key | (key ~~ #CursorUp) and:[key ~~ #CursorDown]] |
|
333 |
) |
|
166 | 334 |
|
4166 | 335 |
"Modified: / 25-08-2010 / 22:01:48 / cg" |
0 | 336 |
! |
337 |
||
1273 | 338 |
postRealize |
339 |
"update the list now. |
|
638 | 340 |
This was not done in #initialize to allow settings to be changed before, |
341 |
in case list-updating is a slow operation - such as reading a directory" |
|
342 |
||
1273 | 343 |
super postRealize. |
0 | 344 |
self updateList. |
638 | 345 |
|
346 |
"Modified: 12.5.1996 / 21:50:50 / cg" |
|
1273 | 347 |
"Created: 24.7.1997 / 18:22:19 / cg" |
77 | 348 |
! |
349 |
||
197 | 350 |
updateList |
638 | 351 |
"setup contents of list; |
352 |
nothing done here but typically redefined in subclasses." |
|
197 | 353 |
|
354 |
^ self |
|
638 | 355 |
|
356 |
"Modified: 12.5.1996 / 21:51:10 / cg" |
|
0 | 357 |
! ! |
358 |
||
59 | 359 |
!ListSelectionBox methodsFor:'queries'! |
0 | 360 |
|
130 | 361 |
preferredExtent |
362 |
"return my preferred extent - thats the minimum size |
|
125 | 363 |
I like to have, to make everything visible" |
0 | 364 |
|
2500
fc1ee2b3fa81
ListSelectionBox is at least as wide as its buttonPanel.
Stefan Vogel <sv@exept.de>
parents:
2444
diff
changeset
|
365 |
|wWanted hWanted eH mm bw| |
371 | 366 |
|
3759
0318021891be
changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents:
3611
diff
changeset
|
367 |
"/ If I have an explicit preferredExtent.. |
0318021891be
changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents:
3611
diff
changeset
|
368 |
explicitExtent notNil ifTrue:[ |
0318021891be
changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents:
3611
diff
changeset
|
369 |
^ explicitExtent |
0318021891be
changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents:
3611
diff
changeset
|
370 |
]. |
799 | 371 |
|
3759
0318021891be
changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents:
3611
diff
changeset
|
372 |
"/ If I have a cached preferredExtent value.. |
713
0c38ad51016d
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
690
diff
changeset
|
373 |
preferredExtent notNil ifTrue:[ |
0c38ad51016d
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
690
diff
changeset
|
374 |
^ preferredExtent |
0c38ad51016d
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
690
diff
changeset
|
375 |
]. |
0c38ad51016d
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
690
diff
changeset
|
376 |
|
371 | 377 |
mm := ViewSpacing. |
125 | 378 |
|
371 | 379 |
wWanted := mm + labelField width + mm. |
0 | 380 |
(wWanted > width) ifFalse:[ |
371 | 381 |
wWanted := width |
0 | 382 |
]. |
3611
a1654baf3f37
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3048
diff
changeset
|
383 |
bw := buttonPanel preferredWidth. |
2500
fc1ee2b3fa81
ListSelectionBox is at least as wide as its buttonPanel.
Stefan Vogel <sv@exept.de>
parents:
2444
diff
changeset
|
384 |
bw > wWanted ifTrue:[ |
fc1ee2b3fa81
ListSelectionBox is at least as wide as its buttonPanel.
Stefan Vogel <sv@exept.de>
parents:
2444
diff
changeset
|
385 |
wWanted := bw. |
fc1ee2b3fa81
ListSelectionBox is at least as wide as its buttonPanel.
Stefan Vogel <sv@exept.de>
parents:
2444
diff
changeset
|
386 |
]. |
125 | 387 |
|
166 | 388 |
enterField notNil ifTrue:[ |
371 | 389 |
eH := enterField height + mm |
166 | 390 |
] ifFalse:[ |
371 | 391 |
eH := 0 |
166 | 392 |
]. |
371 | 393 |
hWanted := mm + labelField height + |
394 |
eH + |
|
395 |
mm + selectionList height + |
|
3611
a1654baf3f37
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3048
diff
changeset
|
396 |
mm + buttonPanel preferredHeight + |
371 | 397 |
mm - (mm * 2). |
0 | 398 |
|
399 |
(hWanted < height) ifTrue:[ |
|
371 | 400 |
hWanted := height |
0 | 401 |
]. |
59 | 402 |
^ (wWanted @ hWanted) |
166 | 403 |
|
799 | 404 |
"Modified: 19.7.1996 / 20:44:52 / cg" |
0 | 405 |
! ! |
406 |
||
132 | 407 |
!ListSelectionBox methodsFor:'user actions'! |
408 |
||
2541 | 409 |
actionArgument |
2545 | 410 |
useIndex ifTrue:[ |
2541 | 411 |
^self selectionIndex. |
412 |
]. |
|
413 |
^ super actionArgument |
|
414 |
! |
|
415 |
||
197 | 416 |
doubleClick |
417 |
"doubleClick on an entry is select & ok" |
|
418 |
||
402
ed4a635f43c6
oops - fixed access to non existing enterField (if noEnterField)
Claus Gittinger <cg@exept.de>
parents:
371
diff
changeset
|
419 |
enterField notNil ifTrue:[ |
ed4a635f43c6
oops - fixed access to non existing enterField (if noEnterField)
Claus Gittinger <cg@exept.de>
parents:
371
diff
changeset
|
420 |
enterField contents:(selectionList selectionValue). |
ed4a635f43c6
oops - fixed access to non existing enterField (if noEnterField)
Claus Gittinger <cg@exept.de>
parents:
371
diff
changeset
|
421 |
]. |
197 | 422 |
self okPressed |
402
ed4a635f43c6
oops - fixed access to non existing enterField (if noEnterField)
Claus Gittinger <cg@exept.de>
parents:
371
diff
changeset
|
423 |
|
ed4a635f43c6
oops - fixed access to non existing enterField (if noEnterField)
Claus Gittinger <cg@exept.de>
parents:
371
diff
changeset
|
424 |
"Modified: 26.2.1996 / 20:05:45 / cg" |
197 | 425 |
! |
426 |
||
132 | 427 |
selectionChanged |
428 |
"selections in list get forwarded to enterfield" |
|
429 |
||
166 | 430 |
enterField notNil ifTrue:[ |
2261
260a8cd9905d
added a selectionChanged callback
Claus Gittinger <cg@exept.de>
parents:
1281
diff
changeset
|
431 |
enterField contents:(selectionList selectionValue) |
260a8cd9905d
added a selectionChanged callback
Claus Gittinger <cg@exept.de>
parents:
1281
diff
changeset
|
432 |
]. |
260a8cd9905d
added a selectionChanged callback
Claus Gittinger <cg@exept.de>
parents:
1281
diff
changeset
|
433 |
selectionChangeCallback notNil ifTrue:[ |
260a8cd9905d
added a selectionChanged callback
Claus Gittinger <cg@exept.de>
parents:
1281
diff
changeset
|
434 |
selectionChangeCallback value:selectionList selection |
260a8cd9905d
added a selectionChanged callback
Claus Gittinger <cg@exept.de>
parents:
1281
diff
changeset
|
435 |
]. |
166 | 436 |
|
437 |
"Modified: 26.10.1995 / 17:20:06 / cg" |
|
438 |
! ! |
|
439 |
||
1273 | 440 |
!ListSelectionBox class methodsFor:'documentation'! |
243 | 441 |
|
442 |
version |
|
4166 | 443 |
^ '$Header: /cvs/stx/stx/libwidg/ListSelectionBox.st,v 1.60 2010-08-25 20:02:37 cg Exp $' |
4088 | 444 |
! |
445 |
||
446 |
version_CVS |
|
4166 | 447 |
^ '$Header: /cvs/stx/stx/libwidg/ListSelectionBox.st,v 1.60 2010-08-25 20:02:37 cg Exp $' |
243 | 448 |
! ! |