triggering an NSMenuItem to speak as needed
triggering an NSMenuItem to speak as needed
- Subject: triggering an NSMenuItem to speak as needed
- From: Martin Wierschin <email@hidden>
- Date: Wed, 24 Sep 2008 00:12:44 -0700
Hello all,
I'm trying to programmatically activate an NSMenuItem so that both
its action and any feedback cues (eg: VoiceOver) are triggered. The
menu being activated is within my own application. I've tried the
NSMenuItem APIs, eg:
NSMenuItem* item = whatever;
unsigned idx = [[item menu] indexOfItem:item];
[[item menu] performActionForItemAtIndex:idx];
-or-
[[item menu] performKeyEquivalent:fakedUniqueEvent];
But neither trigger VoiceOver, nor the visual highlighting in the
menu bar.
Now I'm attempting to see what happens when the menu item is prodded
into action using the Accessibility API, but I'm not getting very
far. This is the first time I've used the API, so maybe I'm making
some obvious mistake. This was the first attempt:
[item accessibilityPerformAction:NSAccessibilityPressAction];
Simple enough, but it just throws an exception. Apparently NSMenuItem
doesn't respond to that method. I thought perhaps it was necessary to
walk the accessibility hierarchy manually, to allow the creation of
the proper objects, but that doesn't go very far either:
NSObject* menuBar = [NSApp
accessibilityAttributeValue:NSAccessibilityMenuBarAttribute];
NSArray* children = [menuBar
accessibilityAttributeValue:NSAccessibilityChildrenAttribute];
Again, an exception is thrown because NSMenu doesn't respond to the
accessibility method.
Any ideas on how I might accomplish the end goal of triggering
VoiceOver for a menu item? What's the correct approach to inspecting
the menu system from the accessibility API?
Thanks for any help,
~Martin
_______________________________________________
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