Re: How to save a window's position and size

2020-05-25 Thread Carl Hoefs via Cocoa-dev
You could try setting your self.masterViewController.view as self.window's initial first responder. (But I get the feeling you're "fighting the Frameworks" here...) -Carl > On May 25, 2020, at 11:48 AM, Gabriel Zachmann wrote: > > Thanks a lot for the response. >> >> [self.window setFrame

Re: How to save a window's position and size

2020-05-25 Thread Gabriel Zachmann via Cocoa-dev
Thanks a lot for the response. > >[self.window setFrame:[[NSScreen mainScreen] frame] display:YES]; It sort of works, but the window still has borders. I tried this: [self.window toggleFullScreen: nil]; and it makes the app start in real full-screen (no window borders), but then it does

Re: How to save a window's position and size

2020-05-25 Thread Carl Hoefs via Cocoa-dev
Something like this would work (in -applicationWillFinishLaunching:): [self.window setFrame:[[NSScreen mainScreen] frame] display:YES]; -Carl > On May 24, 2020, at 3:09 PM, Gabriel Zachmann wrote: > > Alternatively, is there a way to start it such that it always starts in > fullscreen, >

Re: How to save a window's position and size

2020-05-24 Thread Gabriel Zachmann via Cocoa-dev
>> >> No guarantees, but you could try moving your code into an AppDelegate method >> that gets invoked earlier: >> >> - (void)applicationWillFinishLaunching:(NSNotification *)notification; >> Sorry for bothering again. The above solutions works very well. Now I would like to make my app sta

Re: How to save a window's position and size

2020-05-23 Thread Gabriel Zachmann via Cocoa-dev
Looks good! Thanks! > On 23. May 2020, at 21:59, Carl Hoefs wrote: > > No guarantees, but you could try moving your code into an AppDelegate method > that gets invoked earlier: > > - (void)applicationWillFinishLaunching:(NSNotification *)notification; > > -Carl > smime.p7s Description: S

Re: How to save a window's position and size

2020-05-23 Thread Sandor Szatmari via Cocoa-dev
Gabriel, > On May 23, 2020, at 15:54, Gabriel Zachmann via Cocoa-dev > wrote: > > Actually, after observing the new behavior for a while, > I have to say it's "almost" perfect. > > The window still opens at some funny position with a smallish size (where is > that stored?), > but with no co

Re: How to save a window's position and size

2020-05-23 Thread Carl Hoefs via Cocoa-dev
No guarantees, but you could try moving your code into an AppDelegate method that gets invoked earlier: - (void)applicationWillFinishLaunching:(NSNotification *)notification; -Carl > On May 23, 2020, at 12:53 PM, Gabriel Zachmann wrote: > > Actually, after observing the new behavior for a wh

Re: How to save a window's position and size

2020-05-23 Thread Gabriel Zachmann via Cocoa-dev
Actually, after observing the new behavior for a while, I have to say it's "almost" perfect. The window still opens at some funny position with a smallish size (where is that stored?), but with no content, just grey inside, for a split second, then it snaps to the autosaved position/size. It's

Re: How to save a window's position and size

2020-05-23 Thread Gabriel Zachmann via Cocoa-dev
Seems to work like a charm! thanks a lot. (For the record: [self.window setDelegate: self]; has to be done before setFrameAutosaveName.) Best regards, Gabriel smime.p7s Description: S/MIME cryptographic signature ___ Cocoa-dev mailing list (Co

Re: How to save a window's position and size

2020-05-22 Thread Carl Hoefs via Cocoa-dev
The referenced documentation code (©2009) appears to be a wee bit outdated... Try supplying your own NSString for the auto save name, as [window representedFilename] no longer seems to return a valid NSWindowFrameAutosaveName. In AppDelegate.m I have this and it works: - (void)applicationDidFi

How to save a window's position and size

2020-05-22 Thread Gabriel Zachmann via Cocoa-dev
I am trying to follow these instructions: https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/WinPanel/Tasks/SavingWindowPosition.html However, my app doesn't have a NSWindowController. It just has a NSViewController and an AppDelegate. So i thought I could stick the two l