Re: When does -[NSWindow sendEvent:] beep?
Re: When does -[NSWindow sendEvent:] beep?
- Subject: Re: When does -[NSWindow sendEvent:] beep?
- From: Joar Wingfors <email@hidden>
- Date: Wed, 21 Feb 2007 00:01:27 +0100
On Feb 20, 2007, at 9:45 PM, David Catmull wrote:
For purposes of automated testing, I'm trying to create keyboard
events <snip>
You might want to have a look at the functionality provided by
CGRemoteOperation.h for this type of work.
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?
Are you sure that the NSStrings are created correctly? Do they look
OK when printed (You might need to print them to something that is
aware of Unicode, like a NSTextField)? I wouldn't assume ASCI
encoding in this case, and I suspect that "tolower" might not be
Unicode safe. Use the functionality provided by NSString to make that
type of adjustments once you have a valid NSString. Btw. Why do you
assume that you should create a lowercase string for that parameter?
Perhaps it's a valid assumption in your case, it just seems a bit
strange.
Have you tried something like this?
unichar key = NSUpArrowFunctionKey;
NSString *keyStr = [NSString stringWithCharacters: &key length: 1];
j o a r
_______________________________________________
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