Menu bug?
Menu bug?
- Subject: Menu bug?
- From: Bill Cheeseman <email@hidden>
- Date: Sat, 15 Mar 2003 09:03:30 -0500
In my app (PreFab UI Browser), I'm getting a menu UI element in two
different ways. To my surprise, CFEqual says the two UI elements don't
represent the same user interface object. Yet I have confirmed that they do,
by testing whether both have kAXMenuRole and whether their AXTitle
attributes are identical.
Here's what I'm doing:
1. First, I use AXUIElementCopyElementAtPosition to get the menu that is
visible under the mouse. It doesn't matter whether I use the application
element or the system-wide element to do this; I get the same result in both
cases.
2. Then, while the mouse is still over the menu, I traverse the hierarchy up
through its AXParents and back down through their AXChildren, ending up with
another AXUIElementRef object for the menu or menu item. I do this to build
the storage for an NSBrowser object, then highlight the correct menu element
in the browser.
3. At this point, I compare the two AXUIElementRefs with CFEqual, while
looping through the children, to identify the child that represents the UI
element that's under the mouse. But CFEqual always returns false.
4. I can successfully work around the problem by checking to see that the UI
elements are menus and comparing their titles for equality. Since this
works, I know that both UI elements are valid AXUIElementRef objects and
that both do in fact represent the same menu UI element.
So why is CFEqual failing? Does this have something to do with the known
"feature" of the accessibility API, that a menu doesn't know who its parent
is unless the menu is open? That doesn't seem likely, since the menu is open
in my application.
--
Bill Cheeseman - email@hidden
Quechee Software, Quechee, Vermont, USA
http://www.quecheesoftware.com
The AppleScript Sourcebook -
http://www.AppleScriptSourcebook.com
Vermont Recipes -
http://www.stepwise.com/Articles/VermontRecipes
_______________________________________________
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.