Re: When is NSAccessibilityRTFForRangeParameterizedAttribute used?
Re: When is NSAccessibilityRTFForRangeParameterizedAttribute used?
- Subject: Re: When is NSAccessibilityRTFForRangeParameterizedAttribute used?
- From: Christiaan Hofman <email@hidden>
- Date: Sat, 10 Apr 2010 00:04:16 +0200
On Apr 9, 2010, at 23:47, Scott Kovatch wrote:
>
> On Apr 9, 2010, at 2:40 PM, Christiaan Hofman wrote:
>
>>
>> On Apr 9, 2010, at 23:33, Scott Kovatch wrote:
>>
>>> Hello,
>>>
>>> I'm working on responding to accessibility attribute requests for Eclipse's text editors, and I'm trying to figure out a few things. It
>>>
>>> In TextEdit, VoiceOver speaks the alignment and justification for text. We have the ability to set the alignment and justification, and so on, but I don't see any attributes that I could set. How is this information being picked up by VoiceOver?
>>>
>>> My hunch was that NSAccessibilityRTFForRangeParameterizedAttribute could do it, but when I implement that in my objects it never gets called. Under what conditions would this method be called?
>>
>> I can't tell you when what will be called, that's really an implementation detail of VoiceOver (or whatever tool that's uses accessibility).
>
> I realize it's an implementation detail, but if it is used I'd like to test it with some kind of tool.
>
>> However I can suggest an alternative that may be used: NSAccessibilityAttributedStringForRangeParameterizedAttribute.
>
> I am using that as well, and it's being called, but I don't see a way to pass the additional information. None of the NSAccessibilityXXXTextAttribute constants apply.
>
> -- Scott K.
>
But it does exist. The attribute is called "AXParagraphStyle", which is a dictionary containing e.g. an "AXTextAlignment" key. Unfortunately the accessibility documentation is rather incomplete, and that is especially true for text. I never care about those details and let Cocoa figure it out with the following trick:
@interface NSAttributedString (MYAccessibilityExtension)
- (NSAttributedString *)accessibilityAttributedString;
@end
@implementation NSAttributedString (MYAccessibilityExtension)
- (NSAttributedString *)accessibilityAttributedString {
static NSTextFieldCell *cell = nil;
if (cell == nil)
cell = [[NSTextFieldCell alloc] init];
[cell setAttributedStringValue:self];
return [cell accessibilityAttributeValue:NSAccessibilityAttributedStringForRangeParameterizedAttribute
forParameter:[NSValue valueWithRange:NSMakeRange(0, [self length])]];
}
@end
Christiaan
_______________________________________________
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