• Overwritting DVScrollBar paint hooks?
    2 replies, posted
[CODE]local p = vgui.Create( "DPanelList", frame ) p:SetPos( 5, 80 ) p:SetSize( w-10, h-86 ) p:SetSpacing( 5 ) p:EnableHorizontal( false ) p:EnableVerticalScrollbar( false ) local VBar = vgui.Create( "DVScrollBar", p ) VBar.Paint = function() end VBar.btnGrip.Paint = function(VBar,w,h) draw.RoundedBox( 1, 0, 0, w, h, Color(52,73,94,255) ) end VBar.btnUp.Paint = function(VBar,w,h) draw.RoundedBox( 1, 0, 0, w, h, Color(52,73,94,255) ) end VBar.btnDown.Paint = function(VBar,w,h) draw.RoundedBox( 1, 0, 0, w, h, Color(52,73,94,255) ) end [/CODE] The bar is being drawn, but it is using default derma skin, and the functions aren't called. How would I go about overwritting the scrollbar paint hooks?
Please observe: [url]http://wiki.garrysmod.com/page/DScrollPanel/GetVBar[/url]
[QUOTE=Robotboy655;47326654]Please observe: [url]http://wiki.garrysmod.com/page/DScrollPanel/GetVBar[/url][/QUOTE] Well that's for dscrollpanel, solution was to do this instead of my original code, I wasn't retrieving the right VBar [CODE]local ps = vgui.Create( "DPanelList", curs ) ps:SetPos( 5, 80 ) ps:SetSize( w-10, h-86 ) ps:SetSpacing( 7 ) ps:EnableHorizontal( false ) ps:EnableVerticalScrollbar( true ) local sbar = ps.VBar function sbar:Paint(w, h) if self.Depressed or bu.m_bSelected then draw.RoundedBox( 1, 0, 0, w, 25, Color(72,98,116,255) ) elseif self.Hovered then draw.RoundedBox( 1, 0, 0, w, 25, Color(62,86,104,255) ) else draw.RoundedBox( 1, 0, 0, w, 25, Color(52,73,94,255) ) end end[/CODE] Solved now none the less
Sorry, you need to Log In to post a reply to this thread.