I have a problem with the NSPopupButton. I've build a gui with that
NSPopUpButton and on the Mac it's working, but when I run the same
application the popup is disabled.
What can i do?
I'm using this code for creating the popupbutton:
@implementation NSPopUpButton (NSPopUpButtonBundleExtension)
- (id)initWithElementDic:(NSDictionary *)dic
{
NSArray *array = [[dic objectForKey:@"rect"]
componentsSeparatedByString:@","];
NSRect rect = ([array count] == 4 ? NSMakeRect([[array
objectAtIndex:0] floatValue], [[array objectAtIndex:1] floatValue],
[[array objectAtIndex:2] floatValue], [[array objectAtIndex:3]
floatValue]) : NSZeroRect);
if (rect.size.width > 0)
{
self = [super initWithFrame:rect];
if (!self) return nil;
NSArray *items = [dic objectForKey:@"items"];
[self insertItemWithTitle:[items objectAtIndex: 0] atIndex:0];
[self insertItemWithTitle:[items objectAtIndex: 1] atIndex:1];
[self setEnabled: YES];
return self;
}
return nil;
}
@end