Ignore:
Timestamp:
Oct 17, 2012, 1:24:58 PM (12 years ago)
Author:
chronos
Message:
  • Fixed: CoolDock show wrong tab focused if tab was invisible.
Location:
Docking/CoolDocking/Managers
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • Docking/CoolDocking/Managers/UCDManagerRegions.pas

    r365 r430  
    2222    procedure Paint(Sender: TObject); override;
    2323    procedure PanelResize(Sender: TObject);
    24     constructor Create;
     24    constructor Create; override;
    2525    destructor Destroy; override;
    2626    procedure SetControl(const AValue: TWinControl); override;
     
    3434    FDockItems: TObjectList; // TList<TCDManagerRegionsItem>
    3535    FLastVisibleItemsCount: Integer;
    36     function GetHeaderPos: THeaderPos; override;
    37     procedure SetHeaderPos(const AValue: THeaderPos); override;
    3836    function GetDirection(InsertAt: TAlign): TCDDirection;
    3937    procedure ResizePanels;
     
    4341  protected
    4442    FDockDirection: TCDDirection;
     43    procedure SetHeaderPos(const AValue: THeaderPos); override;
    4544  public
    4645    //Panels: TObjectList; // TObjectList<TCDStyleRegionsPanel>
     46    function GetHeaderPos: THeaderPos; override;
    4747    procedure BringToFront; override;
    4848    function FindControlInPanels(Control: TControl): TCDManagerItem; override;
     
    136136  PanelHeader.Free;
    137137  Splitter.Parent := nil;
    138   Splitter.Free;
     138  FreeAndNil(Splitter);
    139139  if Assigned(Control) then Control.Parent := nil;
    140   inherited Destroy;
     140  inherited;
    141141end;
    142142
    143143procedure TCDManagerRegionsItem.SetControl(const AValue: TWinControl);
    144144begin
    145   inherited SetControl(AValue);
     145  inherited;
    146146  PanelHeader.Header.Control := AValue;
    147147end;
     
    365365        TCDManagerItem(DockItems[0]).Control.ManualDock(HostDockSite);
    366366      end else TCDManagerItem(DockItems[0]).Control.ManualFloat(Rect(Left, Top, Left + Width, Top + Height));
    367       ManualFloat(Rect(Left, Top, Left + Width, Top + Height));
    368       inherited RemoveControl(Control);
    369       Free;
     367      if FreeIfEmpty then ManualFloat(Rect(Left, Top, Left + Width, Top + Height));
     368      inherited;
     369      if FreeIfEmpty then Free;
    370370      Exit;
    371371    end;
    372372  end;
    373   inherited RemoveControl(Control);
     373  inherited;
    374374  if ClientCount > 1 then Update;
    375375end;
  • Docking/CoolDocking/Managers/UCDManagerTabs.pas

    r373 r430  
    7575destructor TCDManagerTabsItem.Destroy;
    7676begin
    77   IconImage.Free;
    78   inherited Destroy;
     77  FreeAndNil(IconImage);
     78  inherited;
    7979end;
    8080
     
    211211destructor TCDManagerTabs.Destroy;
    212212begin
    213   FDockItems.Free;
    214   PageControl.Free;
    215   TabImageList.Free;
    216   inherited Destroy;
     213  FreeAndNil(FDockItems);
     214  FreeAndNil(PageControl);
     215  FreeAndNil(TabImageList);
     216  inherited;
    217217end;
    218218
     
    221221  I: Integer;
    222222begin
    223   inherited PaintSite(DC);
     223  inherited;
    224224  //PageControl.Invalidate;
    225225end;
     
    281281        TCDManagerItem(DockItems[0]).Control.ManualDock(HostDockSite);
    282282      end else TCDManagerItem(DockItems[0]).Control.ManualFloat(Rect(Left, Top, Left + Width, Top + Height));
    283       ManualFloat(Rect(Left, Top, Left + Width, Top + Height));
     283      if FreeIfEmpty then ManualFloat(Rect(Left, Top, Left + Width, Top + Height));
    284284      //Update;
    285       inherited RemoveControl(Control);
    286       Free;
     285      inherited;
     286      if FreeIfEmpty then Free;
    287287      Exit;
    288288    end;
     
    290290  //if ClientCount > 0 then
    291291  Update;
    292   inherited RemoveControl(Control);
     292  inherited;
    293293end;
    294294
     
    330330procedure TCDManagerTabs.BringToFront;
    331331begin
    332   inherited BringToFront;
     332  inherited;
    333333  Update;
    334334end;
     
    377377  NewTabSheet: TTabSheet;
    378378  DeletedPage: TTabSheet;
    379 begin
     379  LastIndex: Integer;
     380begin
     381  LastIndex := PageControl.TabIndex;
    380382  if FUpdateCount = 0 then begin
    381383  DebugLog('TCDManagerTabs.Update');
     
    425427      TCDManager(Control.DockManager).DockSiteVisible := True;
    426428      if not Control.Visible then Control.Show;
     429      //PageControl.TabIndex := I;
    427430    end else begin
    428431      TCDManager(Control.DockManager).DockSiteVisible := False;
     
    436439  end;
    437440  inherited;
     441  //ShowMessage(IntToStr(PageControl.TabIndex));
     442  PageControl.TabIndex := LastIndex;
    438443end;
    439444
Note: See TracChangeset for help on using the changeset viewer.