开发者

NSTextView wont update unless I click on it, and it wont focus. Any ideas?

I dont have time right this second to put some sample code, (Ill edit my question tomorrow and add some) but basically what happens is that I have a Window. It works fine usually, but if I use

 [myWindow setStyleMask:NSBorderlessWindowMask]

to make it borderless, the NSTextView it contains will stop gaining focus even when you click on it: the ring will never appear, the cursor wont change and the scroll bar will remain gray.

Something else that happens when I make it borderless is that it wont update! I basically have this

 [lyricsView setString:someString];

to update the string inside it. The Console marks me no errors, but the string wont appear in the Text View unless I click on it.

All of this stops happening if I remove the line setting the styleMask to Borderless. Any ideas? Suggest开发者_如何学Goions? Comments? Cheers?

Thank You! Kevin


From the documentation of NSWindow:

The NSWindow implementation returns YES if the window has a title bar or a resize bar, or NO otherwise.

So subclass your window and add this line

   -(BOOL)canBecomeKeyWindow
   {
        return YES;
   }
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜