• 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
Re: Re: Re: NSPopUpButtonCell as NSTableView header problem
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Re: Re: NSPopUpButtonCell as NSTableView header problem


  • Subject: Re: Re: Re: NSPopUpButtonCell as NSTableView header problem
  • From: "Ender Wiggins" <email@hidden>
  • Date: Wed, 26 Jul 2006 20:24:33 -0500

Anyone have an idea here of what I've done so far? Still not working correctly.

On 7/22/06, Ender Wiggins <email@hidden> wrote:
I'm still trying to make NSPopUpButtonCell's appear in my
NSTableViewHeader. The title of my first popup item appears, but it
has a few problems.

#1 Clicking on the header doesn't drop down the items. Though I do get
the mouseDown event from overriding my NSTableHeaderView.
#2 I can't drag on the edges of the column to resize them.
#3 I have four columns and four headers (which I see during debug),
although there are 5 headers that appear but it's the 4th that looks
like it's being shown twice and not refreshed.

I subclassed NSTableHeaderView and add it to my NSTableView here.

- (void) awakeFromNib
{
        NSTableHeaderView *currentTableHeader = [tableView headerView];
        DataTableHeader *dataTableHeader = [[DataTableHeader alloc] init];

        [dataTableHeader setFrame:[currentTableHeader frame]];
        [dataTableHeader setBounds:[currentTableHeader bounds]];

        [tableView setHeaderView:dataTableHeader];
}

I think at this point I have something wrong, this is where I create
my table column headers but I don't know how to put the
NSPopUpButtonCell's into my NSTableHeaderView. Below they are just put
directly into the NSTableView by doing a setHeaderCell.

- (int) createColumns
{
        NSTableColumn *column;
        NSPopUpButtonCell *headerCell;

        ...

        for (int i = 0; i < count; i++) {
                NSString *col = [columnItems objectAtIndex:i];

                headerCell = [[NSPopUpButtonCell alloc] initTextCell:col];
                [headerCell setControlSize:NSMiniControlSize];
                [headerCell setBordered:NO];
                [headerCell setPullsDown:YES];
                [headerCell setFont:[NSFont labelFontOfSize:
                        [NSFont systemFontSize]]];

                [headerCell addItemWithTitle:@"Item A"];
                [headerCell addItemWithTitle:@"Item B"];

                column = [[NSTableColumn alloc]
                        initWithIdentifier:[NSNumber numberWithInt:i]];
                [column setHeaderCell:headerCell];
                [column sizeToFit];

                [tableView addTableColumn:column];
        }

        ...
}

Don't really know what needs to be added here. But I do get mouse down events.

@implementation DataTableHeader

- (void)mouseDown:(NSEvent *)theEvent
{
        NSLog(@"mouseDown event");
}

@end

Anyone know how to get the NSPopUpButtonCell into the table headers if
what I've got is on the right track?

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: NSPopUpButtonCell as NSTableView header problem
      • From: PGM <email@hidden>
References: 
 >NSPopUpButtonCell as NSTableView header problem (From: "Ender Wiggins" <email@hidden>)
 >Re: NSPopUpButtonCell as NSTableView header problem (From: "Michael Ash" <email@hidden>)

  • Prev by Date: Re: How would you convert a \r to its UTF-8 counterpart ?
  • Next by Date: Coredata and NSOutlineView / NSTreeController
  • Previous by thread: Re: NSPopUpButtonCell as NSTableView header problem
  • Next by thread: Re: NSPopUpButtonCell as NSTableView header problem
  • Index(es):
    • Date
    • Thread