Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>As ain commented, I also think it is a bug. More precisely a bug in TJvDockVSChannel.Paint which draws the tabs (internally the tabs are called <em>blocks</em>). Such a block has a protected property <em>InactiveBlockWidth</em> whose name suggest controlling its width. The property works fine for the tab itself, but the caption is shifted by that same amount again in TJvDockVSChannel.Paint, which seems to me to be the problem.</p> <p>You can experiment as follows, by assigning the OnFinishSetDockPanelSize event of the DockServer:</p> <pre><code>type TJvDockVSBlockAccess = class(TJvDockVSBlock); procedure TMainForm.lbDockServer1FinishSetDockPanelSize( DockPanel: TJvDockPanel); var Channel: TJvDockVSChannel; Block: TJvDockVSBlockAccess; i: Integer; begin if DockPanel is TJvDockVSNETPanel then begin Channel := TJvDockVSNETPanel(DockPanel).VSChannel; for i := 0 to Channel.BlockCount - 1 do begin Block := TJvDockVSBlockAccess(Channel.Block[i]); Block.InactiveBlockWidth := 100; end; end; end; </code></pre> <p>Since this is a protected property for now, it might indicate its functionality being <em>under construction</em>. I suppose Jedi's dev team have decided for now to draw only the glyph of each inactive tab, because there lacks a full implementation for dynamic handling of the tab widths. E.g. you should be able to set a minimum width of each tab, and when the bar (i.e. the container in which it resides) changes height, all tabs should widen or narrow accordingly.</p> <p><strong>Edit:</strong></p> <p>Thanks to the flexible design, you can work around the bug by setting the DockPanelClass property of the DockServer. I suppose that property has to be set befóre setting the Style property. It involves rewriting the whole Paint routine, because InactiveBlockWidth is also used in GetBlockRect, which in turn is not virtual:</p> <pre><code>type TJvDockVSBlockAccess = class(TJvDockVSBlock); THackJvDockVSNETPanel = class(TJvDockVSNETPanel) public constructor Create(AOwner: TComponent); override; end; THackJvDockVSChannel = class(TJvDockVSChannel) protected procedure Paint; override; procedure ResetBlock; override; procedure Resize; override; end; const InactiveTabWidth = 100; { TMainForm } procedure TMainForm.FormCreate(Sender: TObject); begin ... JvDockVSNetStyle1.DockPanelClass := THackJvDockVSNETPanel; end; { THackJvDockVSNETPanel } constructor THackJvDockVSNETPanel.Create(AOwner: TComponent); begin inherited Create(AOwner); VSChannelClass := THackJvDockVSChannel; end; { THackJvDockVSChannel } procedure THackJvDockVSChannel.Paint; var I: Integer; procedure DrawSingleBlock(Block: TJvDockVSBlockAccess); var DrawRect: TRect; I: Integer; OldGraphicsMode: Integer; VisiblePaneCount: Integer; procedure AdjustImagePos; begin if Align = alLeft then begin Inc(DrawRect.Left, 3); Inc(DrawRect.Top, 4); end else if Align = alTop then begin Inc(DrawRect.Left, 4); Inc(DrawRect.Top, 2); end else if Align = alRight then begin Inc(DrawRect.Left, 4); Inc(DrawRect.Top, 4); end else if Align = alBottom then begin Inc(DrawRect.Left, 4); Inc(DrawRect.Top, 3); end; end; begin VisiblePaneCount := 0; for I := 0 to Block.VSPaneCount - 1 do begin if not Block.VSPane[I].Visible then Continue; GetBlockRect(Block, I, DrawRect); Canvas.Brush.Color := TabColor; Canvas.FillRect(DrawRect); Canvas.Brush.Color := clGray; Canvas.FrameRect(DrawRect); AdjustImagePos; Block.ImageList.Draw(Canvas, DrawRect.Left, DrawRect.Top, I); if Align in [alTop, alBottom] then Inc(DrawRect.Left, 24) else if Align in [alLeft, alRight] then begin Inc(DrawRect.Top, 24); if Align = alLeft then DrawRect.Left := 15 else DrawRect.Left := 20; DrawRect.Right := DrawRect.Left + (DrawRect.Bottom - DrawRect.Top); end; Canvas.Brush.Color := TabColor; Canvas.Pen.Color := clBlack; Dec(DrawRect.Right, 3); OldGraphicsMode := SetGraphicsMode(Canvas.Handle, GM_ADVANCED); Canvas.Brush.Style := bsClear; DrawText(Canvas.Handle, PChar(Block.VSPane[I].DockForm.Caption), -1, DrawRect, DT_END_ELLIPSIS or DT_NOCLIP); SetGraphicsMode(Canvas.Handle, OldGraphicsMode); Inc(VisiblePaneCount); end; if VisiblePaneCount &gt; 0 then CurrentPos := CurrentPos + BlockInterval; end; begin ResetBlock; CurrentPos := BlockStartOffset; for I := 0 to BlockCount - 1 do DrawSingleBlock(TJvDockVSBlockAccess(Block[I])); end; procedure THackJvDockVSChannel.ResetBlock; var I: Integer; begin inherited ResetBlock; for I := 0 to BlockCount - 1 do TJvDockVSBlockAccess(Block[I]).InactiveBlockWidth := InactiveTabWidth; end; procedure THackJvDockVSChannel.Resize; begin { Here you could widen or narrow the tabs according the total space and depending on the number of tabs } inherited Resize; end; </code></pre> <p><img src="https://i.stack.imgur.com/tK7X1.png" alt="Sample of widened tabs"></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload