lcl: GetTabIndex should return the index of Tab, not the index of Page. Remove SetTabIndex.

git-svn-id: trunk@25329 -
This commit is contained in:
paul 2010-05-12 08:23:49 +00:00
parent 91f1a118d2
commit bdab0c4699
3 changed files with 15 additions and 11 deletions

View File

@ -224,14 +224,13 @@ type
function GetPageControl: TPageControl;
function GetTabIndex: Integer;
procedure SetPageControl(APageControl: TPageControl);
procedure SetTabIndex(const AValue: Integer);
protected
class procedure WSRegisterClass; override;
public
constructor Create(TheOwner: TComponent); override;
destructor Destroy; override;
property PageControl: TPageControl read GetPageControl write SetPageControl;
property TabIndex: Integer read GetTabIndex write SetTabIndex;
property TabIndex: Integer read GetTabIndex;
published
property Caption;
property ChildSizing;

View File

@ -159,7 +159,7 @@ end;
------------------------------------------------------------------------------}
function TCustomPage.GetPageIndex: integer;
begin
if (Parent<>nil) and (Parent is TCustomNotebook) then
if (Parent <> nil) and (Parent is TCustomNotebook) then
Result := TCustomNotebook(Parent).PageList.IndexOf(Self)
else
Result := -1;

View File

@ -23,16 +23,26 @@
{ TTabSheet }
function TTabSheet.GetTabIndex: Integer;
var
i: Integer;
begin
Result:=PageIndex;
if not TabVisible then
Result := -1
else
begin
Result := 0;
for i := 0 to PageIndex - 1 do
if PageControl.Pages[i].TabVisible then
inc(Result);
end;
end;
function TTabSheet.GetPageControl: TPageControl;
begin
if (Parent is TPageControl) then
Result:=TPageControl(Parent)
Result := TPageControl(Parent)
else
Result:=nil;
Result := nil;
end;
procedure TTabSheet.SetPageControl(APageControl: TPageControl);
@ -41,11 +51,6 @@ begin
Parent:=APageControl;
end;
procedure TTabSheet.SetTabIndex(const AValue: Integer);
begin
PageIndex:=AValue;
end;
class procedure TTabSheet.WSRegisterClass;
begin
inherited WSRegisterClass;