Desktop Window open outside of Desktop

Hi,

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?

Marius

Outside your Desktop? Whatever do you mean? You mean it starts off-screen?

If you are saying it is off screen. Click on the Window and look at the inspector what does the “Default location” say. Set it to default. Does that help?

Failing that is there anything in the Opening event that could be moving the window?

Yes, exactly.

Its all default for a new app.

Nope.

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.

For a two screen setup (or more) you can choose which screen is considered the main screen. Mac System preferences, Display panel.

There is an option in in the ‘Default location’ popup to select ‘Main screen’, which would make it start on the monitor selected as main.

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
End If

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
      Return iDisplay
    End If
  Next
End Function

Do you have that project?
Can you report it as a bug via issues site?
This should not happen as far as read.

And you don’t have code setting top or left properties?

Show us the window properties, specially those marked as yellow below

A picture of the screen showing what you see and pointing the problems should help too.

Here is a screencast with a complete empty new project.
https://youtu.be/PxmOYojFKCQ

Thank you, now I understand. Seems like a bug to me. Xojo seems confused. Seems like taking measures from your big screen and presenting on the small one.

Probably related to some specific layout set on your Mac. A layout you got from the magical lottery of the chaos. :smile:

You should file an Issue Report. :wink:

And add your screen preferences showing your layout and screen sizes. Saying how things are arranged/set, main/secondary, IDE on bigger secondary, window opening in main, etc.

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.

Add this info to the Issue Report.

You aren’t using Ventura 13.3 beta are you?

13.2.1

Certainly seems like an odd one. Which is your “main screen”. Can you show the macOS displays config?

Do not use max width 32000 and maximum height 32000
better prefer to put your monitor maximum resolution instead of
putting large resolutions that your monitor cannot display