From a6ee92da7b532fc87d448c2b14981911accfb5ab Mon Sep 17 00:00:00 2001 From: Martin Date: Wed, 18 Oct 2023 16:13:26 +0200 Subject: [PATCH] IDE: Hint (Html/TurboPowerIPro), add space for horizontal scrollbar if needed. Issue #40565 (cherry picked from commit 79a86659890904610031600ef0e87543bbd50500) --- components/ideintf/idehelpintf.pas | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/components/ideintf/idehelpintf.pas b/components/ideintf/idehelpintf.pas index fb85bcb2b0..183c9d6e63 100644 --- a/components/ideintf/idehelpintf.pas +++ b/components/ideintf/idehelpintf.pas @@ -384,6 +384,7 @@ function THintWindowManager.ShowHint(ScreenPos: TPoint; TheHint: string; ms: TMemoryStream; NewWidth, NewHeight: integer; R1, R2: TRect; + ReducedHeight, ReducedWidth: Boolean; begin if HintFont<>nil then HintRenderWindow.Font := HintFont; @@ -412,9 +413,13 @@ function THintWindowManager.ShowHint(ScreenPos: TPoint; TheHint: string; R1 := HintRenderWindow.HintRect; HintRenderWindow.OffsetHintRect(ScreenPos, 0, True, False); // shrink height only for fixed (no MouseOffset) hints R2 := HintRenderWindow.HintRect; - if R1.Bottom-R1.Top>R2.Bottom-R2.Top then // the height was decreased -> scrollbar will be shown, increase width - begin - Inc(R2.Right, GetSystemMetrics(SM_CXVSCROLL)); + ReducedWidth := R1.Right-R1.Left>R2.Right-R2.Left; + ReducedHeight := R1.Bottom-R1.Top>R2.Bottom-R2.Top; + if ReducedHeight <> ReducedWidth then begin // if both were reduced, they can't be increased + if ReducedWidth then // the width was decreased -> scrollbar will be shown, increase width + Inc(R2.Bottom, GetSystemMetrics(SM_CYHSCROLL)); + if ReducedHeight then // the height was decreased -> scrollbar will be shown, increase width + Inc(R2.Right, GetSystemMetrics(SM_CXVSCROLL)); HintRenderWindow.HintRect := R2; HintRenderWindow.OffsetHintRect(Point(0, 0), 0); end;