• 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
Howto redraw text in NSPopUpButtonCell's
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: Howto redraw text in NSPopUpButtonCell's
      • From: "William Zumwalt" <email@hidden>
  • Prev by Date: Hide NSMenuItem
  • Next by Date: Re: Howto redraw text in NSPopUpButtonCell's
  • Previous by thread: Re: Hide NSMenuItem
  • Next by thread: Re: Howto redraw text in NSPopUpButtonCell's
  • Index(es):
    • Date
    • Thread