Weird NSBrowser Behavior
Weird NSBrowser Behavior
- Subject: Weird NSBrowser Behavior
- From: Bill Bumgarner <email@hidden>
- Date: Mon, 3 Dec 2001 14:18:31 -0500
http://oz.codefab.com/~bbum/BrowserTest.tgz
The above is a small app project that demonstrates some oddities with
NSBrowser that I don't understand. It is an attempt to use an
NSPopUpButtonCell to render the column titles. Unfortunately, it doesn't
work:
- the title cells are not drawn until the window is resized once....
not sure why
- when drawn, the cells are rendered incorrectly. The icon is
rendered too high (with half outside the button) while the text is
rendered too low (and cut off).
I forced the title height to 50 pixels and it still doesn't work. The app
renders a blue box from the title's frame rect to verify that the rect is
correct-- it is, the problem appears to be in NSPopUpButtonCell.
All of the code is enclosed-- it is simple.
Any ideas? I'm hesitant to file a bug report because I am not sure it is
actually a bug in Cocoa... much more likely that it is my abuse of the
APIs.
thanks,
b.bum
#import "CellTitledBrowser.h"
@implementation CellTitledBrowser
- (void) awakeFromNib
{
NSLog(@"Initializing CellTitledBrowser");
titleCell = [[NSPopUpButtonCell alloc] initTextCell:@"Title"];
[titleCell setControlSize: NSSmallControlSize];
}
- (void)drawTitleOfColumn:(int)column inRect:(NSRect)aRect;
{
[titleCell drawWithFrame: aRect inView: self];
[[NSColor blueColor] set]; NSFrameRect(aRect);
}
- (float)titleHeight;
{
return 50;
//! return [titleCell cellSize].height;
}
@end