On Jul 29, 2009, at 8:19 AM, Carmen Cerino Jr. wrote:
I have an NSArrayController hooked up to an NSCollectionView. When a user clicks into the empty space of the NSCollectionView, I would like it so they do not lose their currently selected items. I would have thought it should have been as simple as telling the NSArrayController to avoid empty selections. However, I do not get the desired result when this property is set. Is there something else that needs to be setup in order for this to work as expected or is my assumption about what that property is suppose to do completely wrong?
I would file this as a bug. NSCollectionView and NSArrayController should work the same as NSTableView and NSArrayController in this regard.
In order to temporarily achieve the desired effect, I ended up subclasing NSArrayController and overriding the setSelectionIndexes: method to ignore index sets with a count of 0. However, this seems more like a work around than a solution.
Since it's broken, the only way to ensure this works properly in Leopard is to implement a work-around. I don't see any problem with yours. It's what I would probably end up doing.
One caveat in case it hadn't occurred to you (you didn't say): I would only implement this logic if there is at least one object in the array controller's contents.
-- I.S. _______________________________________________ Cocoa-dev mailing list ([email protected]) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [email protected]
