Difference between the Screen function and NSScreenMBS

Hello,

My computer has 2 screens. The Dock sits in the second screen.

Using the Xojo’s Screen object, I get these values:
Screen 1: {0,0,1920,1080} (“available” values: {0,23,1920,1057})
Screen 2: {-1280,0,1280,1024} (“available” values: {-1280,23,1280,958})

Now, with NSScreenMBS, the result is different:
Screen 1: {0,0,1920,1080} (visible frame: {0,0,1920,1057})
Screen 2: {-1280,56,1280,1024} (visible frame: {-1280,101,1280,956})

The problem lies about the “top” values.
1: The Screen object reports 23 for the AvailableTop value of screen 1 and 0 for the whole frame, while the NSScreen version returns 0 for both top values.
2: For screen 2, the Screen object returns 0 and 23 while the NSScreen object returns 56 and 101.

Both objects don’t compute the top the same way; I guess vertically-organised screens would have the problem for the “left” properties.
My problem is, in Xojo, placing a window requires the values of the Screen class, but I must deal with a NSScreen (the Screen class can’t figure out the “main” screen, the one the user is focused at; NSScreen can, using NSScreenMBS.MainScreen).
I can’t find a reliable way to get the Xojo’s screen corresponding to a NSScreenMBS object (I could rely on the width and height of both classes, in my case, but if both screens have the same resolution, it won’t work). Unless both are guaranteed to always be indexed the same, but I couldn’t find that information.

Wondering what these differences are about and how I can solve my problem…

Please note that NS functions return frame in CoreGraphics coordinate system where bottom on main screen is 0.
Xojo’s screen functions have 0 at top of screen.

[quote=482624:@Christian Schmitz]Please note that NS functions return frame in CoreGraphics coordinate system where bottom on main screen is 0.
Xojo’s screen functions have 0 at top of screen.[/quote]
Thanks.
Actually, I thought of this, but I still fail to see how I can convert the coordinates back.

I’m getting a difference of 56 both in computing the height’s difference between both screens and in the NSScreen’s top for the 2nd screen. In this simple example, I guess I can compute like this, for the second screen: y=MySecondNSScreen.Top-(screen(1).Height-screen(0).height) which results in 0 (since both screen are top-aligned in my setup), but in the possible case of 5 displays being connected, “correcting” a NSScreen to a Xojo Screen looks harder.

But I know I have troubles with spatial sight; I just can’t imagine the correct computation.