LCL-Win32: Fix TWin32WSCustomTabControl.GetTabRect. Issue #36412, patch from BrunoK.

git-svn-id: trunk@62366 -
This commit is contained in:
juha 2019-12-09 19:38:52 +00:00
parent 6fe2341ba0
commit dfdf67a3f0

View File

@ -615,11 +615,8 @@ var
hittestInfo: TC_HITTESTINFO; hittestInfo: TC_HITTESTINFO;
Orect: TRect; Orect: TRect;
begin begin
if ATabControl is TTabControl then begin if ATabControl is TTabControl then
Result := 0;; exit(0);
exit;
end;
GetLCLClientBoundsOffset(ATabControl, ORect); GetLCLClientBoundsOffset(ATabControl, ORect);
hittestInfo.pt.x := AClientPos.x + ORect.Left; hittestInfo.pt.x := AClientPos.x + ORect.Left;
hittestInfo.pt.y := AClientPos.y + ORect.Top; hittestInfo.pt.y := AClientPos.y + ORect.Top;
@ -628,8 +625,6 @@ end;
class function TWin32WSCustomTabControl.GetTabRect(const ATabControl: TCustomTabControl; class function TWin32WSCustomTabControl.GetTabRect(const ATabControl: TCustomTabControl;
const AIndex: Integer): TRect; const AIndex: Integer): TRect;
var
Orect: TRect;
begin begin
if ATabControl is TTabControl then begin if ATabControl is TTabControl then begin
Result.Top := 0;; Result.Top := 0;;
@ -638,16 +633,8 @@ begin
Result.Right := 0;; Result.Right := 0;;
exit; exit;
end; end;
if Windows.SendMessage(ATabControl.Handle, TCM_GETITEMRECT, WPARAM(AIndex), LPARAM(@Result)) = 0
GetLCLClientBoundsOffset(ATabControl, ORect); then
if Windows.SendMessage(ATabControl.Handle, TCM_GETITEMRECT, WPARAM(AIndex), LPARAM(@Result)) <> 0
then begin
Result.Top := Result.Top - Orect.Top;
Result.Bottom := Result.Bottom - Orect.Top;
Result.Left := Result.Left - Orect.Left;
Result.Right := Result.Right - Orect.Left;
end
else
Result := inherited GetTabRect(ATabControl, AIndex); Result := inherited GetTabRect(ATabControl, AIndex);
end; end;