• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: What Size My Window?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: What Size My Window?


  • Subject: Re: What Size My Window?
  • From: "Gerriet M. Denkmann" <email@hidden>
  • Date: Thu, 4 Sep 2008 22:11:51 +0700


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 (email@hidden)

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:
This email sent to email@hidden


References: 
 >What Size My Window? (From: "Gerriet M. Denkmann" <email@hidden>)
 >Re: What Size My Window? (From: Ken Thomases <email@hidden>)

  • Prev by Date: Re: Creating a runloop to handle specific mouse events
  • Next by Date: Re: understanding conversions between CF and NS datatypes
  • Previous by thread: Re: What Size My Window?
  • Next by thread: Re: What Size My Window?
  • Index(es):
    • Date
    • Thread