MG: fixed removing notebook

git-svn-id: trunk@2010 -
This commit is contained in:
lazarus 2002-08-17 23:40:37 +00:00
parent c30ed6f2fb
commit 9d188370ec

View File

@ -273,30 +273,28 @@ Begin
// remove all child controls owned by the form
if (AComponent is TWinControl) then begin
AWinControl:=TWinControl(AComponent);
if (csAcceptsControls in AWinControl.ControlStyle) then begin
i:=AWinControl.ControlCount-1;
while (i>=0) do begin
ChildControl:=AWinControl.Controls[i];
if ChildControl.Owner=Form then begin
RemoveComponent(ChildControl);
// the component list of the form has changed
// -> restart the search
i:=AWinControl.ControlCount-1;
continue;
end;
i:=AWinControl.ControlCount-1;
while (i>=0) do begin
ChildControl:=AWinControl.Controls[i];
if ChildControl.Owner=Form then begin
RemoveComponent(ChildControl);
// the component list of the form has changed
// -> restart the search
i:=AWinControl.ControlCount-1;
continue;
end;
dec(i);
end;
dec(i);
end;
// remove component
if Assigned(FOnRemoveComponent) then
FOnRemoveComponent(Self,AComponent);
// this sends a message to notification and removes it from the controlselection
{$IFDEF VerboseDesigner}
Writeln('[TDesigner.RemoveControl] C ',AComponent.Name,':',AComponent.ClassName);
{$ENDIF}
if not (AComponent is TControl) then
Form.Invalidate;
// this sends a message to notification and removes it from the controlselection
TheFormEditor.DeleteControl(AComponent);
end;