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: Mike Engber <email@hidden>
- Date: Wed, 16 Sep 2009 15:46:28 -0700
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