Skip navigation.
 
mlremoveFrameUsingName: doesn't?
FROM : Mike Fischer
DATE : Tue Feb 26 21:23:30 2008

Hi!

I'm trying to remove the saved window frame of a window from the 
application preferences. So let's say I have a global:

NSString *name = @"My_window_name";  // Actually the name I am using 
is UUID so it should be globally unique.

The NSWindow gets initialized using [window 
setFrameAutosaveName:name]; This works fine and saves/restores the 
window frame.

Then later on I want to remove the saved frame from the prefs. I 
tried to use

[NSWindow removeFrameUsingName:name];

But it does not seem to work. The prefs file still contains the frame 
for the window (key: "NSWindow Frame My_window_name"). (Yes, I made 
sure that the prefs where synchronized and I even quit the app to be 
sure I wasn't seeing any caching effects.)

Then, thinking that somehow the window might undo my deletion, I tried:

[window setFrameAutosaveName:@""];
[NSWindow removeFrameUsingName:name];

as well as:

[NSWindow removeFrameUsingName:name];
[window setFrameAutosaveName:@""];

But neither of these variants made any difference.


I can of course delete the saved window frame by doing the following:

[[NSUserDefaults standardUserDefaults] removeObjectForKey:[NSString 
stringWithFormat:@"NSWindow Frame %@",name]];

But that relies on knowledge of Cocoa internals which I would rather 
avoid.

I'm testing this on Mac OS X 10.4.11 (PPC).


I couldn't find any related comments in the list archives or via 
Google. So, any idea what I'm doing wrong? Is this a bug in Cocoa, 
i.e. does this work for anyone else?


Thanks!
Mike
--
Mike Fischer        Softwareentwicklung, EDV-Beratung
                                    Schulung, Vertrieb
Web: <http://homepage.mac.com/mike_fischer/index.html>
Note:                I read this list in digest mode!
          Send me a private copy for faster responses.

Related mailsAuthorDate
mlremoveFrameUsingName: doesn't? Mike Fischer Feb 26, 21:23
mlRe: removeFrameUsingName: doesn't? Mike Fischer Feb 28, 21:25
mlRe: removeFrameUsingName: doesn't? Quincey Morris Feb 28, 22:22