Re: setFrameAutosaveName question
Re: setFrameAutosaveName question
- Subject: Re: setFrameAutosaveName question
- From: Darkshadow <email@hidden>
- Date: Wed, 10 Mar 2004 20:21:53 -0500
The window controllers are overriding that - when you create a new
window controller, it automatically sets the autosave name to @"".
From the NSWindowController reference:
---------------------------------------------
initWithWindowNibName:
- (id)initWithWindowNibName:(NSString *)windowNibName
Returns an NSWindowController object initialized with windowNibName,
the name of the nib file (minus the .nib extension) that archives the
receivers window. The windowNibName argument cannot be nil. Sets the
owner of the nib file to the receiver. The default initialization turns
on cascading, sets the shouldCloseDocument flag to NO, and sets the
autosave name for the windows frame to an empty string.
----------------------------------------------
(Note that all of the init methods set the autosave name to an empty
string).
But, NSWindowController also has a way to reset the autoframe name
(though you'll have to do it manually):
---------------------------------------------
setWindowFrameAutosaveName:
- (void)setWindowFrameAutosaveName:(NSString *)name
Sets the name under which the windows frame (its size and location on
the screen) is saved in the defaults database. By default, name is an
empty string, causing no information to be stored in the defaults
database.
---------------------------------------------
Mike
On Mar 10, 2004, at 5:38 PM, Darrin Cardani wrote:
I am attempting to save the size and position of my document windows.
I have multiple windows per document, each with their own subclass of
NSWindowController controlling them. I read in the mamasam archives
that this may be part of my problem, but it wasn't clear if that's the
case.
The first thing I tried to do was to set the "Auto Save Name" field
for each window in Interface Builder. This had no effect at all.
Next, I made the document the delegate of each window, and added a
-windowDidResize: method that called -saveFrameUsingName: for each
window it was passed. This works for 1 run of the application. If you
run the app and change the window sizes, it saves them. If you quit
and re-run, the windows have the saved sizes and positions. If you
don't touch the windows and quit and re-run, all the windows return to
their original sizes and positions.
So what do I have to do to not erase the window positions if the user
doesn't change them?
Thanks,
Darrin
--
Darrin Cardani - email@hidden
President, Buena Software, Inc.
<http://www.buena.com/>
Video, Image and Audio Processing Development
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.