• 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 not always showing "expand triangle"
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSOutlineView not always showing "expand triangle"


  • Subject: Re: NSOutlineView not always showing "expand triangle"
  • From: Luc Vandal <email@hidden>
  • Date: Tue, 5 Jul 2005 12:01:26 -0400

Hi Corbin,

I'm not subclassing NSTableView. Here's my code:

//
// numberOfChildrenOfItem
//
//
/////////////////////////////////////////////////////////
- (int)outlineView:(NSOutlineView *)outlineView numberOfChildrenOfItem:(id)item
{
if( item == nil )
{
return m_nVolumes;
}
else
{
return [self GetNumberOfChildrenOfItem:item];
}

return 0;
}



//
// isItemExpandable
//
//
/////////////////////////////////////////////////////////
- (BOOL)outlineView:(NSOutlineView *)outlineView isItemExpandable:(id)item
{
if( [self GetNumberOfChildrenOfItem:item] > 0 )
{
return YES;
}

return NO;
}



// // GetNumberOfChildrenOfItem // // ///////////////////////////////////////////////////////// - (int)GetNumberOfChildrenOfItem:(id)item { int nItems = 0; NSNumber* nID = [item objectForKey:@"ID"]; NSNumber* nPID = [item objectForKey:@"parentID"]; NSString* strPath = [item objectForKey:@"path"]; NSString* str = [item objectForKey:@"volume"]; [self EnumerateVolumes:strPath ForFolderID:[nID intValue]];

	int nCount = [aVolumes count];

	for(int i=0;i<nCount;i++)
	{
		NSDictionary* dict = [aVolumes objectAtIndex:i];
		NSNumber* nParentID = [dict objectForKey:@"parentID"];

		if( [nParentID intValue] == [nID intValue] )
		{
			nItems++;
		}
	}

	return nItems;
}


//
// child ofItem
//
//
/////////////////////////////////////////////////////////
- (id)outlineView:(NSOutlineView *)outlineView child:(int)index ofItem:(id)item
{
if( item == nil )
{
return [aVolumes objectAtIndex:index];
}
else
{
int nCount = [aVolumes count];
NSNumber* nID = [item objectForKey:@"ID"];

int j = 0;

for(int i=0;i<nCount;i++)
{
NSDictionary* dict = [aVolumes objectAtIndex:i];
NSNumber* nParentID = [dict objectForKey:@"parentID"];
NSString* str = [dict objectForKey:@"volume"];

if( [nParentID intValue] == [nID intValue] )
{
if( j == index )
{
return [aVolumes objectAtIndex:i];
}

j++;
}
}
}

return nil;
}



//
// objectValueForTableColumn
//
//
/////////////////////////////////////////////////////////
- (id)outlineView:(NSOutlineView *)outlineView objectValueForTableColumn:(NSTableColumn *)tableColumn byItem:(id)item
{
if( !item )
return NULL;

NSString* strPath = [item objectForKey:@"path"];

if ([[tableColumn identifier] isEqual:@"ICN"])
{
return [[NSWorkspace sharedWorkspace] iconForFile:strPath];
}

return [item objectForKey:@"volume"];
}



Thanks!

Luc


On 5-Jul-05, at 11:39 AM, Corbin Dunn wrote:

Luc,
Do you have a source code test case that demonstrates the problem? And/or a code snippet that you can post here for your datasource methods? are you subclassing the NSTableView in any way?


--corbin


On Jul 4, 2005, at 11:37 AM, Luc Vandal wrote:

Yes they are! I just don't know if this is a bug or if I'm doing something wrong!!! The outline view seems to recognize that some items have children but it won't display the collapse/expand icon and will display the children right under the parent at the same level instead of 1 level lower...

Luc

____________________________________________________
Luc Vandal
Développeur de logiciel / Software Developer Victor Reader Team

HumanWare
841 Jean-Paul-Vincent, Longueuil QC, Canada J4G 1R3
Tél : / Tel +1 450 463-1717
Fax / Téléc : +1 450 463-0120
http://www.humanware.com
_______________________________________________
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


  • Follow-Ups:
    • Re: NSOutlineView not always showing "expand triangle"
      • From: Corbin Dunn <email@hidden>
References: 
 >Re: NSOutlineView not always showing "expand triangle" (From: Luc Vandal <email@hidden>)
 >Re: NSOutlineView not always showing "expand triangle" (From: Corbin Dunn <email@hidden>)

  • Prev by Date: Re: Application launch from plugin
  • Next by Date: Re: Larger application size
  • Previous by thread: Re: NSOutlineView not always showing "expand triangle"
  • Next by thread: Re: NSOutlineView not always showing "expand triangle"
  • Index(es):
    • Date
    • Thread