Designer: Give names for the side components of PairSplitter. Don't crash when deleting. Issue #38227.

git-svn-id: trunk@64225 -
This commit is contained in:
juha 2020-12-18 10:51:37 +00:00
parent 4c9264496d
commit 5cf724ae46
3 changed files with 15 additions and 5 deletions

View File

@ -747,7 +747,6 @@ begin
FPersToChange := APersistent;
FZOrderDelete := AZOrder;
BuildComponentNodes(False);
Assert(FPersToChange=nil, 'TComponentTreeView.ChangeCompZOrder: FPersToChange is assigned.');
end;
procedure TComponentTreeView.DeleteComponentNode(APersistent: TPersistent);
@ -755,7 +754,6 @@ begin
FPersToChange := APersistent;
FZOrderDelete := zoDelete;
BuildComponentNodes(False);
Assert(FPersToChange=nil, 'TComponentTreeView.DeleteComponentNode: FPersToChange is assigned.');
end;
procedure TComponentTreeView.UpdateCompNode(ANode: TTreeNode);

View File

@ -37,8 +37,9 @@ interface
{off $DEFINE VerboseDesignerSelect}
uses
// RTL + FCL + LCL
Types, Classes, Math, SysUtils, variants, TypInfo,
// RTL + FCL
Types, Classes, Math, SysUtils, Variants, TypInfo,
// LCL
LCLProc, LCLType, LResources, LCLIntf, LMessages, InterfaceBase,
Forms, Controls, GraphType, Graphics, Dialogs, ExtCtrls, Menus, ClipBrd,
// LazUtils
@ -1631,10 +1632,21 @@ begin
end;
procedure TDesigner.NotifyComponentAdded(AComponent: TComponent);
var
i: Integer;
SubContrl: TControl;
begin
try
if AComponent.Name='' then
AComponent.Name:=UniqueName(AComponent.ClassName);
// Iterating Controls is needed at least for Side1 and Side2 of TPairSplitter.
if AComponent is TWinControl then
for i:=0 to TWinControl(AComponent).ControlCount-1 do
begin
SubContrl:=TWinControl(AComponent).Controls[i];
if SubContrl.Name='' then
SubContrl.Name:=UniqueName(SubContrl.ClassName);
end;
GlobalDesignHook.PersistentAdded(AComponent,false);
except
on E: Exception do

View File

@ -1363,7 +1363,7 @@ begin
AParent:=AParent.Parent;
end;
end;
DebugLn('Parent is '''+dbgsName(AParent)+'''');
//DebugLn('TCustomFormEditor.CreateComponent: Parent is '''+dbgsName(AParent)+'''');
end else begin
// create a toplevel component
// -> a form or a datamodule or a custom component