Global/DermaMenu

From Garry's Mod
(Difference between revisions)
Jump to: navigation, search
m (Also menu state)
m (Mentioned a possible solution for DMenu not showing)
Line 1: Line 1:
 
{{Func
 
{{Func
 
|Description=Creates a DMenu similar to a contextmenu and closes any current menus
 
|Description=Creates a DMenu similar to a contextmenu and closes any current menus
 +
{{Note|In some events related to the Sandbox context menu, the created menu will not show. If you understand the risks, you can fix this by returning something in your hook.}}
 
|Realm=Client and Menu
 
|Realm=Client and Menu
 
|IsClass=No
 
|IsClass=No
|Name=DermaMenu
 
|Parent=Global
 
 
}}
 
}}
 
{{Arg
 
{{Arg

Revision as of 15:17, 27 January 2018

 DermaMenu( )

Contents

Description

Creates a DMenu similar to a contextmenu and closes any current menus

NOTE

In some events related to the Sandbox context menu, the created menu will not show. If you understand the risks, you can fix this by returning something in your hook.

Arguments

Panel parent

The panel to parent the created menu to.

Returns

Panel

The created DMenu

Examples

Example

Creates a DMenu with buttons to commit suicide or close it.

local menu = DermaMenu() 
menu:AddOption("Die", function() RunConsoleCommand("kill") end)
menu:AddOption("Close", function() print("Close pressed") end) -- The menu will remove itself, we don't have to do anything.
menu:Open()

Output:

DermaMenu.png
Personal tools
Navigation