Garry's Mod Wiki


  DMenu:AddPanel( Panel pnl )


Adds a panel to the DMenu as if it were an option.

This invokes DScrollPanel:AddItem and will not create a new panel if a class name is passed, unlike Panel:Add.


1 Panel pnl
The panel that you want to add.


Creates a DMenu with some options and places a red DPanel between them.

local m = DermaMenu() m:AddOption( "Kill yourself", function() RunConsoleCommand( "kill" ) end ) -- Add first option m:AddSpacer() -- Create a red DPanel local panel = vgui.Create( "DPanel", m ) panel:SetSize( 50, 100 ) panel:SetBackgroundColor( Color( 255, 0, 0 ) ) m:AddPanel( panel ) -- Add the panel m:AddSpacer() m:AddOption( "Say hi", function() RunConsoleCommand( "say", "Hi!" ) end ) -- Add second option m:Open() -- Show our menu