Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problem receiving key events in CLI created window



On Thursday, July 17, 2003, at 05:40 AM, Pete French wrote:

O.K., I have a very frustrating problem with a piece of long
standing code which has stopped working on the latest version
of OSX. The code worked fine on the public beta (last version I
had before Jaguar) and also on Rhapsody and OpenStep before that.

Which is kind of frustrating.

I have acommandline program which, when run, opens a window and draws into
it. It also receives events in that window using this:

event = [NSApp nextEventMatchingMask:NSAnyEventMask
untilDate:the_past inMode:NSDefaultRunLoopMode dequeue:YES];

where 'the_past' is set to [NSDate distantPast] so that the call returns
immediately. For key events I process them myself, all other events are
then passed on using [NSApp sendEvent:event];

When I run the program I find that key events are still captured by the
terminal! Even with the window key and to the front, if I type then
the keypresses appear in the shell window the application is running from.

I am completely at a loss as to how to fix this, or what has changed to make
this suddenly stop working after five years!

I don't know what might have changed, or even how you are able to use AppKit in a command-line program, but I would check two things. First, are you running the run-loop? They don't start automatically in command-line programs. Second, did you make the window into the first responder? Can it accept that status?

Not much help, I know. Good luck.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >Problem receiving key events in CLI created window (From: Pete French <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.