Changeset 215 for Docking/CoolDocking/Managers/UCDManagerTabs.pas
- Timestamp:
- Mar 22, 2011, 8:20:18 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Docking/CoolDocking/Managers/UCDManagerTabs.pas
r213 r215 18 18 constructor Create; override; 19 19 destructor Destroy; override; 20 procedure VisibleChange(Sender: TObject); override; 20 21 end; 21 22 … … 73 74 end; 74 75 76 procedure TCDManagerTabsItem.VisibleChange(Sender: TObject); 77 var 78 ControlVisible: Boolean; 79 Temp: TControl; 80 Temp2: TControl; 81 begin 82 with TCDManagerTabs(Manager) do begin 83 if TControl(Sender).Visible then begin 84 Switch(DockItems.IndexOf(FindControlInPanels(TControl(Sender)))); 85 TCDManagerTabsItem(DockItems[DockItems.IndexOf(FindControlInPanels(TControl(Sender)))]).HideType := dhtPermanent; 86 end; 87 UpdateClientSize; 88 end; 89 90 // Show current dock clients in parent dock sites 91 if TControl(Sender).Visible then 92 TControl(Sender).HostDockSite.Visible := True; 93 94 {Temp := TControl(Sender); 95 if Assigned(Control) then 96 begin 97 ControlVisible := TControl(Sender).Visible; 98 (*if Assigned(ClientAreaPanel) then 99 ClientAreaPanel.Visible := ControlVisible; 100 if Assigned(Splitter) then 101 Splitter.Visible := ControlVisible; 102 *) 103 // if Assigned(TCDManager(OwnerDockManager).DockStyleHandler) then 104 if Assigned(Manager) then 105 with TCDManagerTabs(Manager) do 106 begin 107 //UpdateClientSize; 108 if ControlVisible then 109 Switch(FDockItems.IndexOf(FindControlInPanels(TControl(Sender)))); 110 if not (Control is TWinControl) then raise Exception.Create('Not TWinControl'); 111 if not Assigned(Control) then raise Exception.Create('Control not assigned'); 112 ChangeVisible(TWinControl(Control), ControlVisible); 113 // Show parent control 114 Temp := TControl(Sender).HostDockSite; 115 116 if ControlVisible then 117 TControl(Sender).HostDockSite.Visible := ControlVisible; 118 end; 119 if csDestroying in Control.ComponentState then Control := nil; 120 end; 121 } 122 end; 123 75 124 { TCDManagerTabs } 76 125 … … 104 153 105 154 procedure TCDManagerTabs.TabControlChange(Sender: TObject); 106 var 107 I: Integer; 108 begin 109 //UpdateClientSize; 110 { // Hide all clients 111 for I := 0 to DockItems.Count - 1 do 112 if TCDManagerItem(DockItems[I]).Control.Visible 113 //and (PageControl.TabIndex <> I) 114 then 115 begin 116 TCDManagerItem(DockItems[I]).Control.Tag := Integer(dhtTemporal); 117 TCDManagerItem(DockItems[I]).Control.Hide; 118 //TCDClientPanel(DockItems[I]).ClientAreaPanel.Hide; 119 //TCDClientPanel(DockItems[I]).ClientAreaPanel.Parent := PageControl.Pages[I]; 120 //TCDClientPanel(DockPanels[I]).ClientAreaPanel.Parent := DockSite; 121 TCDManagerItem(DockItems[I]).Control.Align := alClient; 122 //TCDClientPanel(DockPanels[I]).Control.Parent := 123 // TCDClientPanel(DockPanels[I]).ClientAreaPanel; 124 //ShowMessage(TCDClientPanel(DockPanels[I]).Control.ClassName); 125 //Application.ProcessMessages; 126 127 // Workaround for "Cannot focus" error 128 TForm(TCDManagerItem(DockItems[I]).Control).ActiveControl := nil; 129 end; 130 131 // Show selected 132 if (PageControl.TabIndex <> -1) and (DockItems.Count > PageControl.TabIndex) 133 // and not TCDClientPanel(DockPanels[PageControl.TabIndex]).Control.Visible 134 then begin 135 with TCDManagerItem(DockItems[PageControl.TabIndex]) do begin 136 Control.Show; 137 (*AutoHide.Enable := True; 138 if AutoHide.Enable then begin 139 //Parent := nil; 140 Visible := True; 141 if AutoHide.ControlVisible then begin 142 AutoHide.Hide; 143 end; 144 AutoHide.Control := Control; 145 AutoHide.Show; 146 end else begin 147 *) 148 //Parent := DockSite; 149 //Show; 150 Visible := True; 151 UpdateClientSize; 152 // end; 153 end; 154 //TCDClientPanel(FDockPanels[TabControl.TabIndex]).Visible := True; 155 end; 156 MouseDownSkip := True; } 155 begin 156 UpdateClientSize; 157 MouseDownSkip := True; 157 158 end; 158 159 … … 208 209 Images := TabImageList; 209 210 end; 210 //TabsPos := hpTop;211 //MoveDuration := 1000; // ms212 211 213 212 //PageControl.Visible := True; … … 342 341 for I := 0 to DockItems.Count - 1 do 343 342 with TCDManagerTabsItem(DockItems[I]) do begin 344 Control.Visible := False;345 Control.Parent := nil;343 //Control.Visible := False; 344 //Control.Parent := nil; 346 345 end; 347 346 348 347 while PageControl.PageList.Count > DockItems.Count do begin 349 //PageControl.Pages[PageControl.PageCount - 1].Parent := nil; 348 TCDManagerTabsItem(DockItems[I]).Control.Parent := nil; 349 PageControl.Pages[PageControl.PageCount - 1].Parent := nil; 350 350 PageControl.Pages[PageControl.PageCount - 1].Free; 351 351 TabImageList.Delete(TabImageList.Count - 1); … … 364 364 Control.Parent := PageControl.Pages[I]; 365 365 Control.Align := alClient; 366 Control.Visible := True; 367 PageControl.Pages[I].TabVisible := Control.Visible; 366 if PageControl.PageIndex = I then begin 367 if (not Control.Visible) and (HideType = dhtTemporal) then 368 Control.Visible := True; 369 end else begin 370 if Control.Visible then begin 371 HideType := dhtTemporal; 372 Control.Visible := False; 373 end; 374 end; 375 PageControl.Pages[I].TabVisible := Control.Visible or (HideType = dhtTemporal); 368 376 //TCDClientPanel(DockPanels[I]).ClientAreaPanel.Width := DockSite.Width; 369 377 //TCDClientPanel(DockPanels[I]).ClientAreaPanel.Height := DockSite.Height - PageControl.Height; … … 409 417 I := DockItems.IndexOf(FindControlInPanels(Control)); 410 418 if Control.Tag = Integer(dhtPermanent) then 411 if I <> -1then419 if (I <> -1) and (I < PageControl.PageCount) then 412 420 // Control.Hide; 413 421 PageControl.Page[I].TabVisible := False;
Note:
See TracChangeset
for help on using the changeset viewer.