Accessibility in custom NSControl subclasses
Accessibility in custom NSControl subclasses
- Subject: Accessibility in custom NSControl subclasses
- From: Stephen Blinkhorn <email@hidden>
- Date: Mon, 28 Feb 2011 11:16:02 -0600
Hello, first post to this list.
I make extensive use of custom NSControls in the GUIs of my audio
software products. Recently I ran into a problem whilst trying to
implement accessibility features in these controls.
I have added the test methods below which work perfectly for custom
NSView classes but are not working as expected with custom NSControl
classes. With custom NSControl classes voice over reads out the
application name instead of the value, role and description details.
Can anyone shed any light on why this is happening? Maybe it is worth
mentioning that none of my controls use NSCell classes at this time.
-(BOOL)accessibilityIsIgnored {
return NO;
}
-(NSArray*)accessibilityAttributeNames
{
NSArray* attributes = [super accessibilityAttributeNames];
NSMutableArray* mutable_attributes = [[NSMutableArray alloc]
initWithCapacity:[attributes count]];
[mutable_attributes addObjectsFromArray:attributes];
[mutable_attributes addObject:NSAccessibilityValueAttribute];
[mutable_attributes
addObject:NSAccessibilityValueDescriptionAttribute];
return (NSArray*)mutable_attributes;
}
-(id)accessibilityAttributeValue:(NSString *)attribute
{
if([attribute isEqualToString:NSAccessibilityRoleAttribute]) {
return NSAccessibilitySliderRole;
} else if([attribute
isEqualToString:NSAccessibilityRoleDescriptionAttribute]) {
return NSAccessibilityRoleDescriptionForUIElement(self);
} else if([attribute isEqualToString:NSAccessibilityValueAttribute]) {
return [NSNumber numberWithFloat:50.0];
} else if([attribute
isEqualToString:NSAccessibilityValueDescriptionAttribute]) {
return @"50%";
} else {
return [super accessibilityAttributeValue:attribute];
};
}
Thanks,
Stephen
_______________________________________________
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