Window Position and Size Restored


Dave
 

Hi,

Mac, Manual Layout.

I’m trying to reset the Window Position Size each time my App is run. When I run it under Debug, the Window Position keeps getting restored (AFAICT), I’ve subclassed NSWindow awakeFromNib and have tried resetting the Window FrameRect, but it doesn’t seem to have any affect. I’ve checked and it is getting called ok. I’ve tried setting the Frame before super awakeFromNib is called, but no effect.

-(void) awakeFromNib
{
[super awakeFromNib];

[self setFrame:NSMakeRect(0,0,256,256) display:YES];
}

Any suggestions or help greatly appreciated.

All the Best
Dave


Jon Gotow
 

See NSWindow.frameAutosaveName. That should take care of it for you.

- Jon

On Sep 17, 2018, at 8:56 AM, Dave <dave@...> wrote:

I’m trying to reset the Window Position Size each time my App is run. When I run it under Debug, the Window Position keeps getting restored (AFAICT), I’ve subclassed NSWindow awakeFromNib and have tried resetting the Window FrameRect, but it doesn’t seem to have any affect. I’ve checked and it is getting called ok. I’ve tried setting the Frame before super awakeFromNib is called, but no effect.


Andy Lee
 

Try unchecking the "Restorable" checkbox in IB.  I don't know why you aren't able to manually "override" this.


--Andy

On Sep 17, 2018, at 10:56 AM, Dave <dave@...> wrote:

Hi,

Mac, Manual Layout.

I’m trying to reset the Window Position Size each time my App is run. When I run it under Debug, the Window Position keeps getting restored (AFAICT), I’ve subclassed NSWindow awakeFromNib and have tried resetting the Window FrameRect, but it doesn’t seem to have any affect. I’ve checked and it is getting called ok. I’ve tried setting the Frame before super awakeFromNib is called, but no effect.

-(void) awakeFromNib
{
[super awakeFromNib];

[self setFrame:NSMakeRect(0,0,256,256) display:YES];
}

Any suggestions or help greatly appreciated.

All the Best
Dave






Dave
 

Got it thanks, I knew there was a property for it somewhere, but was looking in the wrong pane.

On 17 Sep 2018, at 17:07, Jon Gotow <gotow@...> wrote:

See NSWindow.frameAutosaveName. That should take care of it for you.

- Jon


On Sep 17, 2018, at 8:56 AM, Dave <dave@...> wrote:

I’m trying to reset the Window Position Size each time my App is run. When I run it under Debug, the Window Position keeps getting restored (AFAICT), I’ve subclassed NSWindow awakeFromNib and have tried resetting the Window FrameRect, but it doesn’t seem to have any affect. I’ve checked and it is getting called ok. I’ve tried setting the Frame before super awakeFromNib is called, but no effect.