NSPopUpButtonCell won't Pop Up
I have a table whose NSTableColumns
are created dynamically in code. I need to add an NSPopUpButtonCell
to one of these columns programatically. I do so with the following code:
NSPopUpButtonCell *dataCell = [[[NSPopUpButtonCell alloc] initTextCell:@"" pullsDown:NO] autorelease];
[dataCell setBor开发者_如何学JAVAdered:NO];
[dataCell insertItemWithTitle:@"[TEMP]" atIndex:0];
[myNewTableColumn setDataCell:dataCell];
The pop up button cell appears in the table fine, but when I click on it, nothing happens. I've tried calling [dataCell setEditable:YES]
but when I do that, the cell edits with a field editor like an NSTextFieldCell
. Am I missing something?
D'oh! I forgot that the table I was using was an NSTableView
subclass that overrode the - mouseDown:
method to do something else. As such, I ended up never sending the proper message to the pop up cell to actually get it to pop up.
A quick call to [super mouseDown:theEvent]
has everything working as expected.
精彩评论