Window Placement - Clarification Needed

  1. 6 years ago

    Placement can take on the following values:

    Value Description
    0 Default
    1 Parent Window
    2 Main Screen
    3 Parent Window Screen
    4 Stagger

    What exactly do these do? (I've tried all 5 and can't really see a difference.

    (running in Windows)

  2. Norman P

    9 Dec 2013 Xojo Inc, Pre-Release Testers, Xojo Pro Seeking work. npalardy@great-w...

    If you have several screens they make a difference
    On single screen systems there's almost no difference

    Off the top of my head
    0 Default - whatever the OS would normally do (which may be to stagger new windows in an app)
    1 Parent Window - on the parent window if you have one window open another
    2 Main Screen - on the primary or main screen in a multi screen set up
    3 Parent Window Screen - on the same screen as the parent window in a multi screen set up
    4 Stagger - stagger new windows in an app

  3. Ramon S

    26 Feb 2014 Pre-Release Testers, Xojo Pro UPC, Europe (Barcelona, Spain)

    Really Language Reference is very poor about this window property.
    I want to open a window in a particular screen (multiple screens) and I have found no help at all.
    This window is not opened by another window but by a method, so there is no parent window.
    Can I have some help?
    Thanks.

  4. Chris C

    27 Feb 2014 Pre-Release Testers, Xojo Pro Thatcham, Berkshire, UK, Europ...

    @Ramon S I want to open a window in a particular screen (multiple screens) and I have found no help at all.
    This window is not opened by another window but by a method, so there is no parent window.
    Can I have some help?

    In a system with 2 x screens I found that this worked in the window Open event to place the window on one screen or the other...

     if myScreen = 0 then
        //- Centralise on 1st screen...
        me.left = ((screen(0).width - me.width) / 2)
        me.top =  ((screen(0).height - me.height) / 2)
      else
        //- Centralise on 2nd screen...
        me.left = screen(0).width + ((screen(1).width - me.width) / 2)
        me.top =  ((screen(1).height - me.height) / 2)
      end if

    This was on MS.windows, with 2nd screen laid out to right of main screen under display settings.

  5. Ramon S

    27 Feb 2014 Pre-Release Testers, Xojo Pro UPC, Europe (Barcelona, Spain)

    Thanks Chris, but finally I found the error, and as it happens many times it was MY error, not Xojo's.
    I had used both Open and Activate events (it is an old project and I didn't remember I was using Activate), so everything I was writing in Open was changed silently by Activate.
    Now it works perfectly in any screen.

  6. Ulrich B

    5 Mar 2014 Pre-Release Testers, Xojo Pro Europe (Germany, Berlin) · xo...

    So in order to find out which screen a window resides on I have to check if its left position goes beyond screen(0).width? Or is there any other way like a window.isonscreen property?

  7. Norman P

    5 Mar 2014 Xojo Inc, Pre-Release Testers, Xojo Pro Seeking work. npalardy@great-w...

    IsOnScreen would have to try & figure out what YOU intend the behavior to be

    Say you want the top left to determine what screen its on

    But I want to have it be determined by the percentage of the window that is on which screen (you've dragged the window to be partially on each of two screens)

  8. Eduardo G

    5 Mar 2014 Pre-Release Testers Europe (Madrid, Spain)

    @Norman P IsOnScreen would have to try & figure out what YOU intend the behavior to be

    Say you want the top left to determine what screen its on

    But I want to have it be determined by the percentage of the window that is on which screen (you've dragged the window to be partially on each of two screens)

    While this can't be done in Mavericks, it's still possible in Windows and Linux (and OS X pre-Mavericks).

    What is currently the best practice to put windows where they should be? Is "screen" really a useless property and only coordinates make sense?

  9. Ulrich B

    5 Mar 2014 Pre-Release Testers, Xojo Pro Europe (Germany, Berlin) · xo...

    Coordinates only seem not to work – at least under OS X. I have a window which position I grab and save on its cancel close event. When I try to open it again by that positions (without the use of screen())– and they were on the second screen –, the window is drawn on screen 0 with its positions way out of the screen’s limits.

  10. Chris C

    5 Mar 2014 Pre-Release Testers, Xojo Pro Thatcham, Berkshire, UK, Europ...

    @EduardoGutierrez de Oliveira Is "screen" really a useless property and only coordinates make sense?

    On windows ( I've not use this on other platforms )...

    `screen` has properties which can be useful in placement, the `availablexxx` ones tell you what area there is, minus stuff like taskbar, so you can decide which screen to pace a window on.

    In my main setup I have 3 screens, all different sizes and only the first has .top=0 ... you can place sreeens in odd layouts with windows !

  11. Ulrich B

    5 Mar 2014 Pre-Release Testers, Xojo Pro Europe (Germany, Berlin) · xo...

    It’s the same on OS X.
    But thanks for all your clarifications. I found this helpful to determine if a saved window position is at least with one pixel one a visible screen – screen settings may change and therefore absolute positions may not be available anymore.
    If -1 is returned I reposition the newly drawn window, else I know why screen it’s on – at least for a part, not weighted like Norman asked for. But that‘s enough for my purpose.

    Function IsInScreen(extends w as window) As integer
      dim x as integer = w.Left
      dim y as integer= w.top
      for q as integer = 0 to ScreenCount -1
        if (x >= Screen(q).Left and x <= screen(q).left + screen(q).Width) and( y >= Screen(q).top and y <= Screen(q).top + Screen(q).Height) then
          return q
        end if
      next
      return -1
      
    End Function
  12. Ulrich B

    5 Mar 2014 Pre-Release Testers, Xojo Pro Europe (Germany, Berlin) · xo...

    sorry for all the typos – partly thanks to a spellchecker running wild. I really miss an edit option.

  13. Norman P

    5 Mar 2014 Xojo Inc, Pre-Release Testers, Xojo Pro Seeking work. npalardy@great-w...
    Edited 6 years ago

    @Chris C In my main setup I have 3 screens, all different sizes and only the first has .top=0 ... you can place sreeens in odd layouts with windows !

    Oh you can do this on OS X as well
    Have been able to do this on Mac OS going back as far as I can remember (first mac I had at work was a IIfx with 3 x 21" monitors - in 1992)
    You can end up with it being possible to place one windows across 3 screens quite easily when you arrange them like -image-

  14. 3 years ago

    Tim T

    8 Feb 2017 Atlanta, GA

    Is there a way to do this with dialogs vs. windows?

  15. You could also create ur own dialog using windows

  16. Tim T

    9 Feb 2017 Atlanta, GA

    @LangueRodriguez You could also create ur own dialog using windows

    Yes I realize that but then they look "non standard". Does anyone know how to get them to use the same icons the system would use for a dialog?

or Sign Up to reply!