GM:PopulateMenuBar

From Garry's Mod
Jump to: navigation, search
 GM:PopulateMenuBar( )

Contents

Description

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

Arguments

Panel menubar

The DMenuBar itself.

Examples

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 )


Personal tools
Navigation