Problems with Multiple Monitors

Paul Dupuis paul at
Wed May 5 11:17:04 EDT 2021

On 5/4/2021 8:20 PM, Richard Gaskin via use-livecode wrote:
> Paul Dupuis wrote:
>> With multiple monitor, zero vertical is the top of the top most
>> monitor  - regardless of whether it is the primary monitor or not.
> If the screenRect is no longer based on the main monitor, what is the 
> screenloc?
> In a multi-monitor setup, with metrics like that how can one be 
> expected to center a window?

screenRect still returns the rect of the main monitor
the first line of the screenRects is still the rect of the main or 
primary monitor (the one with the menubar/taskbar)

however, you can not count on its left,top of the primary monitor being 
0,0 in a multiple monitor configuration. It may be or it may not be 
depending of where the second (or more) monitors are in relation to the 
primary one. Took me a while to figure this one out based on a 
customer's reported symptoms!

Also, if you think you may have customers with multiple monitors, the on 
desktopChanged message is your friend. I ran into a customer who would 
often leave HyperRESEARCH running, minimized or hidden, and then remove 
a external monitor from their laptop to go. LiveCode still thinks the 
monitor is attached and when they placed HR windows on that external 
monitor, those windows were no visible or accessible (unless they quit 
and restarted HR). Now I have a desktopChanged handler that gets the 
screenRects and checks to see if every open window is inside a current 
screenRect and moves the windows if needed.

-- Paul

More information about the use-livecode mailing list