Re: Accessibility Problems...
Re: Accessibility Problems...
- Subject: Re: Accessibility Problems...
- From: Mike Engber <email@hidden>
- Date: Thu, 7 Sep 2006 17:25:26 -0700
Use the debugging environment variable NSAccessibilityDebugLogLevel
with a value of one.
Specify it in xcode (edit active executable)
or by launching your app from the command line
foo.app/Contents/MacOS/foo -NSAccessibilityDebugLogLevel 1
It will spew informative messages to the console.
From the stack trace I can't tell what going wrong since it stops at
your breakpoint, but I can tell that what's going on is the child is
being looked for in the parent's children list. So my first guess is
there's an asymmetry in the parent-child hierarchy.
If element x returns element y as its parent then it's essential that
element y include element x in its children.
If you're already doing that then the problem could have to do with
equality testing. Element x will be looked for in element y's
children list using isEqual. If you're creating objects for element x
on the fly (i.e. a different object each time) then you should know
that by default, NSObject use pointer equality for isEqual. You'll
need to override this - and if you override isEqual, hash should be
overridden appropriately as well (equal object must hash the same).
Another common problem is returning an ignored ui element.
NSAccessibilityDebugLogLevel will catch this too. The utility fns
NSAccessibilityUnignoredAncestor and
NSAccessibilityUnignoredDecendant help solve this.
There's a couple of different sample code entries that show how to
accessorize an NSObject subclass from scratch. I strongly recommend
you steal from them liberally. Here's a link to one:
http://developer.apple.com/samplecode/ImageMapExample
And again, I can't emphasize enough how useful it is to run with
NSAccessibilityDebugLogLevel 1. It will catch lots of common mistakes
- often when you don't even realize there's a problem.
-ME
On Sep 7, 2006, at 4:48 PM, Joseph Kelly wrote:
I am doing a bit of research into making a Cocoa application
accessible. I rely heavily on custom views whose content is
rendered using a cross platform api (wrappers around NSBezierPath
and GDI etc) -- basically, much of the sub-content is not broken
down into NSViews, therefore I've created an accessibility object
class (called MCAccessible, which in theory will wrap a C++ object
generated by my data model etc. ) modeled very loosely on
Dicey.xcodeproj Die-accessibility.h/.m.
I've set up a test, simply instantiate one of my objects which is
inside one of my custom NSViews. From Acc. Inspector, when I move
the mouse over the specified area, the attribute list shrinks
drastically and the child and parents are <NULL> and the role is
AXUnkown or whatever. So I set some breakpoints on my accessibility
methods and debug it.
After accessibilityAttributeNames:, it sends a
accessibilityAttributeValue: message asking for AXParent. After it
returns from that (I return the parent view) my object receives an -
indexOfObject:(id)thingie message, and when I override this and set
a breakpoint, the stack trace looks like:
#0 0x004159d2 in -[MCAccessible indexOfObject:] at MCAccessible.mm:61
#1 0x93408d35 in -[NSObject(NSAccessibilityUIElementSpecifier)
_accessibilityUIElementPathForChild:]
#2 0x93408455 in -[NSObject(NSAccessibilityUIElementSpecifier)
_accessibilityUIElementPath]
#3 0x934083b7 in _NSAccessibilitySpecifierForUIElement
#4 0x934330dd in NSAccessibilityCreateAXUIElementRef
#5 0x935a343f in ConvertOutgoingValue
#6 0x935a3ec4 in CopyAppKitUIElementAttributeValueNoCatch
#7 0x935a40ad in CopyAttributeValue
#8 0x9180ab18 in _AXXMIGCopyAttributeValue
#9 0x9181023b in _XCopyAttributeValue
#10 0x917de812 in mshMIGPerform
#11 0x9082a66d in CFRunLoopRunSpecific
#12 0x90829b0e in CFRunLoopRunInMode
#13 0x92de8bef in RunCurrentEventLoopInMode
#14 0x92de82fd in ReceiveNextEventCommon
#15 0x92de8154 in BlockUntilNextEventMatchingListInMode
#16 0x9328e465 in _DPSNextEvent
#17 0x9328e056 in -[NSApplication
nextEventMatchingMask:untilDate:inMode:dequeue:]
#18 0x93287ddb in -[NSApplication run]
#19 0x9327bd2f in NSApplicationMain
#20 0x00002bc6 in main at main.m:13
Additionally, thingie == self (!)
For kicks, I return 1 or 0 or NSNotFound, but whatever I do, none
of my other Acc. methods get called after that.
I am hoping this is symptomatic of something obvious, but if it's
not, I can provide lots more information.
10.4.7 Intel, targeting 10.4 i386 and 10.3 ppc.
Thanks in advance,
Joseph K.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Accessibility-dev mailing list (Accessibility-
email@hidden)
Help/Unsubscribe/Update your Subscription:
40apple.com
This email sent to email@hidden
_______________________________________________
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