This issue doesn't seem to have a simple solution, here is the one I found, implementing a NSArrayController category :
@interface NSArrayController( ComboBoxCompatibility )
@property(readwrite )NSString *firstSelectedObject;
@end
And for the getters and setters :
@implementation NSArrayController (ComboBoxCompatibility)
-(NSString *)firstSelectedObject
{
return [[self selectedObjects] firstObject];
}
-(void)setFirstSelectedObject:(NSString *)firstSelectedObject
{
NSUInteger idx = [[self arrangedObjects] indexOfObject:firstSelectedObject];
[self setSelectionIndex:idx];
}
@end
You can then bind the value of the NSComboBox to your array controller's firstSelectedObject as soon as the objects in it implement copyWithZone: you can also modify the above code if the objects aren't strings but have a single property, "name" for example that you display in the combo box list by replacing [self arrangedObjects] with [[self arrangedObjects] valueForKey:@"name"] in the setter and [[[self arrangedObject] firstObject] valueForKey:@"name"] in the getter