Display DVScrollbar even with no item in DScrollPanel ?

Hi everyone,

I wonder if it’s possible to display the DVScrollbar in a DScrollPanel even with no items in the scrollPanel ?

Thanks in advance !

PS : What a wonderfull forum, helped me a lot !

self.VBar:SetEnabled(true)
Instead of making a new thread for every problem you have with derma check on the gmod github first. Chances are you’ll find what you’re looking for.

-SNIP-

Tested it, didn’t work. :confused: I don’t see the scrollbar if my items are smaller than DScrollPanel

Here is my code


function PANEL:Init()
  self:Dock( FILL )

  self.VBar:SetWide(16)
  sBarSize = self.VBar:GetWide()

  self.VBar.Paint = function( pnl, w, h )
    draw.RoundedBox( 0, 0, 0, w, h, Color( 0, 0, 0, 100 ) )
  end

  self.VBar.btnUp.Paint = function( pnl, w, h )
    draw.RoundedBox( 0, 0, 0, w, h, Color( 64, 58, 48 ) )
  end

  self.VBar.btnDown.Paint = function( pnl, w, h )
    draw.RoundedBox( 0, 0, 0, w, h, Color( 64, 58, 48 ) )
  end

  self.VBar.btnGrip.Paint = function( pnl, w, h )
    draw.RoundedBox( 0, 0, 0, w, h, Color( 127, 116, 96 ) )
  end

  self.VBar:SetEnabled(true)

end

It can be showed because size is 0.
DScrollPanel set size by itself.
You can try to set size manually. Is it resets, insert in EveryFrame function (PANEL:Paint,PANEL:Think, etc.)

I found a dirty fix in the “TheCodingBeast” F4Menu, no way to have it displayed without having to add an invisible panel with container size + 1 ? :confused:


function PANEL:ScrollFix()
  local ScrollFix = vgui.Create( "DPanel", self )
  ScrollFix:SetSize( 0, MenuContainer:GetTall() + 1)
  ScrollFix:SetPos( 0, 0 )
  ScrollFix.Paint = function() end
end

Here is the CodingBest dirty fix, that’s the only way i found …

If anyone has a clean fix it would be wonderfull !

http://forum.facepunch.com/showthread.php?t=1500683