[Lazarus] AnchorDockingDsgn with multi-monitor setup

Rik van Kekem rik at graficalc.nl
Fri Nov 6 13:57:34 CET 2015

We've already discussed some of this on the forum. See topic for extra 

My left monitor is primary monitor but it's numbered 2 in Windows.
See image at 
My monitor on the right is the extended one and is numbered 1.

Lazarus with AnchorDockingDsgn always opens up on monitor 1 (my monitor 
on the right).
I've already submitted a bug-track: 

My question is probably for Mattias (as assignee of the bug-report and 
author of anchordocking) or others who worked on this. In 
lazarus\components\anchordocking\anchordocking.pas there is some 
monitor-code in SetupSite() function and before that. There the WorkArea 
of Node.Monitor in Screen.Monitors is taken. But why is this WorkArea 
again calculated if it was already saved in environmentoptions.xml? The 
problem I'm having now is that Lazarus always restores to the monitor on 
the right (which is the extended monitor, not the primary one).

If I change the following it works for both monitors, regardless on 
which Lazarus was closed, it will open always at the same position. It 
just takes the WorkArea which is already saved and used for opening Lazarus.

ma okt 26 22:34:11 2015
+++ C:/dev/lazarus/components/anchordocking/anchordocking.pas    vr nov  
6 13:50:20 2015
@@ -1749,7 +1749,8 @@ var
-      WorkArea:=aMonitor.WorkareaRect;
+      //WorkArea:=aMonitor.WorkareaRect;
+      WorkArea:=SrcWorkArea;
        {$IFDEF VerboseAnchorDockRestore}

I think all the monitor-stuff could be deleted because the WorkArea is 
already saved.
(or am I seeing this wrong?)

Rik (rvk on forum)

More information about the Lazarus mailing list