Skip to content

Instantly share code, notes, and snippets.

@EntranceJew
Created August 4, 2023 08:29
Show Gist options
  • Save EntranceJew/1d7e9050cd18155aa5bfa5d7285c719b to your computer and use it in GitHub Desktop.
Save EntranceJew/1d7e9050cd18155aa5bfa5d7285c719b to your computer and use it in GitHub Desktop.
show a tool menu via path-string
include("sandbox/gamemode/spawnmenu/controlpanel.lua")
local function ShowToolMenu( name )
local frame = vgui.Create( "DFrame" )
frame:SetTitle( name )
frame:SetSize( ScrW() * 0.75, ScrH() * 0.75 )
frame:Center()
frame:SetDraggable( true )
frame:ShowCloseButton( true )
frame:SetSizable( true )
frame:MakePopup()
local dsp = vgui.Create("DScrollPanel", frame)
dsp:Dock( FILL )
local controlPanel = vgui.Create( "ControlPanel", dsp )
controlPanel:SetExpanded( true )
controlPanel:Dock( FILL )
controlPanel.Header:SetSize( 0, 0 )
frame.btnClose:MoveToFront()
frame.btnMaxim:MoveToFront()
frame.btnMinim:MoveToFront()
local atmo = spawnmenu.AddToolMenuOption
local dex = {}
spawnmenu.AddToolMenuOption = function(tab, category, class, name, cmd, config, cpanel, tbl)
dex[ tab .. "/" .. category .. "/" .. class ] = cpanel
end
hook.Run( "PopulateToolMenu" )
spawnmenu.AddToolMenuOption = atmo
local target = dex[ name ]
target( controlPanel )
end
ShowToolMenu( "Utilities/User/SandboxClientSettings" )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment