Some minutes ago I created a new Desktop app (macos), I added some label and textinputs and started it. This app starts completely outside of my desktop, every time i run it.
I tried to reproduce that with another new desktop app. Everything works. Any idea why?
I see the Problem now. I have two screens. The main one is my MacBookPro 13". And second one is 32" Display. Resolution on the 32" Display is much bigger than on MacBook. The external Display is my main working screen. The Macbook is just for Mail etc.
The App starts on the MacBook Screen. The default window is bigger then the MacBookSceen. In that case it is opend above the sceen. I can only see a litte bit of the bottom.
At the moment I see no way to get it down or moved to the other screen (perhaps in code, but that is just a crazy workaround). For me that is reproduceable.
Yes, ok. But that is even only a workaround. The Problem is, the Window (or the Titlebar if its to big) should not be placed outside of the view. Windows could be bigger then the view, that should not result in an unmmanangeable situation.
But, if you put the application into an unmanageable situation then it is up to you to solve it. Consider a fixed size window that is larger than your only screen, what is the system or Xojo supposed to do about that?
For your average resizable windows then the Zoom function on the Window menu (assuming you have followed apples guidelines and implemented one) will resize the window to fit. macOS now allows windows to be resized from any edge, they didn’t used to be able to.
The same every other App / IDE does, too. Putting the window in a place where the titlebar is displayed.
If you only have access to the bottom, you can do nothing with this window.
Even if you resize the window, if the titlebar is not accessible, this doesn’t change anything.
If that is your preference then add this to your windows open event. The following code works with more than one screen.
// Use window centre to figure out which screen we are on.
Var iDisplay As Integer = WhichScreen( Self.Left + ( Self.Width / 2 ), Self.Top + ( Self.Height / 2 ) )
Var DisplayMinWinTop As Integer = DesktopDisplay.DisplayAt( iDisplay ).AvailableTop + ( Self.Top - Self.Bounds.Top )
If Self.Top < DisplayMinWinTop Then
Self.Top = DisplayMinWinTop
Public Function WhichScreen(x As Integer, y As Integer) As Integer
Var oDisplay As DesktopDisplay
For iDisplay As Integer = 0 To DesktopDisplay.LastDisplayIndex
oDisplay = DesktopDisplay.DisplayAt( iDisplay )
If x >= oDisplay.AvailableLeft And x <= oDisplay.AvailableWidth + oDisplay.AvailableLeft And _
y >= oDisplay.AvailableTop And y <= oDisplay.AvailableHeight + oDisplay.AvailableTop Then
Xojo thinks (in the debugger) the window is directly unter the menubar of the os (Window1.Top is 63px).
Setting Window1.Top = Window1.Top + 1 flips the complete window to the screen as I would expect it to be started.