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



> 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,

AppKit is just a set of libraries - you can use them from any UNIX
executable - certain things dont work if you arent logged in on
the console (because they require a connection to the window server)
but other than that theres no real problem. All an 'app' is, after all,
is a UNIX program executable plus some miscellaneous files inside a directory
ending in .app.

> are you running the run-loop? They don't start automatically in

No, there is no run loop going on. I am doing my own by taking events
off the event queue and passing through anyn that I am not interested in.
This works fine, but keypress events never end up on the event queue for
the program.

In case you think this is a very odd thing to do, by the way, its because
the program is a port of an X11 program (in this case xmame, but there are
a number of them that I have proted this way over the years). So I am
fitting AppKit stuff onto somethign which is intended to drive a
procedural windows interface - i.e. I get called as create_window() function
and then have a refresh() function called by the main code in a loop. It
is inside that where I need to get the keypresses and also update the
window (and flush it to the window server).

> command-line programs. Second, did you make the window into the first
> responder? Can it accept that status?

Good point - hadnt thought to check that. I am sending the window a
makeKeyAndOrderFront message. Mouse clicks are getting through O.K.
though. Thats the next thing to check I guess.

It occurs to me that maybe this is a change to terminal.app so that it
always intercepts key events for a running process possibly ?

Thanks for the advice on checking the responder though. will look into
that now.

cheers,

-bat.
_______________________________________________
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: 
 >Re: Problem receiving key events in CLI created window (From: Dustin Voss <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.