12 Replies Latest reply on Jun 29, 2017 10:28 AM by dannye770

    Window positioning problems with FM16

    dannye770

      I seem to have found a bug regarding window positioning when using dual monitors, but maybe I've just missed something.

       

      Using a New Window script step, I'm opening a new window and setting the position based on the position of my current window (using the Get (WindowTop) and Get (WindowLeft) functions). It works perfectly on machines with just one monitor. But on machines with dual monitors, the window clings to the top of the screen regardless of the position settings. The left position works correctly, only the top position fails.

       

      I tried adjusting the script to remove the relative positioning and instead just set it to Top = 50px and Left = 50px. Same outcome. Left works, but Top clings to the top instead of adjusting down.

       

      This is the behavior for Documents, Floating Documents, and Dialogs. For Cards, it clings to the top of the existing window (rather than the screen), but otherwise the behavior is the same.

       

      Any hints to resolve this? Thanks!

        • 1. Re: Window positioning problems with FM16
          planteg

          Hi,

           

          what OS are you running on ?

          • 2. Re: Window positioning problems with FM16
            keywords

            An interesting post, made all the more curious by my testing (FMA16, MacOSX 10.11.6).

            •     I can drag a window to the right to move it to a second monitor and Get ( WindowLeft ) will tell me its position is 2600.

            •     When I run a script trying to set a new window at 2600 it fails, placing the window at 40 instead—with one exception

            •     A Card window is ostensibly positioned at 2600—but is off screen rather than appearing on the second monitor

            My script was as follows:

             

            New Window [ Style: Document; Using layout: <Current Layout>; Top: 300; Left: 2600; Close: Yes; Minimize: Yes; Maximize: Yes; Resize: Yes; Menu Bar: Yes; Dim parent window: No; Toolbars: Yes ]

            Pause/Resume Script [ Indefinitely ]
            Set Variable [ $$position; Value:If ( IsEmpty ( $$position ) ; Get ( WindowTop ) & "|" & Get ( WindowLeft ) ; $$position & "¶" & Get

            ( WindowTop ) & "|" & Get ( WindowLeft ) ) ]

            Close Window [ Current Window ]

            New Window [ Style: Floating Document; Using layout: <Current Layout>; Top: 300; Left: 2600; Close: Yes; Minimize: Yes; Maximize: Yes; Resize: Yes; Menu Bar: Yes; Dim parent window: No; Toolbars: Yes ]

            Pause/Resume Script [ Indefinitely ]
            Set Variable [ $$position; Value:If ( IsEmpty ( $$position ) ; Get ( WindowTop ) & "|" & Get ( WindowLeft ) ; $$position & "¶" & Get

            ( WindowTop ) & "|" & Get ( WindowLeft ) ) ]

            Close Window [ Current Window ]

            New Window [ Style: Dialog; Using layout: <Current Layout>; Top: 300; Left: 2600; Close: Yes; Minimize: No; Maximize: Yes; Resize: Yes; Menu Bar: Yes; Dim parent window: No; Toolbars: Yes ]

            Pause/Resume Script [ Indefinitely ]
            Set Variable [ $$position; Value:If ( IsEmpty ( $$position ) ; Get ( WindowTop ) & "|" & Get ( WindowLeft ) ; $$position & "¶" & Get

            ( WindowTop ) & "|" & Get ( WindowLeft ) ) ]

            Close Window [ Current Window ]

            New Window [ Style: Card; Using layout: <Current Layout>; Top: 300; Left: 2600; Close: Yes; Minimize: No; Maximize: No; Resize: No; Menu Bar: No; Dim parent window: Yes; Toolbars: No ]

            Set Variable [ $$position; Value:If ( IsEmpty ( $$position ) ; Get ( WindowTop ) & "|" & Get ( WindowLeft ) ; $$position & "¶" & Get ( WindowTop ) & "|" & Get ( WindowLeft ) ) ]

            Close Window [ Current Window ] Exit Script [ Result: $$position ]

             

            $$position results were:

            300|40

            300|40

            300|40

            300|2600

             

            I get exactly the same results when testing with a single monitor. Anyone else care to test this? Perhaps there is a bug report looming here.

             

            • 3. Re: Window positioning problems with FM16
              dannye770

              Thanks planteg and keywords.

               

              I'm on Windows 10 Pro v1607. Also using FM Pro, not Pro Advanced. My single monitor is 1920 x 1080. My dual monitor machine: monitor 1 is 1600 x 900, monitor 2 is 1920 x 1080.

               

              I tried the window position test script that keywords tried, a few different ways. I got different results for each.

               

              First, I set Top: 50 and Left: 50

              On my single monitor I came up with

              50|50

              50|50

              50|50

              50|50

               

              On my dual monitor I got

              0|50

              0|50

              0|50

              -133|50

               

              Then, I set Top: 300 and Left: 300

              Single monitor

              300|300

              300|300

              300|300

              300|300

               

              Dual monitor

              236|300

              236|300

              236|300

              83|300

               

              Then I tried Top: 300 and Left: 2600

              Single monitor:

              300|2600

              300|2600

              300|2600

              300|2600

               

              Dual monitor:

              0|2500

              0|2500

              0|2500

              159|-1119

               

              I can't figure out a rhyme or reason to the different positioning. What else should I be testing to try to troubleshoot this?

              • 4. Re: Window positioning problems with FM16
                planteg

                Just out of my mind, I wonder how FM 'see' a two monitor set. For example, if bot monitors are 1920 x 1080, and are arrange as monitor 2 is on top of monitor one, does FM thing it's working with a monitor 1920 wide and 2160 high ?

                 

                The other thing is how are measured top and left: to the external frame of the window, or to the client portion of the window ?

                 

                I think I will do a deep search on the subject.

                • 5. Re: Window positioning problems with FM16
                  keywords

                  Glad you found some intrigue in this test. Adding further to the discussion:

                  I think the reason the behaviour of Card windows is different is because they are tied to their parent window—you cannot move them independently, but if you move the parent window the card window moves, maintaining the same relative position. I tried this variation on the script:

                   

                  New Window [ Style: Card; Using layout: <Current Layout>; Height: 200; Width: 200; Left: -600; Close: Yes; Minimize: No; Maximize: No; Resize: No; Menu Bar: No; Dim parent window: Yes; Toolbars: No ]

                  Pause/Resume Script [ Indefinitely ]
                  Set Variable [ $$position; Value:If ( IsEmpty ( $$position ) ; Get ( WindowTop ) & "|" & Get ( WindowLeft ) ; $$position & "¶" & Get

                  ( WindowTop ) & "|" & Get ( WindowLeft ) ) ] Close Window [ Current Window ]
                  Exit Script [ Result: $$position ]

                   

                   

                  As I then drag the parent window to the right while the script is paused the card window appears to its left. As the parent window switches onto the second monitor you can see the card window in ghostly form on the main monitor, but it disappears as soon as you let go the parent window, and only becomes visible when you drag the parent window far enough across the second monitor for it to also be accommodated there.

                  My conclusion from this is that the linking of the two monitors must be handled at OS level by some process that FM is not able to access.

                  Some further testing is interesting, though. Try the following:

                  1.     Position the starting window on the second monitor (mine is to the right of my main monitor)

                  2.     Run this variation of the script—

                   

                  New Window [ Style: Document; Using layout: <Current Layout>; Height: 300; Width: 300; Top: 100; Left: -100; Close: Yes; Minimize: Yes; Maximize: Yes; Resize: Yes; Menu Bar: Yes; Dim parent window: No; Toolbars: Yes ]

                  Pause/Resume Script [ Indefinitely ]
                  Set Variable [ $$position; Value:If ( IsEmpty ( $$position ) ; Get ( WindowTop ) & "|" & Get ( WindowLeft ) ; $$position & "¶" & Get

                  ( WindowTop ) & "|" & Get ( WindowLeft ) ) ]

                  Close Window [ Current Window ]

                  New Window [ Style: Floating Document; Using layout: <Current Layout>; Height: 300; Width: 300; Top: 100; Left: -100; Close: Yes; Minimize: Yes; Maximize: Yes; Resize: Yes; Menu Bar: Yes; Dim parent window: No; Toolbars: Yes ]

                  Pause/Resume Script [ Indefinitely ]
                  Set Variable [ $$position; Value:If ( IsEmpty ( $$position ) ; Get ( WindowTop ) & "|" & Get ( WindowLeft ) ; $$position & "¶" & Get

                  ( WindowTop ) & "|" & Get ( WindowLeft ) ) ]

                  Close Window [ Current Window ]

                  New Window [ Style: Dialog; Using layout: <Current Layout>; Height: 300; Width: 300; Top: 100; Left: -100; Close: Yes; Minimize: No; Maximize: Yes; Resize: Yes; Menu Bar: Yes; Dim parent window: No; Toolbars: Yes ]

                  Pause/Resume Script [ Indefinitely ]
                  Set Variable [ $$position; Value:If ( IsEmpty ( $$position ) ; Get ( WindowTop ) & "|" & Get ( WindowLeft ) ; $$position & "¶" & Get

                  ( WindowTop ) & "|" & Get ( WindowLeft ) ) ]

                  Close Window [ Current Window ]

                  New Window [ Style: Card; Using layout: <Current Layout>; Height: 300; Width: 300; Left: -400; Close: Yes; Minimize: No; Maximize: No; Resize: No; Menu Bar: No; Dim parent window: Yes; Toolbars: No ]

                  Pause/Resume Script [ Indefinitely ]
                  Set Variable [ $$position; Value:If ( IsEmpty ( $$position ) ; Get ( WindowTop ) & "|" & Get ( WindowLeft ) ; $$position & "¶" & Get

                  ( WindowTop ) & "|" & Get ( WindowLeft ) ) ] Close Window [ Current Window ]
                  Exit Script [ Result: $$position ]

                   

                  1 of 1 people found this helpful
                  • 6. Re: Window positioning problems with FM16
                    dannye770

                    Thanks for the continued responses. In a very odd turn of events: I started testing again this morning, and I can't reproduce the problem anymore. I don't get it. My dual monitor setup now appears to be acting exactly the same as my single monitor setup; exactly as I would expect. I applied no updates to my clients or server...didn't even reboot.

                     

                    planteg had a question about how the window position was measured. It appears that for standard windows (documents, floating documents, dialogs), the window position is measured from the edge of the screen to the edge of the FileMaker window, but for cards, the window position is measured from the edge of the parent layout (excluding the toolbars, etc). This was throwing me off for a while, but still doesn't explain some of the positioning results I was seeing.

                     

                    I'm going to have some other people in my office test this as well to see if they can reproduce the window position problems. Are others still seeing problems with dual monitor window placement?

                    • 7. Re: Window positioning problems with FM16
                      keywords

                      You are spot on about positioning of card windows being different, because they "belong" to the parent window that spawned them, so position is relative to the parent window.

                      Did you run the latest test I posted? In my test, with the starting window on my second monitor the three standard windows actually appear at the left of the main monitor. At first I thought that this might have been because I was starting from the second monitor, but further testing showed that regardless of the left position specified it is position relative to the main monitor screen, not the one on which the starting window is located. Card windows are the only exception, as already noted.

                      • 8. Re: Window positioning problems with FM16
                        dannye770

                        Yup, I did run the test you posted. I got the same results as you; the position of the first three window types is fixed to the main screen (regardless of position of the parent window), and the Card window is relative to the parent window.

                         

                        So, it appears that when FileMaker is getting or setting the position of a document, floating document, or dialog window, it is all done in relation to the main screen. Two 1920 x 1080 monitors set side by side essentially become one 3840 x 1080 monitor. The upper left of the left screen is (0,0), and the upper left of the second (right) screen is (1920, 0). OK - I see how that can make sense.

                         

                        But then my issue becomes: How can I position a window relative to whatever setup the user has? I must be able to measure the user's setup to dynamically place the windows. Let's say, for instance, that I want to place a window on the right edge of a user's screen(s), regardless of whether they have a single or dual monitor.

                         

                        Get ( ScreenWidth ) was my first thought, but it returns only the width of the screen that the current window is open in. Get ( WindowDesktopWidth ) would seem another obvious choice, but upon testing, I found that it also returns only the width of the active screen. Is this the intended result of the Get (WindowDesktopWidth ) function? Any other ideas for how to measure the size of the whole setup so that windows can be dynamically positioned?

                        1 of 1 people found this helpful
                        • 9. Re: Window positioning problems with FM16
                          planteg

                          Any other ideas for how to measure the size of the whole setup so that windows can be dynamically positioned?

                           

                          That is the excellent question ! Looks like nothing in FileMaker provides this. My guess is that the OS has an API call about that. Maybe monkeybreadsoftware will come up with something.

                          1 of 1 people found this helpful
                          • 10. Re: Window positioning problems with FM16
                            monkeybreadsoftware

                            Of course MBS FileMaker Plugin can help here.

                            We have Screen functions to query size and count of computer displays.

                            You can use Window.SetBounds, Window.Move or Window.Resize to change position/size of window.

                            1 of 1 people found this helpful
                            • 11. Re: Window positioning problems with FM16
                              keywords

                              This seems to confirm my earlier observation (My conclusion from this is that the linking of the two monitors must be handled at OS level by some process that FM is not able to access.). Might be worth a feature request to FM.

                              1 of 1 people found this helpful
                              • 12. Re: Window positioning problems with FM16
                                dannye770

                                So here's what I've learned regarding dual monitors and FileMaker:

                                • Document, Floating Document, and Dialog window types have absolute positions; their position is relative to your main screen.
                                • The Card window type is positioned relative to the active screen. More specifically, it is relative to your current layout (excluding the frame and controls)
                                • FM essentially treats a dual monitor setup as one big monitor, but FileMaker only has functions that allow you to get the size of the active screen, not the whole setup.

                                 

                                Hopefully FM will continue to improve features and functions associated with dual monitors.

                                 

                                I still don't know what caused the odd behavior that I was seeing in my original post (window clinging to top of screen, regardless of specified position) -- but since I can no longer reproduce the behavior, I'm going to assume it is resolved for now. Thanks to everyone for your feedback!