difficulties with NSCell -setImage method
difficulties with NSCell -setImage method
- Subject: difficulties with NSCell -setImage method
- From: Alex Reynolds <email@hidden>
- Date: Fri, 7 Dec 2001 03:59:36 -0500
I am attempting to overload the -willDisplayOutlineCell method for
outline views, to redraw my custom "expanded/not-expanded" graphics.
It works okay, with the one problem that when the very first item has a
child added, it becomes expandible and has a system-default triangle
drawn to the outline cell, instead of my custom "non-expanded" or
"closed" graphic.
If I click on the expansion triangle, the method below works properly to
draw my custom "expanded" or "open" graphic.
If I then close the triangle, the method below draws the "non-expanded"
custom graphic properly. Opening and closing nodes works properly from
then on.
Is there any way I can fix this so that the custom graphic is drawn the
first time around, instead of the system default?
My code for -willDisplayOutlineCell is as follows:
- (BOOL) outlineView: (NSOutlineView *) outlineView
willDisplayOutlineCell:(id)cell forTableColumn:(NSTableColumn
*)tableColumn item:(id)item
{
//
// these are NSButtonCell objects...
//
if ([outlineView isItemExpanded:item])
{
// NSLog (@"Item is expanded");
[cell setAlternateImage:openImage];
[cell setImagePosition:NSImageAbove];
}
else
{
// NSLog (@"Item is closed");
[cell setImage:closedImage];
[outlineView updateCell:cell];
}
return YES;
}
Thanks in advance for any suggestions.
Regards,
Alex