FROM : Mike Fischer
DATE : Thu Feb 28 21:25:54 2008
OK, nobody answered so I did a further test:
I created a new Cocoa application project, modified the nib so that
the Window had an Auto Save Name "xyz" and then added an AppControler
class with a single IBAction and connected it up. The IBAction looks
like this:
- (IBAction)handleDeleteAutosaveFrame:(id)sender
{
NSString *s = [fWindow frameAutosaveName];
if ([s length] > 0) {
[fWindow setFrameAutosaveName:@""];
[NSWindow removeFrameUsingName:s];
}
}
The first time I ran the app I adjusted the window position an size
and then quit the app. As expected the prefs file contained the
"NSWindow Frame xyz" key.
Then I relaunched the app, used the IBAction to remove the Auto Save
Name and quit the app again. The key was still there! So it's a bug
in AppKit/Cocoa it seems. NSWindow -removeFrameUsingName: does
nothing at all AFAICT.
The same thing happens (doesn't happen) on Leopard 10.5.2 on Intel.
And again switching the two statements around doesn't make any
difference.
I filed a bug: <rdar://5771541>
Mike
Am 26.02.2008 um 21:23 schrieb Mike Fischer:
> 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.
>
--
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.
DATE : Thu Feb 28 21:25:54 2008
OK, nobody answered so I did a further test:
I created a new Cocoa application project, modified the nib so that
the Window had an Auto Save Name "xyz" and then added an AppControler
class with a single IBAction and connected it up. The IBAction looks
like this:
- (IBAction)handleDeleteAutosaveFrame:(id)sender
{
NSString *s = [fWindow frameAutosaveName];
if ([s length] > 0) {
[fWindow setFrameAutosaveName:@""];
[NSWindow removeFrameUsingName:s];
}
}
The first time I ran the app I adjusted the window position an size
and then quit the app. As expected the prefs file contained the
"NSWindow Frame xyz" key.
Then I relaunched the app, used the IBAction to remove the Auto Save
Name and quit the app again. The key was still there! So it's a bug
in AppKit/Cocoa it seems. NSWindow -removeFrameUsingName: does
nothing at all AFAICT.
The same thing happens (doesn't happen) on Leopard 10.5.2 on Intel.
And again switching the two statements around doesn't make any
difference.
I filed a bug: <rdar://5771541>
Mike
Am 26.02.2008 um 21:23 schrieb Mike Fischer:
> 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.
>
--
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 mails | Author | Date |
|---|---|---|
| Mike Fischer | Feb 26, 21:23 | |
| Mike Fischer | Feb 28, 21:25 | |
| Quincey Morris | Feb 28, 22:22 |






Cocoa mail archive

