NSBorderlessWindowMask and key events

Monday, June 12 2006 @ 05:28 PM BST

Contributed by: Admin

When a window is created with NSBorderlessWindowMask, it doesn't receive key events anymore.
How to solve that ?

You have to create you own subclass of

NSWindow
and implements the following methods:

- (BOOL) canBecomeKeyWindow
{
    return YES;
}

- (void)keyDown:(NSEvent *)theEvent
{
    // your code here
}

- (void)keyUp:(NSEvent *)theEvent
{
    // your code here
}
and of course don't forget to change your initialization code to use the new window class or to change the class of the window in your nibs.

1 comments



http://www.macosxguru.net/article.php?story=20060612172854896