Garry's Mod Wiki

GM:PopulateMenuBar

GM:PopulateMenuBar

  GM:PopulateMenuBar( Panel menubar )

Description

Called when it's time to populate the context menu menu bar at the top.

Arguments

1 Panel menubar
The DMenuBar itself.

Example

Example usage of the hook

hook.Add( "PopulateMenuBar", "My_MenuBar", function( menubar ) local m = menubar:AddOrGetMenu( "Test" ) m:AddCVar( "Item 1", "console_var1", "1", "0" ) m:AddSpacer() m:AddCVar( "Item 2", "console_var2", "0", "100" ) m:AddCVar( "Check console", "console_var3", "1", "0", function() print("I was clicked!") end ) local submenu = m:AddSubMenu( "Submenu" ) submenu:SetDeleteSelf( false ) submenu:AddCVar( "No password", "password", "" ) submenu:AddSpacer() submenu:AddCVar( "Password: test1", "password", "test1" ) submenu:AddCVar( "Password: lolno", "password", "lolno" ) end )

Special Pages


Wikis

?

Render Time: 58ms

DB GetPage 39
Generate Html 4
SaveChanges (1) 6
Render Body 0
Render Sidebar 7