Multiple screens & organization

  1. 2 weeks ago

    Ramon S

    Mar 20 Pre-Release Testers, Xojo Pro UPC, Europe (Barcelona, Spain)

    When I have multiple screens Left and Top of a window (just an example) it seems that are taken from the Top-Left of screen(0).
    But how do I know where Screen(0) is? That is, how do I know screens' organization? Over, bellow, left, right..?

    Or much interesting for me, is it possible to know the minimum-maximum width and height of the combined screens?

    It should be cross-platform.

  2. Andrew L

    Mar 20 San Francisco, CA, USA

    Use the Screen class to get the positions and sizes of each screen.

  3. Kem T

    Mar 20 Pre-Release Testers, Xojo Pro, XDC Speakers, MVP Connecticut

    As I recall, Screen(0) is always 0, 0, and the other screens are relative to that. For example, Screen(1) might be -1024, 0, so it would be inline horizontally and to the left of the main screen.

  4. Ramon S

    Mar 20 Pre-Release Testers, Xojo Pro UPC, Europe (Barcelona, Spain)
    Edited 2 weeks ago

    Thank you Andrew.
    It will take some lines of code to get the values, but it will be easy.

    Var xmin, ymin, xmax, ymax As Integer
    For i As Integer = 0 To ScreenCount - 1
      xmin = Min(xmin, Screen(i).Left)
      xmax = Max(xmax, Screen(i).Width)
      ymin = Min(ymin, Screen(i).Top)
      ymax = Max(ymax, Screen(i).Height)
    Next i
  5. Ramon S

    Mar 20 Pre-Release Testers, Xojo Pro UPC, Europe (Barcelona, Spain)

    Sorry. It was wrong!

    Var xmin, ymin, xmax, ymax As Integer
    For i As Integer = 0 To ScreenCount - 1
      xmin = Min(xmin, Screen(i).Left)
      xmax = Max(xmax, Screen(i).Left + Screen(i).Width)
      ymin = Min(ymin, Screen(i).Top)
      ymax = Max(ymax, Screen(i).Top + Screen(i).Height)
    Next i

or Sign Up to reply!