开发者

Handling events in NSWindow

I'm trying to handle key events of full-screen NSWindow. I've subclassed NSWindow and realized methods keyDown and canBecomeKeyWindow (which is returning YES). But my key events are not handling. Here is how i'm creating window:

    mainWindow = [[FullScreenWindow alloc] initWithContentRect:screenRect
                                             styleMask:NSBorderlessWindowMask
                                               backing:NSBackingStoreBuffered
                                                 defer:NO screen:[NSScreen m开发者_StackOverflow社区ainScreen]];

    [mainWindow setLevel:windowLevel];

    [mainWindow setBackgroundColor:[NSColor blackColor]];
    [mainWindow makeKeyAndOrderFront:nil];

Where FullScreenWindow is a subclass of NSWindow. What am i doing wrong?


The esc key already exists fullscreen by default, you don't have to implement It (tested on 10.10.4).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜