Customizing descriptions
Customizing descriptions
- Subject: Customizing descriptions
- From: Ricky Sharp <email@hidden>
- Date: Sun, 9 Jul 2006 15:11:02 -0500
I've found that I need to implement custom descriptions for a few of
my controls. For example, for a "IIValueField":
.---. /\
|10 |
`---' \/
Basically a focusable control that displays a number and provides two
buttons to increment/decrement the value. This is all wrapped in a
single NSControl/NSCell.
Anyhow, I started by having a role of "incrementor". VoiceOver would
then display/speak the following:
"maximum sum incrementer" (the title of the control was set to
"maximum sum").
This isn't much help to users as it doesn't display/speak the value.
I then looked at what Voiceover does with a date control which was to
display "date <date>" where <date> was the current date as displayed.
I was able to achieve something similar for my value field:
"maximum sum value field 18"
However, I found that I needed to do the following in code:
- (id)accessibilityAttributeValue:(NSString*)anAttribute
{
id theValue = nil;
if ([anAttribute isEqualToString:NSAccessibilityRoleAttribute])
theValue = NSAccessibilityIncrementorRole;
else if ([anAttribute
isEqualToString:NSAccessibilityRoleDescriptionAttribute])
theValue = [NSString string]; // Note empty string here
else if ([anAttribute
isEqualToString:NSAccessibilityDescriptionAttribute])
theValue = [NSString stringWithFormat:@"%@ value field %d",
[self title], [self currentValue_II]];
else
...
}
I needed to return a blank string from the role description and
instead add that text in to the description. Otherwise, VoiceOver
would display:
"maximum sum 18 value field"
I'm going to assume that the string that VoiceOver uses by default is
made up as follows:
<description><role description>
Another example:
"voice picker Victoria" (with blank role description)
"voice Victoria picker" with non-blank role description
Have others done something similar with custom controls? Is it valid
to return empty strings for role description as long as the role
description is returned back in the description?
Thanks,
___________________________________________________________
Ricky A. Sharp mailto:email@hidden
Instant Interactive(tm) http://www.instantinteractive.com
_______________________________________________
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