开发者

Cocoa: NSTextField and Fullscreen-Mode with enterFullScreenMode:

开发者 https://www.devze.com 2023-02-22 19:39 出处:网络
currently I\'m experimenting with the enterFullScreenMode: option of NSWindow making a subview of the window\'s contentView the new fullscreen view which works nice. However, my view contains a NSText

currently I'm experimenting with the enterFullScreenMode: option of NSWindow making a subview of the window's contentView the new fullscreen view which works nice. However, my view contains a NSTextField which behaves weird. When I switch to fullscreen mode it becomes inactive (seems to resign firstResponder status). I can use it just fine by clicking it and by calling

[myField becomeFirstResponder];

which is discouraged by the docs. They say I should always call

[myWindow makeFirstResponder: myField];

which does not work any more a开发者_如何学Gofter being in fullscreen mode. The weirdest thing however is that when entering something in the field and then exiting the entered text disappears. When switching back fast enough to fullscreen mode it might even be back again. Any idea what I'm doing wrong? Or any feedback on how to make the NSTextField resign firstResponder status in fullscreen mode without being using discouraged API calls?

Thanks in advance, Nicolas


You mean in 10.6 right?

[myWindow makeFirstResponder: myField];

enterFullScreenMode will make a new window for the view, so myWindow actually is the window before entering fullscreen.

you should use

[[self window] makeFirstResponder: myField];
0

精彩评论

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