This looks like a bug. I appreciate your taking the time to check and hopefully to file it.

-Peter

On Apr 12, 2009, at 1:22 PM, Seth Willits wrote:


I need a sanity check before I file a bug report.



sc is a 3-segment NSSegmentedControl with either Select One or Select Any as its mode. Segment 1 (the middle one) is selected in IB. Triggered as an action:


NSLog(@"Before:");
NSLog(@"  %d", [sc selectedSegment]);
NSLog(@"  %@", [sc isSelectedForSegment:0] ? @"YES" : @"NO");
NSLog(@"  %@", [sc isSelectedForSegment:1] ? @"YES" : @"NO");
NSLog(@"  %@", [sc isSelectedForSegment:2] ? @"YES" : @"NO");

[sc setSelected:NO forSegment:[sc selectedSegment]];

NSLog(@"After:");
NSLog(@"  %d", [sc selectedSegment]);
NSLog(@"  %@", [sc isSelectedForSegment:0] ? @"YES" : @"NO");
NSLog(@"  %@", [sc isSelectedForSegment:1] ? @"YES" : @"NO");
NSLog(@"  %@", [sc isSelectedForSegment:2] ? @"YES" : @"NO");


Before:
 1
 NO
 YES
 NO

After:
 1
 NO
 NO
 NO


selectedSegment: "[Returns t]he index of the currently selected segment, or -1 if no segment is selected."


No segment is selected so selectedSegment should clearly be -1, right?

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to