On Sep 21, 2010, at 2:41 PM, AstroK Software wrote:

> So I am writing a Cocoa application for disabled that must be able to send 
> key presses to background application. For that I am using 
> AXUIElementPostKeyboardEvent which works quite fine, except when I want to 
> send key presses to Carbon apps like Microsoft Word or iTunes when they are 
> in the background. For Cocoa apps there is no absolutely no problem! Have you 
> ever encountered a behavior like this?
> 
> This is strange because when Carbon apps are in the foreground it works fine. 
> Do you think it could be related to the fact that my application is written 
> in Cocoa?

It's more likely that it's because the target apps are Carbon-based. I'm sure 
you'd see the same behavior regardless of whether your app is Carbon or Cocoa.

The exact behavior may be dependent on the specific app, but it's likely that 
when the application moves to the background, its key window loses focus, and 
when the keyboard event arrives, the app doesn't know where to send it (because 
no window is key) and therefore ignores it. 

-eric

_______________________________________________

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