mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-18 19:29:31 +02:00
lcl: add TPage.PageIndex and TNotebook.IndexOf
git-svn-id: trunk@52343 -
This commit is contained in:
parent
6b94a5fca9
commit
d22c7ed37a
@ -42,11 +42,14 @@ type
|
||||
TPage = class(TCustomControl)
|
||||
private
|
||||
FOnBeforeShow: TBeforeShowPageEvent;
|
||||
function GetPageIndex: Integer;
|
||||
protected
|
||||
procedure SetParent(AParent: TWinControl); override;
|
||||
public
|
||||
constructor Create(TheOwner: TComponent); override;
|
||||
destructor Destroy; override;
|
||||
public
|
||||
property PageIndex: Integer read GetPageIndex;
|
||||
published
|
||||
// Lazarus-specific TPage events
|
||||
// OnBeforeShow occurs before a page is displayed, so that
|
||||
@ -128,8 +131,8 @@ type
|
||||
{ function TabIndexAtClientPos(ClientPos: TPoint): integer;
|
||||
function TabRect(AIndex: Integer): TRect;
|
||||
function GetImageIndex(ThePageIndex: Integer): Integer; virtual;
|
||||
function IndexOf(APage: TCustomPage): integer;
|
||||
function CustomPage(Index: integer): TCustomPage;}
|
||||
function IndexOf(APage: TPage): integer;
|
||||
public
|
||||
property ActivePage: String read GetActivePage;// write SetActivePage; // should not be published because the read can raise an exception
|
||||
property ActivePageComponent: TPage read GetActivePageComponent;// write SetActivePage; // should not be published because the read can raise an exception
|
||||
|
@ -154,6 +154,15 @@ begin
|
||||
Result := FPageIndex;
|
||||
end;
|
||||
|
||||
function TNotebook.IndexOf(APage: TPage): integer;
|
||||
begin
|
||||
for Result := 0 to PageCount-1 do
|
||||
if Page[Result] = APage then
|
||||
Exit;
|
||||
|
||||
Result := -1;
|
||||
end;
|
||||
|
||||
procedure TNotebook.InsertPage(APage: TPage; Index: Integer);
|
||||
begin
|
||||
if FPageList.IndexOf(APage) >= 0 then Exit;
|
||||
|
@ -73,6 +73,13 @@ begin
|
||||
inherited Destroy;
|
||||
end;
|
||||
|
||||
function TPage.GetPageIndex: Integer;
|
||||
begin
|
||||
if Parent is TNotebook then
|
||||
Result := TNotebook(Parent).IndexOf(Self)
|
||||
else
|
||||
Result := -1;
|
||||
end;
|
||||
|
||||
|
||||
// included by extctrls.pp
|
||||
|
Loading…
Reference in New Issue
Block a user