DMenu

From GMod Wiki

Jump to: navigation, search
Derma Control: DMenu
Parent Class:DPanel
Subclasses:
Description:
A Menu

Examples

DescriptionCreates a menu with some options.
Used onNewerClient.png
Code
 
local DermaPanel = vgui.Create( "DFrame" )
DermaPanel:SetPos( 50,50 )
DermaPanel:SetSize( 200, 250 )
DermaPanel:SetTitle( "Testing Derma Stuff" )
DermaPanel:SetVisible( true )
DermaPanel:SetDraggable( true )
DermaPanel:ShowCloseButton( true )
DermaPanel:MakePopup()
 
local MenuButton = vgui.Create("DButton")
MenuButton:SetParent( DermaPanel )
MenuButton:SetText( "Menu >" )
MenuButton:SetPos(25, 50)
MenuButton:SetSize( 150, 175 )
MenuButton.DoClick = function ( btn )
    local MenuButtonOptions = DermaMenu() -- Creates the menu
    MenuButtonOptions:AddOption("hello", function() Msg("Hello") end ) -- Add options to the menu
    MenuButtonOptions:AddOption("how", function() Msg("How") end )
    MenuButtonOptions:AddOption("are", function() Msg("Are") end )
    MenuButtonOptions:AddOption("you", function() Msg("You") end )
    MenuButtonOptions:AddOption("?", function() Msg("?") end )
    MenuButtonOptions:Open() -- Open the menu AFTER adding your options
end
 
Outputmenuan7.png


Methods

NewerClient.png DMenu.AddOption
NewerClient.png DMenu.AddPanel
NewerClient.png DMenu.AddSpacer
NewerClient.png DMenu.AddSubMenu
NewerClient.png DMenu.CloseSubMenu
NewerClient.png DMenu.GenerateExample
NewerClient.png DMenu.GetDeleteSelf
NewerClient.png DMenu.GetDrawBackground
NewerClient.png DMenu.GetDrawBorder
NewerClient.png DMenu.GetMaxHeight
NewerClient.png DMenu.GetMinimumWidth
NewerClient.png DMenu.GetOpenSubMenu
NewerClient.png DMenu.Hide
NewerClient.png DMenu.Init
NewerClient.png DMenu.Open
NewerClient.png DMenu.OpenAnim
NewerClient.png DMenu.OpenSubMenu
NewerClient.png DMenu.Paint
NewerClient.png DMenu.PaintOver
NewerClient.png DMenu.PerformLayout
NewerClient.png DMenu.SetDeleteSelf
NewerClient.png DMenu.SetDrawBackground
NewerClient.png DMenu.SetDrawBorder
NewerClient.png DMenu.SetMaxHeight
NewerClient.png DMenu.SetMinimumWidth
NewerClient.png DMenu.SetOpenSubMenu
NewerClient.png DMenu.Think

Inherited from DPanel

NewerClient.png DPanel.SetDisabled
NewerClient.png DPanel.GetPaintBackground
NewerClient.png DPanel.GetDisabled
NewerClient.png DPanel.SetPaintBackground
NewerClient.png DPanel.ApplySchemeSettings

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox