Window frame autosave

  • Hello all,

    I've just hit something really strange - my preferences window never
    saves it's position. I've set the controller not to cascade windows
    and tried all three methods of saving the frame: NSWindow's
    autosaveFrame..., manually restoring the frame in awakeFromNib and
    saving in windowWillClose and using the NSWindowController's frame
    autosaving - nothing works. I'm really puzzled why it's doing that.
    Any hints are greatly appreciated.

    Kind regards,
    David
  • On Oct 13, 2006, at 2:59 PM, David Aames wrote:

    > Hello all,
    >
    > I've just hit something really strange - my preferences window
    > never saves it's position. I've set the controller not to cascade
    > windows and tried all three methods of saving the frame: NSWindow's
    > autosaveFrame..., manually restoring the frame in awakeFromNib and
    > saving in windowWillClose and using the NSWindowController's frame
    > autosaving - nothing works. I'm really puzzled why it's doing that.
    > Any hints are greatly appreciated.

    Just a thought: are you using runModalForWindow: to display your
    preferences window?  If so (from the docs):

    "- (int)runModalForWindow:(NSWindow *)aWindow
    ...
    The window aWindow is placed on the screen using the NSWindow method
    center..."

    pete
  • On 13 Oct 2006, at 21:18, Peter Schart wrote:

    >
    > On Oct 13, 2006, at 2:59 PM, David Aames wrote:
    >
    >> Hello all,
    >>
    >> I've just hit something really strange - my preferences window
    >> never saves it's position. I've set the controller not to cascade
    >> windows and tried all three methods of saving the frame:
    >> NSWindow's autosaveFrame..., manually restoring the frame in
    >> awakeFromNib and saving in windowWillClose and using the
    >> NSWindowController's frame autosaving - nothing works. I'm really
    >> puzzled why it's doing that. Any hints are greatly appreciated.
    >
    >
    > Just a thought: are you using runModalForWindow: to display your
    > preferences window?  If so (from the docs):

    No, I'm not. I'm instantiating a window controller and calling
    [controller showWindow:self];. The window is set not to be visible at
    launch (I don't think this matter since I have another window which
    is not visible at launch and saves its frame just ok). I'm really
    puzzled why this is happening.

    Thanks,
    David

    >
    > "- (int)runModalForWindow:(NSWindow *)aWindow
    > ...
    > The window aWindow is placed on the screen using the NSWindow
    > method center..."
    >
    > pete
  • Hello again,

    I found a solution - the autosave function would only work in this if
    it's the last thing I call in windowDidLoad: - no idea why but that
    is it. I'm not sure if I've hit some kind bug or I'm abusing in some
    way Cocoa.

    Regards,
    David

    On 13 Oct 2006, at 21:18, Peter Schart wrote:

    >
    > On Oct 13, 2006, at 2:59 PM, David Aames wrote:
    >
    >> Hello all,
    >>
    >> I've just hit something really strange - my preferences window
    >> never saves it's position. I've set the controller not to cascade
    >> windows and tried all three methods of saving the frame:
    >> NSWindow's autosaveFrame..., manually restoring the frame in
    >> awakeFromNib and saving in windowWillClose and using the
    >> NSWindowController's frame autosaving - nothing works. I'm really
    >> puzzled why it's doing that. Any hints are greatly appreciated.
    >
    >
    > Just a thought: are you using runModalForWindow: to display your
    > preferences window?  If so (from the docs):
    >
    > "- (int)runModalForWindow:(NSWindow *)aWindow
    > ...
    > The window aWindow is placed on the screen using the NSWindow
    > method center..."
    >
    > pete
  • In your preferences window, are you using a toolbar to switch
    views, auto-resizing the window in the process?

    --
    I.S.

    On Oct 13, 2006, at 4:24 PM, David Aames wrote:

    > No, I'm not. I'm instantiating a window controller and calling
    > [controller showWindow:self];. The window is set not to be visible
    > at launch (I don't think this matter since I have another window
    > which is not visible at launch and saves its frame just ok). I'm
    > really puzzled why this is happening.
  • On 13 Oct 2006, at 21:35, I. Savant wrote:

    >
    > In your preferences window, are you using a toolbar to switch
    > views, auto-resizing the window in the process?
    >

    Yup - I'm using a toolbar.
    Yup - auto-resizing after the window is loaded.

    Now it makes sense - the autosave method is called after the
    animation so it is able to restore it properly.

    Thanks for your help,
    David

    > --
    > I.S.
    >
    >
    > On Oct 13, 2006, at 4:24 PM, David Aames wrote:
    >
    >> No, I'm not. I'm instantiating a window controller and calling
    >> [controller showWindow:self];. The window is set not to be visible
    >> at launch (I don't think this matter since I have another window
    >> which is not visible at launch and saves its frame just ok). I'm
    >> really puzzled why this is happening.
    >
previous month october 2006 next month
MTWTFSS
            1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31          
Go to today