MG: implemented indirect deletion of designed components

git-svn-id: trunk@3541 -
This commit is contained in:
lazarus 2002-10-23 14:12:04 +00:00
parent 9464792e01
commit d5ed4b368b
2 changed files with 22 additions and 15 deletions

View File

@ -2041,7 +2041,7 @@ begin
and (FPropertyEditorHook.LookupRoot<>nil) then begin
Root:=FPropertyEditorHook.LookupRoot;
AddComponentToAvailComboBox(Root);
//writeln('[TObjectInspector.FillComponentComboBox] B ',Root.Name,' ',Root.ComponentCount);
writeln('[TObjectInspector.FillComponentComboBox] B ',Root.Name,' ',Root.ComponentCount);
for a:=0 to Root.ComponentCount-1 do
AddComponentToAvailComboBox(Root.Components[a]);
end;

View File

@ -131,7 +131,7 @@ TCustomFormEditor
destructor Destroy; override;
Function AddSelected(Value : TComponent) : Integer;
Procedure DeleteControl(Value : TComponent);
Procedure DeleteControl(Value : TComponent; FreeComponent: boolean);
Function FormModified : Boolean; override;
Function FindComponentByName(const Name : ShortString) : TIComponentInterface; override;
Function FindComponent(AComponent: TComponent): TIComponentInterface; override;
@ -649,7 +649,8 @@ Begin
Obj_Inspector.Selections := FSelectedComponents;
end;
Procedure TCustomFormEditor.DeleteControl(Value : TComponent);
Procedure TCustomFormEditor.DeleteControl(Value : TComponent;
FreeComponent: boolean);
var
Temp : TComponentInterface;
i: integer;
@ -660,21 +661,27 @@ Begin
begin
RemoveFromComponentInterfaceList(Temp);
if (Value is TCustomForm) then begin
AForm:=TCustomForm(Value);
i:=AForm.ComponentCount-1;
while i>=0 do begin
DeleteControl(AForm.Components[i]);
dec(i);
if i>AForm.ComponentCount-1 then
i:=AForm.ComponentCount-1;
if FreeComponent then begin
AForm:=TCustomForm(Value);
i:=AForm.ComponentCount-1;
while i>=0 do begin
DeleteControl(AForm.Components[i],true);
dec(i);
if i>AForm.ComponentCount-1 then
i:=AForm.ComponentCount-1;
end;
if not (AForm is TForm) then
writeln('WARNING: TCustomFormEditor.DeleteControl ',AForm.ClassName);
JITFormList.DestroyJITForm(TForm(AForm));
end;
if not (AForm is TForm) then
writeln('WARNING: TCustomFormEditor.DeleteControl ',AForm.ClassName);
JITFormList.DestroyJITForm(TForm(AForm));
Temp.Free;
end
else
Temp.Delete;
else begin
if FreeComponent then
Temp.Delete
else
Temp.Free;
end;
end;
end;