Subject | Re: [IBO] Re: TIB_LookupCombo and 2 monitors - a repair |
---|---|
Author | |
Post date | 2016-08-14T23:52:54Z |
The code used when the TIB_LookupCombo (LC) drops down is in TIB_Grid.pas and is here:
P := ClientOrigin;
...
LeftPos := P.X;
case FPopupAlignment of
puAuto: if ListWidth > ( Parent.ClientOrigin.X +
Parent.ClientRect.Right - P.X ) then
begin
LeftPos := Parent.ClientOrigin.X +
Parent.ClientRect.Right - ListWidth;
if LeftPos < 0 then LeftPos := 0;
end;
puRight: LeftPos := P.X - ListWidth + ClientWidth;
puCentered: LeftPos := P.X - (( ListWidth - ClientWidth) div 2 );
puParentLeft: LeftPos := Parent.ClientOrigin.X;
puParentRight: LeftPos := Parent.ClientOrigin.X +
Parent.ClientWidth - ListWidth;
puParentCentered: LeftPos := Parent.ClientOrigin.X -
(( ListWidth - Parent.ClientWidth) div 2 );
end;
The case puLeft (for LC.popupAlignment) is done at leftPos := P.X.
The problem when using two monitors is in case puAuto, and occurs in the line where LeftPos is compared to 0. Using one monitor only 0 is the left position of the screen. With two monitors The left position of the desktop is screen.desktopLeft. So replacing this line with
if LeftPos < screem.desktopleft then LeftPos := screen.desktopLeft;
repairs the problem.