selectionChanged event when deleting items in a MultipleSelectionListView

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

selectionChanged event when deleting items in a MultipleSelectionListView

Jason Shannon
Hi,

The #selectionChanged event doesn't appear to get fired when deleting
selected items in a multiple selection list view. The culprit seems to
be IconicListAbstract>>onItemRemovedAtIndex:, which tries to compare
an array of selected items against the integer index of the removed
item.

I've added an overridden version of onItemRemovedAtIndex: to
MultipleSelectionListView as follows (apologies for any word-wrapping
problems):

onItemRemovedAtIndex: anIntegerIndex
        "Event received when an object has been removed from the
receiver's
        model at anIntegerIndex. Remove the appropriate item from the
list.
        JS - Overridden so that selection change events are generated
when items
        are deleted from a multiple-selection list."

        | selectionChanged |
        selectionChanged := self selectionByIndex includes:
anIntegerIndex.
        self basicRemoveAtIndex: anIntegerIndex.
        selectionChanged ifTrue: [self onSelChanged: nil]

This appears to do the trick, with the proviso that
IconListAbstract>>onSelRemoved isn't called when the last selected
item is deleted. I'm not sure that this is a problem. If there's
anyone that's familiar with this area and can see a fault with this
solution, I'd appreciate knowing about it! :-)

Cheers,
--
Jason Shannon http://www.araxis.com


Reply | Threaded
Open this post in threaded view
|

Re: selectionChanged event when deleting items in a MultipleSelectionListView

Blair McGlashan
"Jason Shannon" <[hidden email]> wrote in message
news:[hidden email]...
> Hi,
>
> The #selectionChanged event doesn't appear to get fired when deleting
> selected items in a multiple selection list view. The culprit seems to
> be IconicListAbstract>>onItemRemovedAtIndex:, which tries to compare
> an array of selected items against the integer index of the removed
> item.
>...

Thanks Jason, recorded as defect no. 1071.

Regards

Blair