• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSOutlineView: removing the selected items, what's the easy way?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Prev by Date: disappearing window when resized
  • Next by Date: Re: NSOutlineView problem
  • Previous by thread: disappearing window when resized
  • Next by thread: Objective-C related papers for DLS'05
  • Index(es):
    • Date
    • Thread