Re: NSOutlineView: removing the selected items, what's the easy way?
Re: NSOutlineView: removing the selected items, what's the easy way?
- Subject: Re: NSOutlineView: removing the selected items, what's the easy way?
- From: "Kirt Cathey" <email@hidden>
- Date: Fri, 06 May 2005 00:03:28 +0000
I tried to add a posting to the thread from the web, but that feature does
not seem to be available.
Anyway, I want to dedicate my solution to this issue in the form of a code
snippet to archives.
Probably not the most efficient code, but gets the job done.... so far
without sig 5, 10 or 11 errors :-))
- (IBAction)deleteChild:(id)sender
{
Node *selectedItem;
selectedItem = [myOutlineView itemAtRow:[myOutlineView selectedRow]];
if ([myOutlineView levelForItem:selectedItem] == 1)
{
[[rootNode children]removeObjectIdenticalTo:selectedItem];
} else if ([myOutlineView levelForItem:selectedItem] == 2)
{
int x;
int y = 0;
for (x = [myOutlineView rowForItem: selectedItem]; y == 0; x--)
{
if ([myOutlineView levelForItem:[myOutlineView itemAtRow: x]] == 1)
{
Node* parentItem;
parentItem = [myOutlineView itemAtRow:x];
[[parentItem children] removeObject:selectedItem];
y++;
}
}
} else if ([myOutlineView levelForItem:selectedItem] == 3)
{
int x;
int y = 0;
for (x = [myOutlineView rowForItem: selectedItem]; y == 0; x--)
{
if ([myOutlineView levelForItem:[myOutlineView itemAtRow: x]] == 2)
{
Node* parentItem;
parentItem = [myOutlineView itemAtRow:x];
[[parentItem children] removeObject:selectedItem];
y ++;
}
}
}
[myOutlineView reloadItem:rootNode reloadChildren:YES];
}
Regards,
Kirt
_________________________________________________________________
日本国内最大級570万ユーザーのMSN Hotmail
https://registernet.passport.net/reg.srf?id=2&lc=1041
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden