Dual Screens postioning

I have a windows app that uses dual screens. Screen 1(0) is 1024 wide and Screen 2(1) is 1680. If they were both the same size I could just set me.left = 0 and it would be fine but they aren’t. Or I could use me.Left = (Screen(0).AvailableWidth-me.Width)/2 but they aren’t the same size so that won’t work. Setting me.left = 0 moves the app to the big screen (screen 2) where it shouldn’t be. I guess maybe it uses the bigger one by default. Any help on resolving this would be great. Thanks.

i guess you need reorder the displays in windows os system settings?
left 1 main screen and to the right display 2
and then Screen(1).Left should be position of the second screen.

That will not work for me. The smaller one is the main display in Windows, it has the “make this my main display” checkbox checked and grayed out. I want that to my my main display, I run other apps on it.

and your windows settings where the displays can moved by mouse reflect how the monitors are arranged in real?

Yes, the small box on the left (main display, 768x1024) and the big box on the right (extended desktop, 1680x1080.

I have another set of TV’s with a big display as the main display and smaller secondary ones on the right as the extended display and I have no problem with that because the bigger display is the main display. Xojo doesn’t seem to like having a smaller display as the main display. I assume it’s a Xojo thing since I have had no problems with this in VB.Net, whatever window you set to 0,0 goes to the main display. I’m trying to port my VB.Net apps to Xojo

what is the output of this?
System.DebugLog Screen(0).Left.ToString
System.DebugLog Screen(1).Left.ToString

Screen(0) = 0
Screen(1) = 1024

This is what I would expect as that is the way the windows are ordered in Windows and the smaller is the main display. Does it matter that the type of window in my project is a Moveable Modal? I have it this way to avoid seeing the title bar.

I am unsure of what answer you need, but usually, the OS opens new windows on the largest screen (not always *)

Murphy’s law: Gimp (for example) open some “dialog” on the smaller screen here (the external; less size, less dpi than the internal screen).

I see what you’re saying, I’ll have to check that out. I really don’t want the title bar on the form so if it has to be a form then I have to jump through some hoops that way. I’ll look into it, thanks.

So being a moveable modal is not the issue. I changed the app to a document and it still shows up on the second monitor.

This looks like a bug, moving the window to the right screen then setting window.left to 100 (or 0) moves the window to the left edge of the right screen, which is incorrect.

A quick scan of feedback I can’t see a similar ticket open but there are so many reproducible/verified tickets that match “window.left screen” it could be hidden in there somewhere.

Other than using declares, I can’t think of a way to move the window to the left screen, I tried altering left and bounds and they both moved the window to the left edge of the right screen. Someone else might know of a workaround for you, if not I can take a look at the declares if you want? Just let me know.

Did you set the target screen in the properties pane ?
(to main screen for example ?)

this combobox here
Ashampoo_Snap_Sonntag, 18. Juli 2021_8h21m30s_003_Unbenannt - Paint

That is what I meant, but I do not had Xjo 2021 on El Capitan boot.

Ifn fact, choose the one you want / need from the list.

Interesting. Never seen the options before. But what exactly do they do? Which value is recommended? For instance, I have an odd bug with a sheet window. The window escapes its parent when there are 2 screens.

These options are known to be broken. There are feedback cases for that, like feedback://showreport?report_id=55233 or feedback://showreport?report_id=31201.

Also, this case may be of relevance: feedback://showreport?report_id=64757

OT
at windows os i use often parent window because if i move the main window i want a new window or dialog near by. sometimes i also use a method to put a new window where i want with the size i want.

Sigh… 31201 is from 2013 which is really really sad.

Have you tried

Me.Left = 0

That should position the window left of screen(0). It does not matter if each screen has a different resolution.

Forum for Xojo Programming Language and IDE. Copyright © 2021 Xojo, Inc.