Re: NSSegmentedControl
Re: NSSegmentedControl
- Subject: Re: NSSegmentedControl
- From: Mike Engber <email@hidden>
- Date: Mon, 23 Nov 2009 12:59:42 -0800
Here's a slightly snazzier solution.
-ME
---
void SetSegmentDescriptions(NSSegmentedControl *control, NSString
*firstDescription, ...)
{
// Use NSAccessibilityUnignoredDescendant to be sure we start
with the correct object.
id segmentElement = NSAccessibilityUnignoredDescendant(control);
// Use the accessibility protocol to get the children.
NSArray *segments = [segmentElement
accessibilityAttributeValue:NSAccessibilityChildrenAttribute];
va_list args;
va_start(args, firstDescription);
id segment;
NSString *description = firstDescription;
NSEnumerator *e = [segments objectEnumerator];
while ((segment = [e nextObject])) {
if (description != nil) {
[segment accessibilitySetOverrideValue:description
forAttribute:NSAccessibilityDescriptionAttribute];
} else {
// Exit loop if we run out of descriptions.
break;
}
description = va_arg(args, id);
}
va_end(args);
}
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Accessibility-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden