3 Replies Latest reply on Oct 28, 2010 12:00 PM by philmodjunk

    New Window Weirdness



      New Window Weirdness


      Has anyone else noticed an inconsistency with the New Window script step?  I have the below script that should center the window.  However, if I run it once, it centers the new window as if it was the size of the original window, which makes it not center because the new window is a different size than the original.  If I run it again (without closing the new window just created) it centers the last window just fine, because the window it is currently active on is the same size.

      New Window [ Name: "Help"; Height: 780; Width: 710; Top: ( Get ( WindowDesktopHeight ) - Get ( WindowHeight ) ) /2; Left: ( Get( WindowDesktopWidth ) - Get ( WindowWidth ) ) / 2 ]

        • 1. Re: New Window Weirdness

          What system are you testing this on?

          • 2. Re: New Window Weirdness

            Windows XP SP3

            FileMaker 11 Advanced, 10 Advanced

            • 3. Re: New Window Weirdness

              Didn't spot the issue at first.

              Get ( WindowHeight ) returns the height of the current window, not the new window. Thus the first window uses the height of your parent window and each succeeding call uses the height of the previously created window.

              If you rewrite your expressions as:

              ( Get ( WindowDesktopHeight ) - 780 ) /2

              You'll get a more predictable result that centers your window.

              One trick I've started using is to define the height and width of such a window with a variable for each dimension that I then refer to in my New window step. It makes it easier to specify new dimensions if I have to change them later.