1
votes

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 after 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

1
Okay, hold your horses. I just found out (hope this helps someone). When putting a view into fullscreen mode Cocoa will assign it two a new window of the class _NSFullScreenWindow. So you can still call [[myField window] makeFirstResponder:myField]... Maybe I'll crack the weird behaviour now, too. Will comment back if so.Nicolas

1 Answers

1
votes

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];