Skip to main content

Dial_GetGlobalScreenPosition (function reference)

By March 18, 2025March 20th, 2025Online Help, Troi Dialog Plug-in
Troi Dialog Plug-in > Functions reference > Dial_GetGlobalScreenPosition
Troi Dialog Plug-in for FileMaker Pro

Dial_GetGlobalScreenPosition

The function returns screen (position) information of the front FileMaker window or of a specific screen.

SyntaxFunction badge

Dial_GetGlobalScreenPosition ( switches )

Parameters

switches modifies the returned result of the function

Switches

Switches can be one of:

-FrontWindow return (position) information of the front FileMaker (document) window
-ScreenNumber=x return information of the screen with this number
-ScreenID=xxxxxx return information of the screen with this screen ID
-SerialNumber=xxxxxx return information of the screen with this display serial number

You can also add one of these switches to specify which information is returned:

-ReturnInfoList (default) return a list of (position) information
-GetScreenNumber only return the screen number
-GetScreenID only return the screen ID
-GetSerialNumber only return the serial number of the display
-GetScreenRectangle return the screen rectangle in global coordinates

Returned Result

Data type returned

Text

Result

If successful it returns a list of (global) position information of the front FileMaker window or the specified screen, including screen name, screen ID and global coordinates of the screen bounds.

Originated in

Troi Dialog Plug-in 12.0

Compatibility

FileMaker Pro 17 to FileMaker Pro 21 (2024)

Considerations

Currently implemented on macOS only.

It will return the positions using *global* screen coordinates. If you have multiple screens attached to this computer these coordinates are relative to the top left coordinates of screen number 1, the main screen with the menu bar.
Note that in some configurations the results may have *negative* coordinates.

The screen positions may change while FileMaker is running, for example when a new display is attached or the displays are rearranged in the System Settings.

Example

Dial_GetGlobalScreenPosition( "-FrontWindow" )

This will return a list of (global position) information of the front FileMaker (document) window.
The result will be similar to this:

Description: The front window of FileMaker runs on screen 1
Screen ID: 69983969
Screen serial number: 429686042
Global FMP window rectangle: 0, 25, 642, 722
Global rectangle of screen 1: 0, 0, 2560, 1440

Example 2

With this function you can get global position information, so you then can position a dialog on a specific screen.
Let’s say you already have determined the serial number of the screen on which you want to show your dialog and
stored it in a field called gSavedScreenSerialNumber.

Now create a script “Show Dialog on saved screen “:

# Get the saved Screen Serial Number from a field:
Set Variable [ $ScreenSerialNumber; gSavedScreenSerialNumber ] 

# Now get the rectangle of this screen (with this serial number):
Set Variable [ $TheScreenRectangle; Dial_GetGlobalScreenPosition( 
                              "-GetScreenRectangle -SerialNumber=" & $ScreenSerialNumber) ]

# Now get the center point of the rectangle:
Set Variable [ $TheCenterPoint; Dial_CenterPointOfRect("-unused"; $TheScreenRectangle) ]
# The result is formatted as "x¶y", for example: 
#	142
#	345

Set Variable [ $TheCenterPoint_X;  GetValue ( $TheCenterPoint ; 1 ) ] 
Set Variable [ $TheCenterPoint_Y;  GetValue ( $TheCenterPoint ; 2 ) ]
Set Variable [ $PositionSwitches;  "-Once -UseCenterCoordinates" ]
Set Variable [ $ErrorCode; 
               Dial_SetPosition( $PositionSwitches ; $TheCenterPoint_X ; $TheCenterPoint_Y ) ]
               
Set Variable [ $Prompt; "This dialog is shown at the center of the (saved) screen " &
                        "with serial number: " & $ScreenSerialNumber ]
                        
# Now show this dialog on the center point of the screen:
Set Variable [ $Result; Dial_Dialog( "-CautionIcon -IconSize=48" ; $Prompt ; "OK"; ) ]

Used in example file

Position.fmp12

Related functionsFunction badge

Dial_CenterPointOfRect
Dial_GetScreenInfo
Dial_SetPosition

Related topics

Troi Dialog Plug-in online help (overview)


Online Help Page for Troi Dialog Plug-in for 17 to 2024 –> Dial_GetGlobalScreenPosition (dialp4324) 2025-0320 16:21:53

troi.com
Privacy Overview

This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognizing you when you return to our website and helping us to understand which sections of the website you find most interesting and useful.

You can adjust all of your cookie settings by navigating the tabs on the left hand side.