I'd like to have my NSSegmentedControl
with a segment selected when enabled and with no segment selected while disabled (the kind of behavior that the view NSSegmentedControl in iTunes has).
Here some images:
enabled and selected
disabled correctly
disabled but not correctly
(*) I recognize that I could write a function to call whenever the BOOL property changes and in this function I could set all the segments desected or select the appropriate one, BUT I'd like to know if there's a way to accomplish this through Cocoa Bindings or Interface Builder.
UPDATE: added some images of the problem
The programmatic solution can be something like this:
- (void)setSegmentEnabled:(BOOL)enabled{
if (enabled)
{
int vState = [[NSUserDefaults standardUserDefaults] integerForKey:@"SelectedSegmentView"];
[viewSegment setSelectedSegment:vState];
segmentEnabled = YES;
}
else
{
[viewSegment setSelected:NO forSegment:0];
[viewSegment setSelected:NO forSegment:1];
[viewSegment setSelected:NO forSegment:2];
segmentEnabled = NO;
}
}
I'm just implementing my own setter for the BOOL property segmentEnabled
which is being binded with the viewSegment