Changing the window a NSWindowController manages
Changing the window a NSWindowController manages
- Subject: Changing the window a NSWindowController manages
- From: Andrew Hunter <email@hidden>
- Date: Wed, 19 Oct 2005 16:06:52 +0200
Hi,
I have an application that has an optional full-screen mode. I used to
deal with this by just turning off the menu and scaling the window to
fit the screen, but OS X 10.4 seems to have changed the behaviour of
[NSWindow frameRectForContentRect:styleMask:] so that you can no
longer place the titlebar off the screen. There doesn't seem to be a
way of turning the title bar off, so the best way to go would seem to
be to use a borderless window while in fullscreen mode and the
standard window at all other times.
I would quite like to be able to continue to use the same
WindowController with both windows: otherwise I'm creating a problem
for myself as I would need to transfer view state between two new
objects, so I'm currently trying creating two windows and switching
between them in my window controller as follows:
[normalWindow setDelegate: nil];
[fullScreenWindow setDelegate: self];
[fullScreenWindow setWindowController: self];
[fullScreenWindow makeKeyAndOrderFront: self];
[normalWindow orderOut: self];
(also I'm moving the important views from one window to the other
here, but I don't think this is the cause of my problem).
I use the reverse of this to switch from full-screen to normal mode.
The problem I'm getting occurs here, because when I call
makeKeyAndOrderFront: on the normal window, I get this fairly
nonsensical exception:
NSWindow: -_oldFirstResponderBeforeBecoming is not a valid message
outside of a responder's implementation of -becomeFirstResponder.
I've tried running with NSZombieEnabled, and I'm pretty sure that
nothing's being deallocated that shouldn't have been. The main
difference between normalWindow and fullScreenWindow is that
normalWindow is allocated by a nib, and fullScreenWindow is allocated
manually when the user first enters full screen mode.
What makes this weirder: after the exception, if I hit the fullscreen
toggle again (the exception means at this point the app still believes
it's in full screen mode, so it runs the 'normal size' code again),
the code runs successfully, but the normal window is blown up to full
screen size - which is odd because setFrame: is never called on it.
Toggling to full-screen again after this works without exception, but
every first toggle back again causes the exception.
Does anyone know what can cause this exception? It's thrown from
somewhere within makeKeyAndOrderFront: (and is also thrown if I just
call orderFront:) I'm presuming that this is something to do with the
window juggling I'm doing - the major difference between the first and
second time I try to swap the windows over is that the window
controller is already controlling the normal window the second time
through.
Andrew.
--
Andrew Hunter. http://www.logicalshift.demon.co.uk
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden