Re: Voice Over Performance for Complex Custom View
Re: Voice Over Performance for Complex Custom View
- Subject: Re: Voice Over Performance for Complex Custom View
- From: Xiang Cao <email@hidden>
- Date: Wed, 16 Sep 2009 16:11:46 -0700
- Thread-topic: Voice Over Performance for Complex Custom View
Thanks for the reply.
My isEqual is implemented as the following:
- (BOOL)isEqual:(id)object {
if ([object isKindOfClass:[DFW_Accessibility self]]) {
DFW_Accessibility* other = object;
return mTView == other->mTView;
} else {
return NO;
}
}
- (unsigned)hash {
return [mRole hash] + [mParent hash]; //mRole is NSString* and mParent
is another DFW_Accessibility object
}
Because each of my custom access object has an linked Tview pointer which
points to one of the real element in our GUI library. I think it should be
correct to compare their pointer to see if they are the same accessibility
object. For hash, I'm not sure if I'm doing it correctly or not.
On 9/16/09 3:46 PM, "Mike Engber" <email@hidden> wrote:
>
> On Sep 16, 2009, at 2:53 PM, Xiang Cao wrote:
>
>> if([attribute isEqualToString:NSAccessibilityChildrenAttribute])
>> {
>> if(mChildren)
>> {
>> if(index+maxCount>[mChildren count]) maxCount =
>> [mChildren count] - index;
>> NSRange range = NSMakeRange(index, maxCount);
>> return NSAccessibilityUnignoredChildren([mChildren
>> subarrayWithRange:range]);
>> }else return nil;
>
> I don't think you should ever be returning nil for you children -
> return an empty array - [NSArray array]
>
>> }else return [super accessibilityArrayAttributeCount:attribute];
>>
>> But I saw errors from console said like: !!! Failed to find child 2
>> (index 2) for AX specifier: <NSWindow: 0x21eb1e90>{32}.
>
> I assume you have turned on: -NSAccessibilityDebugLogLevel 1
>
> I would guess this error means that isEqual (used by indexOfObject) is
> not finding the child? Are you generating your children on the fly?
> Are they some class that uses the default isEqual implementation
> (pointer equality) ?
>
> Note if this is the problem and you fix it by implementing isEqual,
> don't forget to implement hash too.
>
>> Should I use NSAccessibilityUnignoredChildren() for the sub array?
>
> Yes. It is essential if there are any ignored UI Elements in your
> hierarchy. If there aren't, it won't matter, but you should still do
> it as it's a good habit.
>
>
>> My accessibilityIndexOfChild, looks like the following. Because the
>> documentation said I should return the child index from the Parent.
>> So I assume I have to ask the receiver¹s parent for their child
>> index. I¹m not sure if that is correct.
>>
>> - (NSUInteger)accessibilityIndexOfChild:(id)child
>> {
>> DFW_Accessibility* dfwchild = (DFW_Accessibility*)child; //
>> this is my custom access object
>>
>> if(dfwchild->mParent && dfwchild->mParent->mChildren)
>> {
>> NSUInteger index = [dfwchild->mParent->mChildren
>> indexOfObject:child];
>> if(index == NSNotFound)
>> {
>> NSLog(@"NSNotFound");
>> return NSNotFound;
>> }else NSLog(@"child index %d", index);
>> return index;
>> }else
>> {
>> return NSNotFound;
>> }
>> }
>
> Seems OK.
>
> -ME
>
_______________________________________________
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