Re: When does -[NSWindow sendEvent:] beep?
Re: When does -[NSWindow sendEvent:] beep?
- Subject: Re: When does -[NSWindow sendEvent:] beep?
- From: Jason Harris <email@hidden>
- Date: Tue, 20 Feb 2007 14:44:32 -0700
I believe that this happens when nothing in the responder chain can
interpretKeyEvent for the key you send.
Jason
On Feb 20, 2007, at 1:45 PM, David Catmull wrote:
For purposes of automated testing, I'm trying to create keyboard
events using -[NSEvent keyEventWithType:etc].
const char lower = tolower(inChar);
const char chars[2] = { inChar,0 },unmodChars[2] = { lower,0 };
NSEvent *event = [NSEvent
keyEventWithType:NSKeyDown
location:[NSEvent mouseLocation]
modifierFlags:nsModifiers
timestamp: ::GetCurrentEventTime()
windowNumber:0
context:[NSGraphicsContext currentContext]
characters:[NSString stringWithCString:chars
encoding:NSASCIIStringEncoding]
charactersIgnoringModifiers:[NSString stringWithCString:unmodChars
encoding:NSASCIIStringEncoding]
isARepeat:NO
keyCode:inVirtualKey];
This works for regular text typing, but for the arrow key it just
beeps, whether I use 0x7E as in Carbon or NSUpArrowFunctionKey
(with -[NSString stringWithCharacters:length:] instead). Where am I
going wrong?
--
David Catmull
email@hidden
http://www.uncommonplace.com/
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
40geekspiff.com
This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden