MultiSelectionInList.st
changeset 537 21fc632b22fe
parent 536 fd1b723e69b6
child 563 fa563ad7630c
equal deleted inserted replaced
536:fd1b723e69b6 537:21fc632b22fe
    41 ! !
    41 ! !
    42 
    42 
    43 !MultiSelectionInList methodsFor:'accessing-values'!
    43 !MultiSelectionInList methodsFor:'accessing-values'!
    44 
    44 
    45 selection
    45 selection
    46     "return the selections value (i.e. the entry 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     ^ selectionIndexHolder value collect:[:index |
    51     l isNil ifTrue:[^ 0].    "/ mhmh - no list; what should we do here ?
    52 	l at:index
    52 
    53       ]
    53     ^ selectionIndexHolder value 
       
    54         collect:[:index |
       
    55             l at:index
       
    56         ]
    54 
    57 
    55     "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"
    56 !
    60 !
    57 
    61 
    58 selection:anObjectList 
    62 selection:anObjectList 
    59     "set the selection to be anObjectList."
    63     "set the selection to be anObjectList."
    60 
    64 
    61     |l indizes|
    65     |l indizes|
    62 
    66 
    63     l := self list.
    67     l := self list.
       
    68     l isNil ifTrue:[^ self].   "/ mhmh - no list; what should we do here ?
       
    69 
    64     indizes := OrderedCollection new.
    70     indizes := OrderedCollection new.
    65     anObjectList do:[:o |
    71     anObjectList do:[:o |
    66 	|idx|
    72         |idx|
    67 
    73 
    68 	idx := l indexOf:o ifAbsent:0.
    74         idx := l indexOf:o ifAbsent:0.
    69 	idx ~~ 0 ifTrue:[
    75         idx ~~ 0 ifTrue:[
    70 	    indizes add:idx
    76             indizes add:idx
    71 	].
    77         ].
    72     ].
    78     ].
    73     ^ self selectionIndex:indizes
    79     ^ self selectionIndex:indizes
    74 
    80 
    75     "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"
    76 ! !
    83 ! !
    77 
    84 
    78 !MultiSelectionInList methodsFor:'initialization'!
    85 !MultiSelectionInList methodsFor:'initialization'!
    79 
    86 
    80 initialize
    87 initialize
   109 ! !
   116 ! !
   110 
   117 
   111 !MultiSelectionInList class methodsFor:'documentation'!
   118 !MultiSelectionInList class methodsFor:'documentation'!
   112 
   119 
   113 version
   120 version
   114     ^ '$Header: /cvs/stx/stx/libwidg/MultiSelectionInList.st,v 1.8 1996-04-16 10:15:42 cg Exp $'
   121     ^ '$Header: /cvs/stx/stx/libwidg/MultiSelectionInList.st,v 1.9 1996-04-16 18:48:22 cg Exp $'
   115 ! !
   122 ! !