In mathematics, a flat plane or surface is defined by two axes – X and Y. On a screen or piece of paper, the X axis goes across (remember an X is “a cross”); the Y axis goes up and down (remember a Y looks like a tree). The position of any point is defined by its position on the X and Y axes – the point coordinates.
Let’s consider a FileMaker layout. Object coordinates are based on the definition of the origin point – being 0 on each axis. On a FileMaker layout, the origin is at the top left of the layout. Display rulers (View > Rulers) to confirm:
The coordinates of every point on the layout are measured right of and down from the origin point.
There is a function – FieldBounds ( fileName ; layoutName ; fieldName ) – which returns the location, in points, of each field boundary and the field’s rotation in degrees.
For example, the expression:
FieldBounds ( Get(FileName); Get(LayoutName); "task")
20 82 350 132 0
for a field named task on the current layout of the current file. The first four numbers are left, top, right and bottom coordinates in points.
Units of measurement
FileMaker Pro offers three units of measurement for position and size – inches (in), centimetres (cm), and points (pt). There are 72pt in one inch. It is easy to switch between these units by clicking on the unit symbol between the two rulers, or by clicking on the unit in the Position tab of the Inspector.
Layout Design Tip
When working with position and size, it is strongly recommended that you work in points. This provides whole numbers which are easier to work with – 20pt instead of 0.278in or 0.706cm. Some options (such as those in script steps) must be entered in points.
Inspector – Position tab
The first tab of the Inspector is the Position tab. The first section in that tab is the Position section.
For any selected object, the Inspector shows the position of the left, top, right and bottom points. The coordinates of the top left corner of the selected object in the screenshot are ( 20, 82 ) – 20pt right of, and 82pt down from the origin.
The Inspector is very useful for both determining and adjusting the position of an object on a layout. Click in any of the position boxes, type a number and press tab accept the change and move the object. The same can also be done for size.
Often a text object containing merge fields is larger than what is needed to display the data on the layout. You can resize the text object with the Inspector Position so that it is the appropriate size for data display.
Where an object needs to be in exactly the same position on two or more layouts, using the Inspector to set and confirm the position is priceless.
If you select a part label (see below where the Body part is selected), the Inspector displays the position of the bottom of the part and the height of the part. This can be very useful to make accurate adjustments to the size of any layout part.
With no objects and no parts selected, the Inspector displays the width of the layout (to the explicit right edge). Again, this is useful for making accurate adjustments to the layout width.
XY coordinates also come into play when creating new windows. The options for the New Window script step provide settings for the position of the new window:
The position is defined (down) “from Top” and (across) “from Left”.
Why would the order of Position be defined Y then X instead of X then Y?
Unlike object position, the origin point used for most new windows is the top left corner of the screen. The exception is for card windows where the origin is the top left corner of the layout of the parent window.
The Move/Resize Window script step allows you to move a window by defining the position relative to the origin used for the window type:
If you want to reposition a window relative to its current position, use the functions Get ( WindowLeft ) and Get ( WindowTop ). For example, to move the window down 100pt, use the expression:
Get ( WindowTop ) + 100
Strange window positioning
FileMaker Pro will allow you to position a window off the edge of the screen by entering a negative value for the left position. This has been used by FileMaker developers over many years to create utility windows that the user does not see. Often this is done for a cleaner user experience – whatever happens in that window is not seen by the user and is not rendered by FileMaker Pro for performance gains.