mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-18 20:59:08 +02:00
IDE: Prevent a crash when adding a component palette tab with an existing name.
git-svn-id: trunk@46840 -
This commit is contained in:
parent
c57b1c69bc
commit
084dd37ed0
@ -722,11 +722,13 @@ var
|
|||||||
PageInd: Integer;
|
PageInd: Integer;
|
||||||
PanelRight: TPanel;
|
PanelRight: TPanel;
|
||||||
BtnRight: TSpeedButton;
|
BtnRight: TSpeedButton;
|
||||||
|
TabControl: TCustomTabControl;
|
||||||
begin
|
begin
|
||||||
if not aCompPage.Visible then Exit;
|
if not aCompPage.Visible then Exit;
|
||||||
|
TabControl := TCustomTabControl(FPageControl);
|
||||||
if aCompPage.PageComponent=nil then begin
|
if aCompPage.PageComponent=nil then begin
|
||||||
// insert a new PageControl page
|
// insert a new PageControl page
|
||||||
TCustomTabControl(FPageControl).Pages.Insert(aVisPageIndex, aCompPage.PageName);
|
TabControl.Pages.Insert(aVisPageIndex, aCompPage.PageName);
|
||||||
aCompPage.PageComponent := FPageControl.Page[aVisPageIndex];
|
aCompPage.PageComponent := FPageControl.Page[aVisPageIndex];
|
||||||
with TScrollBox.Create(aCompPage.PageComponent) do begin
|
with TScrollBox.Create(aCompPage.PageComponent) do begin
|
||||||
Align := alClient;
|
Align := alClient;
|
||||||
@ -763,13 +765,13 @@ var
|
|||||||
OnMouseWheel := @OnPageMouseWheel;
|
OnMouseWheel := @OnPageMouseWheel;
|
||||||
Parent := PanelRight;
|
Parent := PanelRight;
|
||||||
end;
|
end;
|
||||||
|
inc(aVisPageIndex);
|
||||||
end else begin
|
end else begin
|
||||||
// move to the right position
|
// move to the right position
|
||||||
PageInd := aCompPage.PageComponent.PageIndex;
|
PageInd := aCompPage.PageComponent.PageIndex;
|
||||||
if PageInd<>aVisPageIndex then
|
if (PageInd<>aVisPageIndex) and (aVisPageIndex < TabControl.Pages.Count) then
|
||||||
TCustomTabControl(FPageControl).Pages.Move(PageInd, aVisPageIndex);
|
TabControl.Pages.Move(PageInd, aVisPageIndex);
|
||||||
end;
|
end;
|
||||||
inc(aVisPageIndex);
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure CreateSelectionButton(aCompPage: TBaseComponentPage; aButtonUniqueName: string;
|
procedure CreateSelectionButton(aCompPage: TBaseComponentPage; aButtonUniqueName: string;
|
||||||
|
Loading…
Reference in New Issue
Block a user