Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Accessibility APIs sensitive to whether an NSView isFlipped



I just noticed by debugging that when hit testing, or when I return a AXPosition, the accessibility APIs peek at my NSView to look at whether it returns YES for |-(BOOL)isFlipped| and adjust accordingly.

I don't believe this is true. When do you run into this?

I had assumed that, when returning an AXPosition for something deep down in my hierarchy, that I would always return a cocoa coordinate, but I noticed that it depends on what the topmost NSView's coordinate system is like.

No, the topmost NSView shouldn't enter into it.

For positions you need to return the coordinate of your lower left corner in global (screen) coordinates - end of story.

Note that a |accessibilityHitTest:| message can be sent and return a custom object deep down the view, that Cocoa can't see. Since this custom object might not know what *anything* about the view's internal properties, I think it would make more sense to say that the APIs always expect a cocoa coordinate, or vice versa.

It's true that if a view is flipped, its origin will be in the "wrong" spot - upper left as opposed to lower left. So you'll have to offset things as you mention.


Presumably, this custom object deep down in the view hierarchy is contained in some view - call it parentView. Assume that this custom view draws itself in myBounds (in parentView's coords - of course).

Here's some (untested) code to handle it.

NSPoint localPoint = myBounds.origin;
if ([self isFlipped]) {
	localPoint.y += myBounds.size.height;
}
NSPoint windowPoint [parentView convertPoint:myPosition toView:nil];
return [[parentView window] convertBaseToScreen:windowPoint];

Anyway, some kind of comment about this automatic adjusting in the accessibility docs would make sense.

The only "automatic" adjusting going on is that the bottom-left relative screen coordinate your return is converted to a top-left relative screen coordinate - because the AX api's deal in top-left relative coords. An the reverse happens when the AX api's send coordinates to you.


Note, this transformation only depends on the screen size - nothing to do with window, views, or flippedness.

-ME

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Accessibility-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/accessibility-dev/email@hidden

This email sent to email@hidden
References: 
 >Accessibility APIs sensitive to whether an NSView isFlipped (From: HÃ¥kan Waara <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.