Hello, so i've seen a post about this but the solution they asked for is how to remove the bar entirely which is something i'd prefer not to do. The issue is that I have a DScrollPanel with a painted scroll bar, and within the panel is other smaller panels which without the bar there, fit across perfectly. But when the bar is there, it cuts them off just before the scrollbar. Here's what I mean...
https://files.facepunch.com/forum/upload/268512/48d3fdde-a32b-454f-8df9-5fd7acff3079/image.png
It's hard to see, but you'll notice the gap inbetween the lighter blocks and the scroll bar. I'm just hoping that there's a way I can prevent this? I'd like the lighter bits to go all the way.
Try painting the layers above the DScrollBar with Panel/SetZPos
Sadly, that didn't work
So, I still haven't found a solution for this. I'm honestly lost ha.
garrysmod/dscrollpanel.lua at 784cd57576d85712fa13a7cea3a9523b4d..
Are you setting the actual width of the scrollbar are you just drawing it narrower?
Just painting it at the moment, I couldn't find a way to actually resize it.
local sbarfact = primarywep:GetVBar()
function sbarfact:Paint( w, h )
draw.RoundedBox( 0, 8, 0, w / 2, h, Color( 56,56,56,255 ) )
end
function sbarfact.btnUp:Paint( w, h )
draw.RoundedBox( 0, 8, 0, 0, 0, Color( 200, 100, 0 ) )
end
function sbarfact.btnDown:Paint( w, h )
draw.RoundedBox( 0, 8, 0, 0, 0, Color( 200, 100, 0 ) )
end
function sbarfact.btnGrip:Paint( w, h )
draw.RoundedBox( 0, 8, 0, w / 2, h, Color( 60,152,137,255 ) )
end
You should do DScrollPanel.VBar:SetWidth(width) instead of just drawing it narrower.
Apparently, that doesn't work either. Still has the gap I removed the draw thing too, and it still didn't work
Show me all of your current code for the DScrollPanel.
Try this:
DScrollPanel:GetVBar():SetSize(0, 0)
local primarywep = vgui.Create( "DScrollPanel", wepframe )
primarywep:SetSize( 500, 675 );
primarywep.VBar:SetWidth(15)
primarywep:SetPos( 20, 110 )
primarywep.Paint = function( self, w, h )
draw.RoundedBox( 0, 0, 0, w, h, Color(40,40,40,127.5) );
end
local sbarfact = primarywep:GetVBar()
function sbarfact:Paint( w, h )
draw.RoundedBox( 0, 0, 0, 0, h, Color( 56,56,56,255 ) )
end
function sbarfact.btnUp:Paint( w, h )
draw.RoundedBox( 0, 0, 0, 0, 0, Color( 200, 100, 0 ) )
end
function sbarfact.btnDown:Paint( w, h )
draw.RoundedBox( 0, 0, 0, 0, 0, Color( 200, 100, 0 ) )
end
function sbarfact.btnGrip:Paint( w, h )
draw.RoundedBox( 0, 0, 0, 0, h, Color( 60,152,137,255 ) )
end
Try this:
local primarywep = vgui.Create( "DScrollPanel", wepframe )
primarywep:SetSize( 500, 675 );
primarywep:GetVBar():SetWidth(15) -- Set width here
primarywep:SetPos( 20, 110 )
primarywep.Paint = function( self, w, h )
draw.RoundedBox( 0, 0, 0, w, h, Color(40,40,40,127.5) );
end
Still doesn't want to work... I'm clueless
Does setting the width of the scrollbar invalidate the layout? If it doesn't you might want to do it manually so perform layout is called again.
You're drawing sbarfact and sbarfact.btnGrip with 0 width and drawing the buttons with no size at all. If you want to remove the buttons you should do sbarfact:SetHideButtons(true) on sbarfact and you should be drawing the width with the variables passed to the Paint function.
Sorry, you need to Log In to post a reply to this thread.