Re: NSOutlineView's levelForItem providing odd results
Re: NSOutlineView's levelForItem providing odd results
- Subject: Re: NSOutlineView's levelForItem providing odd results
- From: Andrew Mellinger <email@hidden>
- Date: Fri, 14 Nov 2003 08:02:54 -0800
So, after doing some more research via the OutlineView sample code
I've got some more interesting results. I placeed
NSLog(@"Level of item %d", [outlineView levelForItem:item]);
The code only seems to be providing erroneous results (-1 from
everything) when I am turning something down. When I turn a triangle
up, it works okay. If I turn the same triangle down, it still
provides bad results (doesn't cache.) My guess is that it hasn't
placed the item in its internal hierarchy yet and doesn't have a
valid place for it, thus the -1 on the result means it doesn't have
it placed yet.
Has anyone seen anything like this? Does anyone have any more
information? It sounds like a bug to me...
-Andrew
>
Y'all,
>
>
I am working with an NSOutlineView and I wanted I put the
>
following code in one of my data sources:
>
>
- (BOOL)outlineView:(NSOutlineView *)anOutlineView isItemExpandable:(id)item
>
{
>
if ([anOutlineView levelForItem:item] == 0)
>
{
>
return YES;
>
}
>
>
return NO;
>
}
>
>
My problem is that on the first item in my view (at level zero) the
>
level returned is -1. The item value is *not* nil. The
>
documentation indicates that -1 will be returned when item is nil.
>
>
Under my first item I have two children. When they are asked if
>
they are Expandable, the first item passed to me also returns -1,
>
and the second is zero. Also, on both occaisons, the item is not
>
nil. Here is what I am being told by the levelForItem call...
>
>
- Item (-1)
>
- SubItem (-1)
>
- SubItem (0)
>
>
BTW: I made the above sample code use '== -1' so that I could see
>
the second level.
>
>
Does anyone understand why levelForItem is giving such funky results?
>
>
Thanks,
>
-Andrew
>
_______________________________________________
>
cocoa-dev mailing list | email@hidden
>
Help/Unsubscribe/Archives:
>
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
>
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.