开发者

Cocoa/OSX - NSTextField not responding to click for text editing to begin when titlebar is hidden

开发者 https://www.devze.com 2023-04-09 23:16 出处:网络
I have a NSTextField in my window (added wit开发者_如何学Pythonh IB) with a hidden title bar but when I click on it when the app is running, it does not respond or place a cursor in its field. Is ther

I have a NSTextField in my window (added wit开发者_如何学Pythonh IB) with a hidden title bar but when I click on it when the app is running, it does not respond or place a cursor in its field. Is there anything I am doing wrong? it is setup in the most standard way possible, an editable textfield on a window.

Thanks.


Create a custom class that inherits from NSWindow, and set it as the NSWindow Object in InterfaceBuilder. Then override the following methods:

//
// canBecomeKeyWindow
//
// Overrides the default to allow a borderless window to be the key window.
//
- (BOOL)canBecomeKeyWindow
{
    return YES;
}

//
// canBecomeMainWindow
//
// Overrides the default to allow a borderless window to be the main window.
//
- (BOOL)canBecomeMainWindow
{
    return YES;
}
0

精彩评论

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

关注公众号