Auto Centre Windows


check over here Difficulty: Beginner / Intermediate “This example has been set at a beginner to intermediate level. This is because the script is not a difficult one, however you do have to understand FileMaker to create it.” The ability to auto centre a window is a very powerful tool. It will give your database much more of a professional feel, and will be easier on the eye to read.

look at more info The calculations to achieve this are not all that complicated. However knowing the maths behind it helps understanding.

Take a number line of 0 to 10. ( But please do excuse my awful drawings! )


Imagine that your FileMaker window, the one you are trying to centre, has a width of 4 pixels.


The screen is 10 pixels wide. This means that where ever the window is placed, it will always cover 4 out of the 10 pixels available on screen. Therefore the width of the window will always consume 4/10 pixels of the screen width. This means that there are only 6 screen pixels left. To find the mid point of these screen pixels, you divide by 2 to get an answer of 3 pixels.

Therefore, if you place your window on the 3rd pixel of the number line, you will get the below.


As you can see, the window now sits in the middle of the number line. The same principle applies to your database window. You take the screen width, minus the window width and divide this answer by 2.

In FileMaker, this will look something like…

Screen Shot 2014-03-10 at 16.23.05

( Get ( ScreenHeight ) – 400 ) / 2

In this example, 400 is the height of my window. The same method applies to height and width.

When the script runs, the window appears directly in the centre of the screen.

Leave a Reply