You have not missed anything. This is how the default dock manager implementation works. He just wants to have a grabber with a close button available on the dock that uses it. What you can do is implement your own dock manager and redefine its AdjustDockRect method, which controls the size of the docking area and where the default implementation is dock manager made the capture space with the button closed. If you don’t want this grabber, just save the size of the rectangle of the dock area as it was passed to the method, the size of the entire dock site. In other words, do nothing in this method.
This is for the functional part of the grabber, but with the exception that you need to intercept its hard-coded pattern. To do this, you need to override the PaintDockFrame event PaintDockFrame and, as before, do nothing.
Here is a sample code:
type TNoGrabDockManager = class(TDockTree) protected procedure AdjustDockRect(Control: TControl; var ARect: TRect); override; procedure PaintDockFrame(Canvas: TCanvas; Control: TControl; const ARect: TRect); override; end; implementation { TNoGrabDockManager } procedure TNoGrabDockManager.AdjustDockRect(Control: TControl; var ARect: TRect); begin
Here's how to use such a custom dock manager (see below for a note on the UseDockManager property:
procedure TForm1.FormCreate(Sender: TObject); begin Panel1.DockManager := TNoGrabDockManager.Create(Panel1); Panel1.UseDockManager := True; end;
Attention!
As you can see from several sources, you should set the UseDockManager property of your False dock panel at design time. I don’t know why, but from the quick tests I did, some of the dock manager’s custom event methods weren’t running when I didn’t set this property at design time ( AdjustDockRect event handler worked fine without even doing it, but I I personally would not rely on him).
TLama source share