Re: Using title UI element in custom descriptions
Re: Using title UI element in custom descriptions
- Subject: Re: Using title UI element in custom descriptions
- From: Ricky Sharp <email@hidden>
- Date: Wed, 19 Jul 2006 13:15:46 -0500
On Wednesday, July 19, 2006, at 12:23PM, James Dempsey <email@hidden> wrote:
On Jul 18, 2006, at 7:29 PM, Ricky Sharp wrote:
> > I have a couple of custom controls that provide a custom handler for
> > NSAccessibilityDescriptionAttribute.? Part of the description that I build will
> > be the control's title.? The title can either come from the title attribute of
> > the cell, or from a linked UI title element (set up in IB).
>
> Typically the title attribute / description attribute is an either/or.? I am
> guessing this is a case where the title text is not at all sufficient for
> accessibility purposes?
That is correct. One control in question is a custom progress bar (IIProgressBar[Cell]) which is placed next to some static text (IIStaticText):
.--------------.
Correct: |8888888 |
`--------------'
For a particular set of math problems, this shows the number of problems answered correctly. I want the custom description to be:
5 of 10 problems correct progress bar
which is broken down as:
5 of 10 (built from current and max value attributes)
problems correct (the cell's title attribute; more descriptive than the static text item)
progress bar (role description)
Perhaps this is a poor example as I could have easily changed the static text to be "Problems Correct:". But, I have other cases where I sometimes use a corresponding title ui element rather than the cell's title attribute.
Furthermore, my static text prompts often include a ':' whereas my cell's title will not. Not sure if it's a huge issue to have descriptions being built with prompts that contain colon characters. It doesn't affect VoiceOver output; it just looks a bit strange in the VoiceOver text-output floating window.
> > I've tried unsuccessfully in obtaining the title element.
> > Here's what I did in my cell subclass:
> >
> > id theTitleUIElement = [super
> > accessibilityAttributeValue:NSAccessibilityTitleUIElementAttribute];
> The code above should get back the title ui element, if one is set on the object.
> Does Accessibility Inspector report that the cell does indeed have a title UI
> element after you hook it up in IB and run the app?? If not, I'm wondering if
> perhaps IB has a problem adding title / link elements to custom views/cells.
> You might try to connect the two in code using -accessibilitySetOverrideValue:
> forAttribute:(NSString *)attribute.? Be sure to set the override value on the
> cell not the control, and to set the text view cell as the ui element value.
The inspector does indeed show that the object has a title UI element.
> If you find it works using a manual "setOverrideValue" but not in IB, please file
> a bug against IB.
Will do.
> > Workaround...It won't be the end of the world if I can't do this as I'll just
> > always set up the cell's title attribute and never link to a static text item to
> > serve as the title.
> True, but the title UI element should work.
Agreed.
> > Furthermore, I've found it interesting that NSCell subclasses do not provide the
> > NSAccessibilityTitleUIElementAttribute.? However, NSActionCell subclasses do.
> > I'll file a documentation enhancement request to beef up the "supported
> > attributes" table to include NSActionCell as that's a common class to subclass:
> Neither NSCell nor NSActionCell have the NSAccessibilityTitleUIElementAttribute
> by default.? It is either by a subclass implementing and reporting that attribute
> (NSFormCell does this), or else an instance having that attribute value set by
> -accessibilitySetOverrideValue:forAttribute: that it would be set.? I'm curious
> where you are seeing this distinction.
When IIProgressBarCell derived from NSCell, Acc. Inspector didn't show any title UI element attached to it. Furthermore, by attempting to access that element via my call to super above, it would throw a "attribute not supported" exception. I then changed IIProgressBarCell to derive from NSActionCell. Acc. Inspector then _did_ show the title UI element and my call to super no longer threw an exception (although it still returned a nil).
Note that in the case of deriving from NSCell, one apparently needs to add the NSAccessibilityTitleUIElementAttribute to the list of attributes it handles. But this is not needed in NSActionCell.
Finally, IIProgressBar derives directly from NSControl.
Thanks for all your help on this; I'll try the override value tonight and report back.
--
Rick Sharp
Instant Interactive(tm)
_______________________________________________
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