mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-16 19:29:34 +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;
|
||||
PanelRight: TPanel;
|
||||
BtnRight: TSpeedButton;
|
||||
TabControl: TCustomTabControl;
|
||||
begin
|
||||
if not aCompPage.Visible then Exit;
|
||||
TabControl := TCustomTabControl(FPageControl);
|
||||
if aCompPage.PageComponent=nil then begin
|
||||
// insert a new PageControl page
|
||||
TCustomTabControl(FPageControl).Pages.Insert(aVisPageIndex, aCompPage.PageName);
|
||||
TabControl.Pages.Insert(aVisPageIndex, aCompPage.PageName);
|
||||
aCompPage.PageComponent := FPageControl.Page[aVisPageIndex];
|
||||
with TScrollBox.Create(aCompPage.PageComponent) do begin
|
||||
Align := alClient;
|
||||
@ -763,13 +765,13 @@ var
|
||||
OnMouseWheel := @OnPageMouseWheel;
|
||||
Parent := PanelRight;
|
||||
end;
|
||||
inc(aVisPageIndex);
|
||||
end else begin
|
||||
// move to the right position
|
||||
PageInd := aCompPage.PageComponent.PageIndex;
|
||||
if PageInd<>aVisPageIndex then
|
||||
TCustomTabControl(FPageControl).Pages.Move(PageInd, aVisPageIndex);
|
||||
if (PageInd<>aVisPageIndex) and (aVisPageIndex < TabControl.Pages.Count) then
|
||||
TabControl.Pages.Move(PageInd, aVisPageIndex);
|
||||
end;
|
||||
inc(aVisPageIndex);
|
||||
end;
|
||||
|
||||
procedure CreateSelectionButton(aCompPage: TBaseComponentPage; aButtonUniqueName: string;
|
||||
|
Loading…
Reference in New Issue
Block a user