On Jul 21, 2011, at 5:22 PM, Joe Turner wrote:

> So I've been having some issues with posting a CGEvent with a function key as 
> a modifier (or flag). If I call CGEventSetFlags(eventDown, 
> kCGEventFlagMaskSecondaryFn), and then post the event, all I get is the 
> keyCode posting (as in maybe the left arrow is pressed), but the function key 
> is not virtually pressed. As far as I can tell kCGEventFlagMaskSecondaryFn is 
> for the function key modifier, so I'm not sure why this isn't working. Any 
> help would be appreciated!


The Mac responds to sequences of keyboard events, such as key-down followed by 
key-up, or modifier-key-down followed by key-down followed by key-up followed 
by modifier-key-up. So you have to post all of the relevant key-down and key-up 
events before you can expect the target application to respond. As I recall, 
the set flags command isn't meant to be used as part of that sequence; instead, 
you need to send key-down and key-up events for the specified modifier key. I 
believe there are examples of how to do this somewhere in the Quartz Event 
Services Reference document.

You might also find it useful to experiment with my free Event Taps Testbench 
utility at <http://pfiddlesoft.com/eventtapstestbench>.

You will get more focused responses to inquiries about this on Apple's 
accessibility-dev mailing list, where Apple's accessibility engineers hang out.

-- 

Bill Cheeseman - b...@cheeseman.name

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to