Hi to all,

I'm developing a tool for assistive input and my question is how can I
send a key event (like a keyboard press event) to the current window
(whatever this one could be), for data input.

I've tried the following, but only a beep is produced by my machine.

<snippet>
    id keyTarget = [[NSApp keyWindow] firstResponder];
    NSEvent *aKeyDownEvent = [NSEvent keyEventWithType:NSKeyDown
                location:NSMakePoint(0,0)
                modifierFlags:0
                timestamp:[NSDate timeIntervalSinceReferenceDate]
                windowNumber:[[NSApp keyWindow] windowNumber]
                context:[[NSApp keyWindow] graphicsContext]
                characters:@"Q"
                charactersIgnoringModifiers:@"Q"
                isARepeat:NO keyCode:0];
    [keyTarget keyDown:aKeyDownEvent];
</snippet>

Thank you in advance,
Daniel
_______________________________________________

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 [EMAIL PROTECTED]

Reply via email to