TTabControl: reverted/replaced r64424 #ed6e087523: "fix ClientOrigin, Issue #38403 - Need the origin of the child TabControl".

Modifying the ClientOrigin affects child-controls of the TTabControl.
Also fixes issue #38422, endless recursion if no handle was allocated.

git-svn-id: trunk@64436 -
This commit is contained in:
martin 2021-01-29 18:53:47 +00:00
parent 6fc365af0b
commit dfa3fe0ea4
2 changed files with 6 additions and 8 deletions

View File

@ -839,7 +839,6 @@ type
procedure AdjustDisplayRectWithBorder(var ARect: TRect); virtual;
procedure AdjustClientRect(var ARect: TRect); override;
function CreateTabNoteBookStrings: TTabControlNoteBookStrings; virtual;
function GetClientOrigin: TPoint; override;
public
constructor Create(TheOwner: TComponent); override;
destructor Destroy; override;

View File

@ -758,11 +758,6 @@ begin
Result := TTabControlNoteBookStrings.Create(Self);
end;
function TTabControl.GetClientOrigin: TPoint;
begin
Result := TTabControlNoteBookStrings(FTabs).FNoteBook.ClientOrigin;
end;
constructor TTabControl.Create(TheOwner: TComponent);
begin
FTabControlCreating:=true;
@ -794,13 +789,17 @@ begin
end;
function TTabControl.IndexOfTabAt(X, Y: Integer): Integer;
var
Offs: TPoint;
begin
Result:=TTabControlStrings(FTabs).IndexOfTabAt(X,Y);
Offs := TTabControlNoteBookStrings(FTabs).FNoteBook.ClientOrigin;
Offs := Offs.Subtract(ClientOrigin);
Result:=TTabControlStrings(FTabs).IndexOfTabAt(X-Offs.X, Y-Offs.Y);
end;
function TTabControl.IndexOfTabAt(P: TPoint): Integer;
begin
Result:=TTabControlStrings(FTabs).IndexOfTabAt(P.x, P.y);
Result:=IndexOfTabAt(P.x, P.y);
end;
function TTabControl.GetHitTestInfoAt(X, Y: Integer): THitTests;