Remove item from NSOutlineView on change selection
Remove item from NSOutlineView on change selection
- Subject: Remove item from NSOutlineView on change selection
- From: "Hell's KItchen Hell's KItchen" <email@hidden>
- Date: Thu, 14 Dec 2006 23:38:32 +0100
Hello I would to remove an item from an NSOutlineView when the selection has
changed.
So if i select A and then B, when item B will be selected, item A will be
removed.
So I need to know the previous and current item.
So I've used:
- (void)outlineViewSelectionIsChanging:(NSNotification *)notification {
[current release];
current = [[self itemAtRow: [self selectedRow]] retain];
[listOfMsg removeObject: previous];
[self reloadData];
[previous release];
previous = [current retain];
}
It works fine but when the user change the selection the program will select
the wrong item (this because the old one is removed and the table is shifted
+/- 1 item).
So i've decided to implement this method before previous release:
int x = [self rowForItem: current];
[self selectRowIndexes: [NSIndexSet indexSetWithIndex: x]
byExtendingSelection:NO];
Now it should select what the user want to select. Unfortunatly it does not
work if the user choose a child of another message (and not a root message).
I think that rowForItem return a bad int because I've expanded the child. So
what's the right way to return the index of my current item when the user
choose an item with level > 0?
Thanks a lot
richard
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden