Howto redraw text in NSPopUpButtonCell's
Howto redraw text in NSPopUpButtonCell's
- Subject: Howto redraw text in NSPopUpButtonCell's
- From: "William Zumwalt" <email@hidden>
- Date: Thu, 28 Jun 2007 20:44:30 -0500
Hi, still trying to get over this problem so thought I'd try again.
I've overridden mouseDown: in my NSTableViewHeader class which contains
NSPopUpButtonCell's. The problem is that, even though I can make the
popupButtonCell selection and catch it in this method, when I send the
setTitle: msg below, it just overlays the title on top of the previous
title. So then I figure I need to redraw it ... but calling display: or
marking it with setNeedsDisplay: doesn't clear up the data table's header
cells.
Using grab, I've cropped the gui so that I can show what the problem looks
like and if I can get it to post.
@implementation
// ...
headerCell = [[DataTableHeaderCell alloc] initTextCell:col];
[headerCell setPullsDown:NO];
[headerCell setControlSize:NSMiniControlSize];
[headerCell setBordered:NO];
if (i == 0) {
[headerCell setEditable:NO];
}
else {
[headerCell setEditable:YES];
[headerCell addItemWithTitle:@"Mark as A"];
[headerCell addItemWithTitle:@"Mark as B"];
[headerCell addItemWithTitle:@"Mark as C"];
}
[headerCell setControlView:[tableView headerView]];
[column setHeaderCell:headerCell];
[headerCell release];
--- In the mouseDown: of the implementation file I do a setNeedsDisplay:
just after a setTitle: but that doesn't seem to clear the text.
@implementation DataTableHeader
- (id) init
{
if (self = [super init]) {
}
return self;
}
- (void) mouseDown:(NSEvent *) event
{
NSPoint point = [event locationInWindow];
int column = [self columnAtPoint:[self convertPoint:point fromView:nil]];
if (column >= 0) {
NSTableColumn *col = [[[self tableView] tableColumns]
objectAtIndex:column];
[[col headerCell] trackMouse:event
inRect:[self headerRectOfColumn:column]
ofView:self untilMouseUp:NO];
[[col headerCell] setTitle:[[[col headerCell] selectedItem] title]];
[self setNeedsDisplay:YES];
} else {
[super mouseDown:event];
}
//[self displayRect:[self headerRectOfColumn:column]];
return;
}
Any Ideas?
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden