Garry's Mod Wiki

Revision Difference

ContentSidebar#552226

<panel> <parent>DPanel</parent> <description> 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 <page>ContentSidebar:EnableModify</page> has been called ContentSidebar.Toolbox will return a <page>ContentSidebarToolbox</page> <internal></internal> </description> <overrides> <page>PANEL:Init</page> </overrides> </panel> <example> <description>How to create a </description> <description>How to create a <page>ContentSidebar</page>.</description> <code> 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 </code> </example>