I'm using this code to add a popup button to an NSView
:
if (popupButton) [popupButton release];
popupButton = [[NSPopUpButton alloc] initWithFrame:NSMakeRect(0, 0, SHEET_WIDTH/2, 32) pullsDown:true];
NSMenu *menu = [[NSMenu alloc] init];
for (NSString *title in anArray)
[menu addItemWithTitle:title action:NULL keyEquivalent:@""];
[popupButton setMenu:menu];
[self addView:popupButton aligned:KOAlignmentCenter];
When I launch my app, the button has no selection. When the user clicks on it and selects one of the items, the button remains empty. For example, if there are 3 possible selections (item1, item2 & item3), and the user clicks on the second one, instead of showing 'item2' it shows nothing :