docking: fix crash

git-svn-id: trunk@14008 -
This commit is contained in:
paul 2008-02-07 00:07:46 +00:00
parent 6c623426f8
commit 016f6c1c6e
2 changed files with 21 additions and 15 deletions

View File

@ -167,16 +167,19 @@ end;
function TDockZone.FindZone(AControl: TControl): TDockZone;
begin
if AControl=ChildControl then begin
Result:=Self;
Result := nil;
if AControl = ChildControl then
begin
Result := Self;
exit;
end;
if FFirstChildZone<>nil then begin
Result:=FFirstChildZone.FindZone(AControl);
if Result<>nil then exit;
if FFirstChildZone <> nil then
begin
Result := FFirstChildZone.FindZone(AControl);
if Result <> nil then exit;
end;
if FNextSibling<>nil then
Result:=FNextSibling.FindZone(AControl);
if FNextSibling <> nil then
Result := FNextSibling.FindZone(AControl);
end;
function TDockZone.FirstVisibleChild: TDockZone;

View File

@ -651,7 +651,7 @@ begin
DockCaption := DockSite.GetDockCaption(AControl);
TextStyle.Alignment := taLeftJustify;
TextStyle.SingleLine := True;
TextStyle.Clipping := True;
TextStyle.Clipping := False;
TextStyle.Opaque := False;
TextStyle.Wordbreak := False;
TextStyle.SystemFont := False;
@ -1064,13 +1064,16 @@ procedure TLazDockTree.RemoveControl(AControl: TControl);
var
RemoveZone: TLazDockZone;
begin
RemoveZone:=RootZone.FindZone(AControl) as TLazDockZone;
if RemoveZone.ChildCount>0 then
raise Exception.Create('TLazDockTree.RemoveControl RemoveZone.ChildCount>0');
RemoveZone.FreeSubComponents;
if RemoveZone.Parent<>nil then
RemoveZone.Parent.Remove(RemoveZone);
RemoveZone.Free;
RemoveZone := RootZone.FindZone(AControl) as TLazDockZone;
if RemoveZone <> nil then
begin
if RemoveZone.ChildCount>0 then
raise Exception.Create('TLazDockTree.RemoveControl RemoveZone.ChildCount>0');
RemoveZone.FreeSubComponents;
if RemoveZone.Parent<>nil then
RemoveZone.Parent.Remove(RemoveZone);
RemoveZone.Free;
end;
// Build dock layout (anchors, splitters, pages)
BuildDockLayout(RootZone as TLazDockZone);