Re: Not getting KeyDown events (and other peculiar things)
Re: Not getting KeyDown events (and other peculiar things)
- Subject: Re: Not getting KeyDown events (and other peculiar things)
- From: "Shayne Wissler" <email@hidden>
- Date: Sat, 6 Dec 2008 10:53:42 -0700
Hello,
I'm resending this because it didn't seem to get through to the list:
On Fri, Dec 5, 2008 at 8:47 AM, Shayne Wissler <email@hidden> wrote:
> I'm writing something like a game engine using NSOpenGLView and am
> getting some odd behaviors (I am new to Cocoa):
>
> 1. Clicking on the title bar of my application does not activate my
> application, but clicking inside my window does. I can move the window
> around on the screen, but unlike all the other applications I must
> click inside the window to make it the main window.
>
> 2. The resize handle that's normally on the bottom right corner is not
> shown, but it is apparently there because when I click in that area
> and drag the window resizes. [window showsResizeIndicator] returns
> true even though the indicator isn't shown.
>
> 3. The worst problem is that I'm not getting key events even though I
> have defined these methods:
>
> - (BOOL)acceptsFirstResponder
> {
> return YES;
> }
>
> - (BOOL)becomeFirstResponder
> {
> return YES;
> }
>
> - (BOOL)canBecomeKeyView
> {
> return YES;
> }
>
> - (void)keyDown:(NSEvent*)theEvent
> {
> ...
> }
>
> - (void)keyUp:(NSEvent*)theEvent
> {
> ...
> }
>
> I am getting mouse events just fine, but when I click on a key, the
> keypress goes to the previously selected application, or if there is
> none, I just hear a "beep". I have printed out the status [[self
> window] isKeyWindow] on a mouseDown event and it is indeed true,
> making this seem even more bizarre to me.
>
> Note: I am not using nib files so "awakeFromNib" does not get called
> in my application.
>
> Any helpful comments would be appreciated!
>
>
> Shayne Wissler
>
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden