On 4 Sep 2008, at 15:48, Ken Thomases wrote:

On Sep 4, 2008, at 3:10 AM, Gerriet M. Denkmann wrote:

For an ordinary window one can set in IB "Auto Save Name:" and everything works as expected. I can give it a nice size and position and the next time I open it, all is fine.

But if this window is a document, controlled by some NSDocumentController, this Auto Save Name seems to be ingnored (at least on Tiger). This is annoying, as it forces me to size each new window again and again.

This is a bug in NSWindowController that's fixed in Leopard. Search for "New Behavior for NSWindowController Frame Autosave Names" in the Leopard AppKit release notes <http:// developer.apple.com/releasenotes/Cocoa/AppKit.html>.

You can work around it using -[NSWindowController setWindowFrameAutosaveName:].

I did:
- (void)windowControllerDidLoadNib:(NSWindowController *) aController
{
        [super windowControllerDidLoadNib:aController];
        [ aController setWindowFrameAutosaveName: DocumentWindowName ];
}

It "works" - but not as I was expecting it to work:
It sets (and remembers) the size/position of the first window.
But all subsequent windows will get the position from the nib and their size is never remembered.


This is (for my taste at least) much better:

- (void)windowControllerDidLoadNib:(NSWindowController *) aController
{
        [super windowControllerDidLoadNib:aController];
        [ myWindow setFrameUsingName: DocumentWindowName ];
        windowControllerHasLoadedNib = YES;
}

//      document is delegate for only its own window:
- (void)windowDidResize:(NSNotification *)aNotification
{
        if ( windowControllerHasLoadedNib )
                [ myWindow saveFrameUsingName: DocumentWindowName ];
}

same for windowDidMove:.


Kind regards,

Gerriet.

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to