Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Saving window sizes and positions

Saving window sizes and positions
Thread Tools
Professional Poster
Join Date: Nov 2000
Location: Tasmania, Australia
Status: Offline
Reply With Quote
Nov 24, 2002, 10:05 PM
 
I'm about to start implementing storing preferences for an applications, including window sizes and positions. I read the following quoted text on a Cocoal development web site about saving preferences, but cannot make out what they're talking about.

Are they trying to say that there's a Cocoa way of saving window positions other than storing them as integers in [NSUserDefaults standardUserDefaults] ?

If so, what is the easier way?

What are these guys trying to say???

A nice Mac custom is to save the position of windows.

Your gut reaction might be to say "Let's save them to our preferences!" You could do this... or you could let Cocoa do it for you. This is a very common task, so Apple has courteously provided a very simple method.

How does the program identify the window? By its title? Nope, that can't be because a window's title can be localized to different languages. Wait a sec... what's this nifty "Name" field for? Maybe you should just try it out. It works. Pretty simple, huh? (Man, I sound like Steve...)
     
Mac Elite
Join Date: Feb 2001
Location: adrift in a sea of decadent luxury and meaningless sex
Status: Offline
Reply With Quote
Nov 24, 2002, 10:51 PM
 
simply entering a value in the "autosave name" field in Interface Builder will automatically save and restore your window's position in the user defaults. you can even go in and see what it records in xml.
blackmail is such an ugly word. I prefer extortion. the X makes it sound cool
     
Brass  (op)
Professional Poster
Join Date: Nov 2000
Location: Tasmania, Australia
Status: Offline
Reply With Quote
Nov 25, 2002, 03:17 PM
 
Originally posted by lucylawless:
simply entering a value in the "autosave name" field in Interface Builder will automatically save and restore your window's position in the user defaults. you can even go in and see what it records in xml.
Thankyou for clarifying that for me. I can't believe I didn't notice that myself! It's obvious once I open my eyes
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 06:24 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2