How do I modify a DCategoryList Header and Lines?

I was looking around in the sources of the elements and couldn’t find really anything that has helped me. I am trying to use a DCategoryList but I want to change the line coloring and headers. Right now they are that light blue headers with white/light grey lines. It doesn’t look like DCategoryList has a table of elements and when I print it I just


Panel: [name:Panel][class:Panel][0,0,130,24]

After seeing the printed element, I thought that maybe that the [0,0,130,24] might be the color element but I could not figure out how to change it.

Btw, My code -
[lua]self.List = vgui.Create(“DCategoryList”, self)
self.List:Dock( LEFT )
print(self.List)
self.List.Paint = function(self, w, h)
draw.RoundedBox(0, 0, 0, w, h, Color(0, 0, 0, 255)) – This changed the background of the list
end[/lua]

Any help in figuring this out would be much appreciated

Those numbers correspond to the start x-y and end x-y coordinates of the panel. I think the internals of VGUI elements are considered userdata (from a Valve C++ library?) and are not native to Lua, hence why you can’t do something like PrintTable( catList ) to see all of its functions.

If you’re wanting to know how a certain vgui element works, you can navigate to garrysmod/lua/vgui/ and find it there or search through GitHub: https://github.com/garrynewman/garrysmod/blob/master/garrysmod/lua/vgui/dcategorylist.lua



-- inside DCategoryList.lua

--[[---------------------------------------------------------
Name: Add
-----------------------------------------------------------]]
function PANEL:Add( name )

     local Category = vgui.Create( "DCollapsibleCategory", self )
    Category:SetLabel( name )
    Category:SetList( self )

    self:AddItem( Category )

    return Category    

end

Calling DCategoryList:Add( str ) will return the DCollapsibleCategory that was created. So when you add a new category, just do something like


local cat = catList:Add( "NewCategory" )

and now you can edit the Paint function of the DCollapsibleCategory that was internally created. The code for the DCollapsibleCategory is here: https://github.com/garrynewman/garrysmod/blob/master/garrysmod/lua/vgui/dcategorycollapse.lua

I don’t know why I didn’t think about that sooner… Thanks lol.