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 17:36:18 -0700
On Sep 16, 2009, at 4:11 PM, Xiang Cao wrote:
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.
You hash function will return the same value for all siblings with the
same role. While this is OK since equal object will hash the same, it
could be improved.
Plus it will be fairly expensive since it recurs up the hierarchy
calling hash on all its ancestors.
I suggest simply returning mTView (i.e. the address).
I forgot to mention. I didn't generate all the children everytime on
the
fly. They are allocated only when children attributes are asked for
the
first time. Then the array is retained as a member variable for
later use. I
did this to improve the performance, but it's still a little slow.
Are the "real elements" in your GUI libray ObjC objects? If so, it
would be cheapest to just make those classes implment the
accessibility protocol.
When I don't have ObjC object I can accessorize, I generally create UI
Elements on the fly and it performs well enough. One advantage of this
approach is the UI Elements are never out of sync with the actual UI.
I guess if your hierarchy is big enough, all the allocations could be
slowing you down. You should measure and test.
As for your original problem:
But I saw errors from console said like: !!! Failed to find child 2
(index 2) for AX specifier: <NSWindow: 0x21eb1e90>{32}.
It seems like you're returning a ui element that's the second child of
the window's third child. But, somehow later when we go to use this ui
element its parent is reporting that it has no children.
Did you implement all three methods:
• (NSUInteger)accessibilityArrayAttributeCount:(NSString *)attribute
• - (NSArray *)accessibilityArrayAttributeValues:(NSString *)
attribute index:(NSUInteger)index maxCount:(NSUInteger)maxCount
• - (NSUInteger)accessibilityIndexOfChild:(id)child
Your email only showed code for the last method.
If you did implement all these methods, I'm going to guess that the
problem is accessibilityArrayAttributeValues is returning an empty
array when passed a maxCount of one.
-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