Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Outline view selection doesn't move when items are inserted?



Since this seems like a common operation, feel free to log this as a bug/feature request against NSOutlineView. Reply back with the bug number.

The main problem: TableView keeps the selection on the same row, and doesn't know about 'items'. NSOutlineView knows about items, but has never had the smarts to restore the selected items. We could easily add this.

thanks,
corbin

On Jan 17, 2008, at 8:22 AM, John Stiles wrote:

OK, this is a little disappointing; fortunately it's not too hard to work around on my own. Thanks for confirming my hypothesis.


Jerry Krinock wrote:

On 2008 Jan, 16, at 19:00, John Stiles wrote:

I would have assumed that the selection tracks an /item/, and doesn't just sit on a particular row.


Is this behavior to be expected? Seems kinda weird to me.

Well, since you didn't expect it, it is "not expected". However, I do believe that this is the way it has always worked. Probably has something to do with the data source being a separate object.


In my code, I get the 'selectedObjects' before -reloadData, then after -reloadData, restore it. Here is some ugly old code I found while verifying my memory:

// Restore selection
e = [selectedObjects objectEnumerator] ;
NSMutableIndexSet* selectionIndexes = [[NSMutableIndexSet alloc] init] ;
while ((item = [e nextObject])) {
int index = [outlineView rowForItem:item] ;
if (index != NSNotFound) {
[selectionIndexes addIndex:index] ;
}
}
[outlineView selectRowIndexes:selectionIndexes
byExtendingSelection:NO] ;
[selectionIndexes release] ;



_______________________________________________

Cocoa-dev mailing list (email@hidden)

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/email@hidden

This email sent to email@hidden
References: 
 >Outline view selection doesn't move when items are inserted? (From: John Stiles <email@hidden>)
 >Re: Outline view selection doesn't move when items are inserted? (From: Jerry Krinock <email@hidden>)
 >Re: Outline view selection doesn't move when items are inserted? (From: John Stiles <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.