• 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: removeFrameUsingName: doesn't?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: removeFrameUsingName: doesn't?


  • Subject: Re: removeFrameUsingName: doesn't?
  • From: Mike Fischer <email@hidden>
  • Date: Thu, 28 Feb 2008 21:25:54 +0100

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.

_______________________________________________

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


  • Follow-Ups:
    • Re: removeFrameUsingName: doesn't?
      • From: Quincey Morris <email@hidden>
References: 
 >removeFrameUsingName: doesn't? (From: Mike Fischer <email@hidden>)

  • Prev by Date: CATextLayer metrics
  • Next by Date: Re: Setting iTunes album art with ScriptingBridge
  • Previous by thread: removeFrameUsingName: doesn't?
  • Next by thread: Re: removeFrameUsingName: doesn't?
  • Index(es):
    • Date
    • Thread