Ignore:
Timestamp:
Mar 10, 2011, 1:32:41 PM (14 years ago)
Author:
george
Message:
  • Modified: Removed TPanel component from TCoolDockConjoinForm to simplify component structure.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Docking/CoolDocking/UCoolDockLayout.pas

    r185 r186  
    77uses
    88  Classes, SysUtils, FileUtil, Contnrs, URectangle, Forms, UCoolDockCommon,
    9   DOM, XMLWrite, XMLRead, Controls;
     9  DOM, XMLWrite, XMLRead, Controls, Dialogs;
    1010
    1111type
     
    7777end;
    7878
     79function FindGlobalComponentDeep(Name: string): TComponent;
     80var
     81  I: Integer;
     82begin
     83  for I := 0 to Application.ComponentCount - 1 do begin
     84    Result := Application.Components[I];
     85    if Result.Name = Name then Exit
     86      else begin
     87        Result := Result.FindComponent(Name);
     88        if Assigned(Result) and (Result.Name = Name) then Exit;
     89      end;
     90  end;
     91end;
     92
    7993{ TCoolDockLayoutList }
    8094
     
    346360    else ParentName := '';
    347361  if Assigned(Form.HostDockSite) then begin
    348     if Assigned(Form.HostDockSite.Parent) and (Form.HostDockSite.Parent is TForm) then
     362    if Assigned(Form.HostDockSite) then
    349363    begin
    350       HostDockSiteName := Form.HostDockSite.Parent.Name;
     364      HostDockSiteName := Form.HostDockSite.Name;
    351365      if not Assigned(Parent.FindByName(HostDockSiteName)) then begin
    352366        NewItem := TCoolDockLayoutItem.Create;
    353367        NewItem.Parent := Parent;
    354         NewItem.DockStyle := TCoolDockManager(Form.HostDockSite.Parent.DockManager).DockStyle;
     368        NewItem.DockStyle := TCoolDockManager(Form.HostDockSite.DockManager).DockStyle;
    355369        Parent.Items.Add(NewItem);
    356         NewItem.Store(Form.HostDockSite.Parent);
     370        NewItem.Store(Form.HostDockSite);
    357371      end;
    358372    end;
     
    383397  Form.Visible := Visible;
    384398  if HostDockSiteName <> '' then begin
    385     ParentComponent := FindGlobalComponent(HostDockSiteName);
     399    ParentComponent := FindGlobalComponentDeep(HostDockSiteName);
    386400    if not Assigned(ParentComponent) then begin
    387401      ParentLayoutItem := Parent.FindByName(HostDockSiteName);
     
    393407            if FormClass = TCoolDockConjoinForm then begin
    394408              ParentComponent := TCoolDockManager(Form.DockManager).CreateContainer(alNone);
    395               TCoolDockManager(TCoolDockConjoinForm(ParentComponent).Panel.DockManager).DockStyle := ParentLayoutItem.DockStyle;
     409              TCoolDockManager(TCoolDockConjoinForm(ParentComponent).DockManager).DockStyle := ParentLayoutItem.DockStyle;
    396410              ParentLayoutItem.Restore(TWinControl(ParentComponent));
    397411            end;
     
    400414      end;
    401415    end;
    402     if Assigned(ParentComponent) and (ParentComponent is TCoolDockConjoinForm) then
    403       Form.ManualDock(TCoolDockConjoinForm(ParentComponent).Panel);
     416    if Assigned(ParentComponent) and (ParentComponent is TWinControl) then
     417      Form.ManualDock(TWinControl(ParentComponent));
    404418  end;
    405419  Processed := True;
Note: See TracChangeset for help on using the changeset viewer.