Ignore:
Timestamp:
Nov 19, 2012, 2:34:58 PM (12 years ago)
Author:
chronos
Message:
  • Fixed: Better switching tabbed controls.
Location:
Docking/CoolDocking/Managers
Files:
3 edited

Legend:

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

    r430 r437  
    5151      DropCtl: TControl); override;
    5252    procedure RemoveControl(Control: TControl); override;
    53     constructor Create(ADockSite: TWinControl);
     53    constructor Create(ADockSite: TWinControl); override;
    5454    destructor Destroy; override;
    5555    procedure PaintSite(DC: HDC); override;
    5656    procedure Update; override;
    5757    procedure SetVisible(const AValue: Boolean); override;
    58     procedure ChangeVisible(Control: TWinControl; Visible: Boolean);
     58    procedure ChangeVisible(Control: TWinControl; Visible: Boolean); override;
    5959    property DockDirection: TCDDirection read FDockDirection
    6060      write FDockDirection;
     
    9393
    9494procedure TCDManagerRegionsItem.Paint(Sender: TObject);
    95 var
    96   I: Integer;
    97   R: TRect;
    9895begin
    9996  inherited Paint(Sender);
  • Docking/CoolDocking/Managers/UCDManagerTabs.pas

    r430 r437  
    88  Classes, Controls, ExtCtrls, ComCtrls, SysUtils, Dialogs, Contnrs,
    99  Menus, Forms, UCDCommon, UCDManager, UCDConjoinForm,
    10   LCLType, LMessages, Graphics;
     10  LCLType, Graphics;
    1111
    1212type
     
    3535    procedure TabControlMouseUp(Sender: TObject; Button: TMouseButton;
    3636      Shift: TShiftState; X, Y: Integer);
     37    procedure PageControlContextPopup(Sender: TObject; MousePos: TPoint;
     38      var Handled: Boolean);
     39    function FindTabSheet(TabSheet: TTabSheet): TCDManagerTabsItem;
     40  protected
     41    function GetHeaderPos: THeaderPos; override;
     42    function FindControlInPanels(Control: TControl): TCDManagerItem; override;
    3743    procedure InsertControlPanel(AControl: TControl; InsertAt: TAlign;
    3844      DropCtl: TControl); override;
    39     function FindControlInPanels(Control: TControl): TCDManagerItem; override;
    40     function GetHeaderPos: THeaderPos; override;
    41     function FindTabSheet(TabSheet: TTabSheet): TCDManagerTabsItem;
    42     procedure PageControlContextPopup(Sender: TObject; MousePos: TPoint;
    43       var Handled: Boolean);
     45    procedure InsertControlNoUpdate(Control: TControl; InsertAt: TAlign); virtual;
     46    procedure TabControlChange(Sender: TObject); virtual;
    4447  public
    4548    MouseDownSkip: Boolean;
     
    4952    procedure Update; override;
    5053    procedure SetHeaderPos(const AValue: THeaderPos); override;
    51     procedure InsertControlNoUpdate(Control: TControl; InsertAt: TAlign); virtual;
    5254    procedure RemoveControl(Control: TControl); override;
    5355    constructor Create(ADockSite: TWinControl); override;
    5456    destructor Destroy; override;
    55     procedure TabControlChange(Sender: TObject); virtual;
    5657    procedure PaintSite(DC: HDC); override;
    5758    procedure Switch(Index: Integer); override;
     
    8485  Temp: TControl;
    8586  Temp2: TControl;
     87  PI: Integer;
    8688begin
    8789  DebugLog('TCDManagerTabsItem.VisibleChange');
     
    9294      //TCDManagerTabsItem(DockItems[DockItems.IndexOf(
    9395      //  FindControlInPanels(TControl(Sender)))]).HideType := dhtPermanent;
    94     end else Update;
     96    end else begin
     97      TabSheet.TabVisible := False;
     98
     99      // Workaround for not showing current tab agter other tab is hidden
     100      PI := PageControl.PageIndex;
     101      PageControl.PageIndex := -1;
     102      PageControl.PageIndex := PI;
     103
     104      Update;
     105    end;
    95106  end;
    96107
     
    379390  LastIndex: Integer;
    380391begin
    381   LastIndex := PageControl.TabIndex;
     392  LastIndex := PageControl.PageIndex;
    382393  if FUpdateCount = 0 then begin
    383394  DebugLog('TCDManagerTabs.Update');
     
    426437    if PageControl.PageIndex = I then begin
    427438      TCDManager(Control.DockManager).DockSiteVisible := True;
    428       if not Control.Visible then Control.Show;
     439      if not Control.Visible then
     440        Control.Show;
    429441      //PageControl.TabIndex := I;
    430442    end else begin
     
    437449    //TCDClientPanel(FDockPanels[I]).DockPanelPaint(Self);
    438450  end;
    439   end;
    440   inherited;
    441   //ShowMessage(IntToStr(PageControl.TabIndex));
    442   PageControl.TabIndex := LastIndex;
     451  //PageControl.TabIndex := LastIndex;
     452  //if PageControl.PageIndex = PI then
     453  //  PageControl.PageIndex := -1; // Workaround for bug in LCL TPageControl.TabVisible not updating PageIndex properly
     454  end;
     455  inherited;
    443456end;
    444457
  • Docking/CoolDocking/Managers/UCDManagerTabsPopup.pas

    r335 r437  
    5656    SplitterMousePos: TPoint;
    5757    procedure PageControlResize(Sender: TObject);
    58     procedure InsertControlNoUpdate(Control: TControl; InsertAt: TAlign); override;
    5958    procedure SplitterMouseDown(Sender: TObject; Button: TMouseButton;
    6059      Shift: TShiftState; X, Y: Integer);
     
    6463      Shift: TShiftState; X, Y: Integer);
    6564    procedure UpdatePopupFormBounds;
     65    procedure PopupFormMouseLeave(Sender: TObject);
     66  protected
    6667    procedure TabControlChange(Sender: TObject); override;
    67     procedure PopupFormMouseLeave(Sender: TObject);
     68    procedure InsertControlNoUpdate(Control: TControl; InsertAt: TAlign); override;
    6869  public
    6970    AutoHideEnabled: Boolean;
     
    8485
    8586uses
    86   UCDClient, UCDManagerRegions;
     87  UCDManagerRegions;
    8788
    8889{ TCDManagerTabsPopupItem }
Note: See TracChangeset for help on using the changeset viewer.