Garry's Mod Wiki



This is used internally - although you're able to use it you probably shouldn't.

The ContentSidebar is internally used by the spawnmenu and manages things like the Spawnmenu Toolbar. It internally uses a DTree which is accessible with ContentSidebar .Tree. When ContentSidebar:EnableModify has been called ContentSidebar.Toolbox will return a ContentSidebarToolbox

View source


Derives methods, etc not listed on this page from DPanel.


Implements or overrides the following hooks/methods. If you want to override these, you probably want to call the original function too.


ContentSidebar:CreateSaveNotification( string style, string hookname = "PopulateContent" )
Creates a Save Notification which will be shown when SANDBOX:SpawnlistContentChanged has been called.
Internally calls ContentSidebar:EnableSearch, ContentSidebar:CreateSaveNotification and creates a ContentSidebarToolbox which is accessible under ContentSidebar. Toolbox. Call the Hook SANDBOX:OpenToolbox to open the created Toolbox
ContentSidebar:EnableSearch( string style, string hookname = "PopulateContent" )
Creates a search bar which will be displayed over the Nodes.


How to create a ContentSidebar.

Frame = vgui.Create("DFrame") Frame:SetSize(ScrW() / 2, ScrH() / 2) Frame:Center() Frame:MakePopup() ContentSidebar = vgui.Create( "ContentSidebar", Frame) ContentSidebar:Dock(FILL) ContentSidebar:CreateSaveNotification() for k=1, 6 do local Node = ContentSidebar.Tree:AddNode("Example", "icon16/user.png") Node:SetHideExpander(true) Node:SetExpanded(true) Node.DoClick = function(self) hook.Call("SpawnlistContentChanged", GAMEMODE or GM) end for v=1, math.random(1, 5) do Node:AddNode("Example", "icon16/star.png") end end