views:

27

answers:

1

I'm trying to write a program that serves to toggle a secondary click for a one button HID (in this case a touch screen). What I want to do is have the user touch a button on the screen that makes the next touch a right click. I simply don't know where to begin on this. I began by looking to Applescript, but found that this is impossible. Any help would be greatly appreciated.

A: 

You are looking for OS X's event tap mechanism. Event taps are used to find and modify low level events.

In your app you would set an event tap to find mouse down events and insert key down/up events into the event stream for the modifier keys where neccessary.

Nikolai Ruhe
Or even change the type of event from a left-mouse-down/-dragged/-up to a right-mouse-down/-dragged/-up. See http://developer.apple.com/library/mac/#documentation/Carbon/Reference/QuartzEventServicesRef/Reference/reference.html%23//apple_ref/c/func/CGEventSetType and http://developer.apple.com/library/mac/#documentation/Carbon/Reference/QuartzEventServicesRef/Reference/reference.html%23//apple_ref/c/tdef/CGEventType .
Peter Hosey