RxDateEdit - fix calendar popup windows position on multimonitor configuration

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@2889 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
alexs75
2014-01-20 06:54:10 +00:00
parent 1e13eb1c2d
commit 7f1dc5a82e

View File

@ -562,6 +562,7 @@ end;
procedure TCustomRxDateEdit.PopupDropDown(DisableEdit: Boolean);
var
P: TPoint;
ABounds:TRect;
Y: Integer;
procedure DoTrySetDate;
@ -591,9 +592,22 @@ begin
if (FPopup <> nil) and not (ReadOnly {or FPopupVisible}) then
begin
P := Parent.ClientToScreen(Point(Left, Top));
ABounds := Screen.MonitorFromPoint(P).BoundsRect;
{ if PopupOrigin.X + Width > ABounds.Right then
Left := ABounds.Right - Width
else
Left := PopupOrigin.X;
if PopupOrigin.Y + Height > ABounds.Bottom then
Top := ABounds.Bottom - Height
else
Top := PopupOrigin.Y;}
Y := P.Y + Height;
if Y + FPopup.Height > Screen.Height then
if Y + FPopup.Height > ABounds.Right then
Y := P.Y - FPopup.Height;
case FPopupAlign of
epaRight:
@ -603,13 +617,13 @@ begin
end;
epaLeft:
begin
if P.X + FPopup.Width > Screen.Width then
if P.X + FPopup.Width > ABounds.Right then
Dec(P.X, FPopup.Width - Width);
end;
end;
if P.X < 0 then P.X := 0
else if P.X + FPopup.Width > Screen.Width then
P.X := Screen.Width - FPopup.Width;
else if P.X + FPopup.Width > ABounds.Right then
P.X := ABounds.Right - FPopup.Width;
DoTrySetDate;