NSWindowMBS saveFrameUsingName and setFrameUsingName problem

I’m using the function saveFrameUsingName and setFrameUsingName to save and load window positions. At a Zoom call with a user I saw a window where the title bar is under the menu bar.

User:

Expected:

Of course, I could delete his preferences to solve the issue.

But how did this happen? I changed my relatively complex code to use something more simple and don’t want to start checking the frame again.

Sorry, I don’t use this particular MBS feature, but could the user have had the MenuBar set to automatically hide when that window was previously opened? Or could going in and out of Fullscreen mode do something like this?

Or does this MBS feature compensate automatically for such scenarios?

I have three monitors with each at a different height. Sometimes when a Xojo window launches on a different screen its menu will be hidden on a shorter monitor.

I have a menu shortcut to toggle FullScreen in case a user gets stuck this way as, returning from fullscreen, macOS adjusts the Top of the window correctly.

Well, the system may save position.
Xojo may do some things to make positioning work in Xojo.

Maybe you can work around by checking window position at showing time and move it down below the menubar if it is too high.

@Scott_C : the MBS feature is a wrapper for macOS feature which should account for all scenarios.

@David_Cox : good idea. I’ll try that.

@Christian_Schmitz : I’d rather not go back to my convoluted code.