mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-10 18:17:18 +02:00
- moved DoShow, DoHide, OnShow, OnHide from TTabSheet to TCustomPage (ancestor)
- fireing OnShow and OnHide on page changing git-svn-id: trunk@10816 -
This commit is contained in:
parent
e8611d44e6
commit
d90cad2972
@ -177,15 +177,10 @@ type
|
||||
|
||||
TTabSheet = class(TCustomPage)
|
||||
private
|
||||
FOnHide: TNotifyEvent;
|
||||
FOnShow: TNotifyEvent;
|
||||
function GetPageControl: TPageControl;
|
||||
function GetTabIndex: Integer;
|
||||
procedure SetPageControl(APageControl: TPageControl);
|
||||
procedure SetTabIndex(const AValue: Integer);
|
||||
protected
|
||||
procedure DoHide; dynamic;
|
||||
procedure DoShow; dynamic;
|
||||
public
|
||||
constructor Create(TheOwner: TComponent); override;
|
||||
destructor Destroy; override;
|
||||
@ -206,12 +201,12 @@ type
|
||||
property OnEndDrag;
|
||||
property OnEnter;
|
||||
property OnExit;
|
||||
property OnHide: TNotifyEvent read FOnHide write FOnHide;
|
||||
property OnHide;
|
||||
property OnMouseDown;
|
||||
property OnMouseMove;
|
||||
property OnMouseUp;
|
||||
property OnResize;
|
||||
property OnShow: TNotifyEvent read FOnShow write FOnShow;
|
||||
property OnShow;
|
||||
property OnStartDrag;
|
||||
property PageIndex stored False;
|
||||
property ParentFont;
|
||||
|
@ -54,6 +54,8 @@ type
|
||||
FTabVisible: Boolean;
|
||||
FFlags: TPageFlags;
|
||||
FImageIndex: integer;
|
||||
FOnHide: TNotifyEvent;
|
||||
FOnShow: TNotifyEvent;
|
||||
function GetTabVisible: Boolean;
|
||||
procedure SetImageIndex(const AValue: integer);
|
||||
procedure SetTabVisible(const AValue: Boolean);
|
||||
@ -65,6 +67,8 @@ type
|
||||
function GetPageIndex: integer;
|
||||
procedure SetPageIndex(AValue: Integer);
|
||||
function DialogChar(var Message: TLMKey): boolean; override;
|
||||
procedure DoHide; dynamic;
|
||||
procedure DoShow; dynamic;
|
||||
public
|
||||
constructor Create(TheOwner: TComponent); override;
|
||||
procedure AdjustClientRect(var ARect: TRect); override;
|
||||
@ -81,6 +85,8 @@ type
|
||||
property Height stored False;
|
||||
property TabOrder stored False;
|
||||
property Visible stored false;
|
||||
property OnHide: TNotifyEvent read FOnHide write FOnHide;
|
||||
property OnShow: TNotifyEvent read FOnShow write FOnShow;
|
||||
end;
|
||||
|
||||
TCustomPageClass = class of TCustomPage;
|
||||
|
@ -716,8 +716,8 @@ end;
|
||||
------------------------------------------------------------------------------}
|
||||
procedure TCustomNotebook.Change;
|
||||
Begin
|
||||
fPageIndexOnLastChange:=fPageIndex;
|
||||
ShowCurrentPage;
|
||||
fPageIndexOnLastChange := fPageIndex;
|
||||
if ([csLoading,csDestroying]*ComponentState=[])
|
||||
and (not fAddingPages) then begin
|
||||
if Assigned(fOnPageChanged) then fOnPageChanged(Self);
|
||||
@ -794,7 +794,17 @@ end;
|
||||
procedure TCustomNotebook.ShowCurrentPage;
|
||||
begin
|
||||
if (FPageIndex >= 0) and (FPageIndex < PageCount) then
|
||||
begin
|
||||
Page[FPageIndex].Visible := true;
|
||||
Page[FPageIndex].DoShow;
|
||||
if (FPageIndexOnLastChange >= 0) and (FPageIndexOnLastChange < PageCount) and
|
||||
(FPageIndexOnLastChange <> FPageIndex) then
|
||||
begin
|
||||
// Page[FPageIndexOnLastChange].Visible := False; <-- this will be better,
|
||||
// but this is not work on gtk (tab hides too)
|
||||
Page[FPageIndexOnLastChange].DoHide;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
|
@ -188,6 +188,18 @@ begin
|
||||
Result:=inherited DialogChar(Message);
|
||||
end;
|
||||
|
||||
procedure TCustomPage.DoHide;
|
||||
begin
|
||||
if Assigned(FOnHide) then
|
||||
FOnHide(Self);
|
||||
end;
|
||||
|
||||
procedure TCustomPage.DoShow;
|
||||
begin
|
||||
if Assigned(FOnShow) then
|
||||
FOnShow(Self);
|
||||
end;
|
||||
|
||||
function TCustomPage.IsControlVisible: Boolean;
|
||||
begin
|
||||
if Parent is TCustomNotebook then
|
||||
|
@ -46,16 +46,6 @@ begin
|
||||
PageIndex:=AValue;
|
||||
end;
|
||||
|
||||
procedure TTabSheet.DoHide;
|
||||
begin
|
||||
|
||||
end;
|
||||
|
||||
procedure TTabSheet.DoShow;
|
||||
begin
|
||||
|
||||
end;
|
||||
|
||||
constructor TTabSheet.Create(TheOwner: TComponent);
|
||||
begin
|
||||
inherited Create(TheOwner);
|
||||
|
Loading…
Reference in New Issue
Block a user