Search code examples
c++builderdockingjvcl

How to set size of inactive (hidden) dock clients' tabs in JVCL Docking component?


The only dock style in JVCL that I know that has the auto hide function (to pin the dock clients) is JvDockVSNetStyle. I'm using it but I can't set the size of the inactive pinned panes' tabs. When hidden, the tabs don't show the title of the pane, only the name of the active pane is shown. Sorry, I can't post an example image because that's my first question.

In the object inpector there is an option called ChannelOption with the ActivePaneSize property. Is there a way to set the inactive pane size so it can show its name? Or maybe there is another dock style that I'm missing that has the same functions?

I'm using C++Builder and JVCL 3.45.


Solution

  • i did it by commenting out these code parts:

    procedure TJvDockVSChannel.GetBlockRect(Block: TJvDockVSBlock; Index: Integer;
      var ARect: TRect);
    var
      BlockWidth: Integer;
    begin
    // HERE 
    
    //  if Block.VSPane[Index] <> Block.ActivePane then
    //    BlockWidth := Block.InactiveBlockWidth
    //  else
        BlockWidth := Block.ActiveBlockWidth;
    
    <snip>
    
    
    
    procedure TJvDockVSChannel.Paint;
    var
      I: Integer;
    
    <snip>
    
      begin
        VisiblePaneCount := 0;
        for I := 0 to Block.VSPaneCount - 1 do
        begin
          if not Block.VSPane[I].FVisible then
            Continue;
    
          GetBlockRect(Block, I, DrawRect);
          Canvas.Brush.Color := TabColor;
          Canvas.FillRect(DrawRect);
          Canvas.Brush.Color := clGray;
          Canvas.FrameRect(DrawRect);
    
          AdjustImagePos;
          Block.FImageList.Draw(Canvas, DrawRect.Left, DrawRect.Top, I, dsTransparent, itImage);
    
    // HERE 
    //      if Block.ActivePane = Block.VSPane[I] then
          begin
            if Align in [alTop, alBottom] then
              Inc(DrawRect.Left, Block.InactiveBlockWidth)
            else
            if Align in [alLeft, alRight] then
            begin
              Inc(DrawRect.Top, Block.InactiveBlockWidth);
              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;
    // HERE (changed options)
            DrawText(Canvas.Handle, PChar(Block.VSPane[I].FDockForm.Caption), -1, DrawRect, {DT_END_ELLIPSIS or} DT_NOCLIP);