Accessing the context menu.
Accessing the context menu.
- Subject: Accessing the context menu.
- From: "Corey O'Connor" <email@hidden>
- Date: Wed, 1 Nov 2006 14:59:33 -0800
I'm playing around with trying to access the context menu of
applications using the accessibility API. As far as I can tell there
is no attribute to do so directly. I started playing with simulating a
right-click on the element who's context menu is desired. The code I
use to simulate the right click is:
// Post mouse-down
CGEventRef the_event = CGEventCreate(NULL);
CGEventSetType(the_event,kCGEventRightMouseDown);
CGEventSetLocation(the_event,center_of_element_of_interest);
CGEventPost(kCGSessionEventTap,the_event);
// ... mouse-up
CGEventSetType(the_event,kCGEventRightMouseUp);
CGEventPost(kCGSessionEventTap,the_event);
This kinda works. For the most part I can programmatically bring up
the context menu. Except in iTunes: iTunes moves the mouse and
highlights the element at the click point but no menu is produced. Is
there a better way to post events such that iTunes correctly
interprets the event as a right-click?
I guess a more basic question is: What is the recommended way to
access the context menu? Or is there no possible method?
--
-Corey O'Connor
_______________________________________________
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