46 "return the selections value (i.e. the entry numbers in the list)" |
46 "return the selections value (i.e. the entry numbers in the list)" |
47 |
47 |
48 |l| |
48 |l| |
49 |
49 |
50 l := self list. |
50 l := self list. |
51 l isNil ifTrue:[^ 0]. "/ mhmh - no list; what should we do here ? |
51 l isNil ifTrue:[^ self zeroIndex]. "/ mhmh - no list; what should we do here ? |
52 |
52 |
53 ^ selectionIndexHolder value |
53 ^ selectionIndexHolder value |
54 collect:[:index | |
54 collect:[:index | |
55 l at:index |
55 l at:index |
56 ] |
56 ] |
57 |
57 |
58 "Created: 26.10.1995 / 16:52:27 / cg" |
58 "Created: 26.10.1995 / 16:52:27 / cg" |
59 "Modified: 16.4.1996 / 15:52:57 / cg" |
59 "Modified: 20.4.1996 / 13:14:29 / cg" |
60 ! |
60 ! |
61 |
61 |
62 selection:anObjectList |
62 selection:anObjectList |
63 "set the selection to be anObjectList." |
63 "set the selection to be anObjectList." |
64 |
64 |
80 |
80 |
81 "Created: 26.10.1995 / 16:40:24 / cg" |
81 "Created: 26.10.1995 / 16:40:24 / cg" |
82 "Modified: 16.4.1996 / 15:53:03 / cg" |
82 "Modified: 16.4.1996 / 15:53:03 / cg" |
83 ! ! |
83 ! ! |
84 |
84 |
85 !MultiSelectionInList methodsFor:'initialization'! |
85 !MultiSelectionInList methodsFor:'queries'! |
86 |
86 |
87 initialize |
87 zeroIndex |
88 self listHolder:(nil asValue). "/ could also use an empty collection here |
88 "return the selectionIndex returned when nothing is selected. |
89 self selectionIndexHolder:(Array new asValue). |
89 Here, an empty collection is returned." |
90 |
90 |
91 "Created: 26.10.1995 / 16:30:22 / cg" |
91 ^ Array new |
92 ! ! |
|
93 |
92 |
94 !MultiSelectionInList methodsFor:'private'! |
93 "Modified: 20.4.1996 / 13:12:58 / cg" |
95 |
|
96 clearSelection |
|
97 selectionIndexHolder setValue:(Array new). |
|
98 |
|
99 |
|
100 ! ! |
94 ! ! |
101 |
95 |
102 !MultiSelectionInList methodsFor:'selections'! |
96 !MultiSelectionInList methodsFor:'selections'! |
103 |
97 |
104 selections |
98 selections |
105 |selectionIndices| |
99 |selectionIndices| |
106 |
100 |
107 selectionIndices := selectionIndexHolder value. |
101 selectionIndices := selectionIndexHolder value. |
108 (selectionIndices isNil |
102 (selectionIndices isNil |
109 or:[selectionIndices == 0 |
103 or:[selectionIndices == 0 |
110 or:[selectionIndices isEmpty]]) ifFalse:[ |
104 or:[selectionIndices isEmpty]]) ifFalse:[ |
111 ^ selectionIndices collect:[:index | listHolder value at:index] |
105 ^ selectionIndices collect:[:index | listHolder value at:index] |
112 ]. |
106 ]. |
113 ^ Array new |
107 ^ Array new |
114 |
108 |
115 "Modified: 16.4.1996 / 12:15:34 / cg" |
109 "Modified: 20.4.1996 / 13:13:21 / cg" |
116 ! ! |
110 ! ! |
117 |
111 |
118 !MultiSelectionInList class methodsFor:'documentation'! |
112 !MultiSelectionInList class methodsFor:'documentation'! |
119 |
113 |
120 version |
114 version |
121 ^ '$Header: /cvs/stx/stx/libwidg/MultiSelectionInList.st,v 1.9 1996-04-16 18:48:22 cg Exp $' |
115 ^ '$Header: /cvs/stx/stx/libwidg/MultiSelectionInList.st,v 1.10 1996-04-20 13:54:48 cg Exp $' |
122 ! ! |
116 ! ! |