LCL: Fix THintWindow.CalcHintRect. Issue #26674. Inspired by patch from Denis Golovan.

git-svn-id: trunk@46165 -
This commit is contained in:
juha 2014-09-09 10:17:54 +00:00
parent 51415f926a
commit 78afb4c373
5 changed files with 10 additions and 7 deletions

View File

@ -328,7 +328,7 @@ var
HintWinRect: TRect;
begin
HintWinRect := HintTextWindow.CalcHintRect(Screen.Width, TheHint, Nil);
HintTextWindow.HintRectAdjust := HintWinRect; // Adds borders.
HintTextWindow.HintRect := HintWinRect; // Adds borders.
HintTextWindow.OffsetHintRect(ScreenPos);
HintTextWindow.ActivateHint(TheHint);
end;

View File

@ -4229,7 +4229,7 @@ begin
Rect.Right := Rect.Left + Rect.Right;
Rect.Bottom := Rect.Top + Rect.Bottom;
FHintWindow.HintRectAdjust := Rect;
FHintWindow.HintRect := Rect;
FHintWindow.ActivateHint(AHint);
end;

View File

@ -1679,7 +1679,7 @@ begin
TheHint:='';
end else begin
HintWinRect := aHintWindow.CalcHintRect(Screen.Width, TheHint, Nil);
aHintWindow.HintRectAdjust := HintWinRect; // Adds borders.
aHintWindow.HintRect := HintWinRect; // Adds borders.
end;
OffsetRect(HintWinRect, ScreenPos.X, ScreenPos.Y+30);

View File

@ -860,7 +860,7 @@ begin
//DebugLn(['TApplication.ShowHintWindow FHintWindow.Color=',dbgs(FHintWindow.Color),' HintInfo.HintColor=',dbgs(HintInfo.HintColor)]);
//debugln('TApplication.ShowHintWindow B HintWinRect=',dbgs(HintWinRect),' HintStr="',DbgStr(HintInfo.HintStr),'"');
FHintWindow.HintRectAdjust := HintWinRect;
FHintWindow.HintRect := HintWinRect;
FHintWindow.ActivateHint(HintInfo.HintStr);
FHintRect := HintInfo.CursorRect;
// start hide timer

View File

@ -12,8 +12,8 @@
{
use:
HintWindow := THintWindow.Create(nil);
Rect := HintWindow.CalcHintRect(0,'This is the hint');
HintWindow.ActivateWithBounds(Rect,'This is the hint');
Rect := HintWindow.CalcHintRect(0,'This is the hint', Nil);
HintWindow.ActivateHint(Rect,'This is the hint');
}
@ -242,7 +242,7 @@ end;
procedure THintWindow.ActivateHintData(ARect: TRect; const AHint: String; AData: pointer);
begin
HintRectAdjust := ARect;
HintRect := ARect;
ActivateHint(AHint); // AData is not used now.
end;
@ -265,6 +265,9 @@ begin
ThemeServices.GetElementDetails(tttStandardNormal), AHint, Flags, @Result)
else
DrawText(uh, PChar(AHint), Length(AHint), Result, Flags);
// compensate for InflateRect in Paint method
Inc(Result.Right, 4 * HintBorderWidth);
Inc(Result.Bottom, 4 * HintBorderWidth);
//debugln('THintWindow.CalcHintRect Result=',dbgs(Result));
end;