Revision Difference
GM:PopulateMenuBar#511224
<function name="PopulateMenuBar" parent="GM" type="hook">⤶
<ishook>yes</ishook>⤶
<description>Called when it's time to populate the context menu menu bar at the top.</description>⤶
<realm>Client</realm>⤶
<predicted>No</predicted>⤶
<args>⤶
<arg name="menubar" type="Panel">The <page>DMenuBar</page> itself.</arg>⤶
</args>⤶
</function>⤶
⤶
<example>⤶
<description>Example usage of the hook</description>⤶
<code>⤶
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 )⤶
</code>⤶
⤶
</example>