Re: How do I return children that are not instances of a subclass of NSView?
Re: How do I return children that are not instances of a subclass of NSView?
- Subject: Re: How do I return children that are not instances of a subclass of NSView?
- From: Mike Engber <email@hidden>
- Date: Mon, 10 Nov 2003 11:14:50 -0800
What makes an object an "accessibility object"?
Anything the descends from NSObject and implements (fully + correctly)
the accessibility protocol.
The difficulty implementing the protocol is not due to its complexity
(there aren't too many methods),
but rather that it won't seem to work at all till you get past critical
mass. I.e. an incremental
development approach won't work till you've got all the basic stuff
right.
Some tips:
- make sure to implement all the methods
- make sure that the parent attribute is correctly returned - this one
is vital
- implementing hit testing is also important to UIElement inspector,
but you can work around it
if you navigate the hierarchy via the popup - e.g. once you've locked
on your element's parent
you can pick your element from it's child list.
When debugging you'll discover (if you haven't already) that setting a
breakpoint on raise isn't too useful because UIElement inspector is
continually asking for non-existent attributes which causes exceptions.
Here's a tip for debugging this. Run your target app (the one with the
accessible objects) with
the command line option - e.g.
foo.app/Contents/MacOS/foo -NSAccessibilityDebugLogLevel 1
This, undocumented/unsupported, spewage into terminal is designed to be
helpful in tracking down
what's wrong. Read the messages carefully - some messages' wording
differs in subtle, but significant,
ways (e.g. "unsupported" vs "unimplemented")
How do I return children that are not instances of a subclass of
NSView?
You can return an array containing any objects that implement the
accessibility protocol.
AXUIElementCopyAttributeValue returns successfully when my Cocoa
application returns an array of objects that are instances of a
subclass
of NSView (the call to AXUIElementCopyAttributeValue triggers a call to
accessibilityAttributeValue with attribute set to
NSAccessibilityChildrenAttribute in my Cocoa application).
AXUIElementCopyAttributeValue also returns successfully if the array
contains NSStrings. AXUIElementCopyAttributeValue returns
kAXErrorFailure
if the NSArray contains objects which are instances of a subclass of
NSObject. I've implemented the NSAccessibility informal protocol and
NSCoding formal protocol in my class and I still get the error.
NSCoding is not relevant.
The problem is that you haven't correctly (or fully) implemented the
protocol in some
way. See if my suggestions above help you get closer. Feel free to
follow up with
me directly if you have further q's.
-ME
_______________________________________________
accessibility-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/accessibility-dev
Do not post admin requests to the list. They will be ignored.