mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-04 02:36:27 +02:00
TCustomTabControl: only call MaybeSelectFirstControlOnPage if APage is not nil. Remove duplicate checks.
This commit is contained in:
parent
9fe0319df7
commit
db41ce26cf
@ -774,9 +774,10 @@ var
|
|||||||
ParentForm: TCustomForm;
|
ParentForm: TCustomForm;
|
||||||
C, ActiveControl: TWinControl;
|
C, ActiveControl: TWinControl;
|
||||||
begin
|
begin
|
||||||
|
Assert(Assigned(APage),'TCustomTabControl.MaybeSelectFirstControlOnPage: APage=nil');
|
||||||
ParentForm := GetParentForm(Self);
|
ParentForm := GetParentForm(Self);
|
||||||
//Debugln(['TCustomTabControl.ActivateFirstControl: Self=',DbgSName(Self),', APage=',DbgSName(APage),', ParentForm=',DbgSName(ParentForm)]);
|
//Debugln(['TCustomTabControl.ActivateFirstControl: Self=',DbgSName(Self),', APage=',DbgSName(APage),', ParentForm=',DbgSName(ParentForm)]);
|
||||||
if not (Assigned(APage) and Assigned(ParentForm) and APage.Visible and APage.Enabled and (APage.ControlCount > 0)) then
|
if not (Assigned(ParentForm) and APage.Visible and APage.Enabled and (APage.ControlCount > 0)) then
|
||||||
Exit;
|
Exit;
|
||||||
//Debugln(['TCustomTabControl.ActivateFirstControl: APage.Visible=',APage.Visible,', APage.Enabled=',APage.Enabled,', (APage.ControlCount > 0)=', (APage.ControlCount > 0)]);
|
//Debugln(['TCustomTabControl.ActivateFirstControl: APage.Visible=',APage.Visible,', APage.Enabled=',APage.Enabled,', (APage.ControlCount > 0)=', (APage.ControlCount > 0)]);
|
||||||
ActiveControl := ParentForm.ActiveControl;
|
ActiveControl := ParentForm.ActiveControl;
|
||||||
@ -1050,8 +1051,6 @@ end;
|
|||||||
procedure TCustomTabControl.Change;
|
procedure TCustomTabControl.Change;
|
||||||
var
|
var
|
||||||
APage: TCustomPage;
|
APage: TCustomPage;
|
||||||
ParentForm: TCustomForm;
|
|
||||||
ActiveControl: TWinControl;
|
|
||||||
begin
|
begin
|
||||||
//DebugLn(['TCustomTabControl.Change ',DbgSName(Self),' fPageIndex=',fPageIndex]);
|
//DebugLn(['TCustomTabControl.Change ',DbgSName(Self),' fPageIndex=',fPageIndex]);
|
||||||
ShowCurrentPage;
|
ShowCurrentPage;
|
||||||
@ -1061,9 +1060,7 @@ begin
|
|||||||
begin
|
begin
|
||||||
APage := ActivePageComponent;
|
APage := ActivePageComponent;
|
||||||
//debugln(['TCustomTabControl.Change: Self=',DbgSName(Self),', APage',DbgSName(APage)]);
|
//debugln(['TCustomTabControl.Change: Self=',DbgSName(Self),', APage',DbgSName(APage)]);
|
||||||
//if Assigned(APage) then debugln(['APage.Visible=',APage.Visible,', APage.Enabled=',APage.Enabled,', (APage.ControlCount > 0)=',(APage.ControlCount > 0)]);
|
if Assigned(APage) then
|
||||||
ParentForm := GetParentForm(Self);
|
|
||||||
if (Assigned(ParentForm) and Assigned(APage) and APage.Visible and APage.Enabled and (APage.ControlCount > 0)) then
|
|
||||||
MaybeSelectFirstControlOnPage(APage);
|
MaybeSelectFirstControlOnPage(APage);
|
||||||
|
|
||||||
DoChange;
|
DoChange;
|
||||||
@ -1099,11 +1096,15 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCustomTabControl.InternalSetPageIndex(AValue: Integer);
|
procedure TCustomTabControl.InternalSetPageIndex(AValue: Integer);
|
||||||
|
var
|
||||||
|
APage: TCustomPage;
|
||||||
begin
|
begin
|
||||||
FPageIndex := AValue;
|
FPageIndex := AValue;
|
||||||
UpdateAllDesignerFlags;
|
UpdateAllDesignerFlags;
|
||||||
DoSendPageIndex;
|
DoSendPageIndex;
|
||||||
MaybeSelectFirstControlOnPage(GetActivePageComponent);
|
APage := GetActivePageComponent;
|
||||||
|
if Assigned(APage) then
|
||||||
|
MaybeSelectFirstControlOnPage(APage);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
|
Loading…
Reference in New Issue
Block a user