DPanelList

From GMod Wiki

Jump to: navigation, search
Derma Control: DPanelList
Parent Class:Panel
Subclasses:
Description:
A control for automatically laying out vgui objects in a list.



DPanelList is being deprecated (not removed) in favour of more generalised layout panels being introduced in the new Garry's Mod update. Because it is deprecated, you should try using one of the newer layout panels (such as DLineLayout and DIconLayout) when the new update is out. For more information, visit the post on Garry's Blog.



Examples

DescriptionCreate a panel list and add some items.
Used onNewerClient.png
Code
 
local DermaPanel = vgui.Create( "DFrame" )
DermaPanel:SetPos( 50,50 )
DermaPanel:SetSize( 250, 250 )
DermaPanel:SetTitle( "Testing Derma Stuff" )
DermaPanel:SetVisible( true )
DermaPanel:SetDraggable( true )
DermaPanel:ShowCloseButton( true )
DermaPanel:MakePopup()
 
DermaList = vgui.Create( "DPanelList", DermaPanel )
DermaList:SetPos( 25,25 )
DermaList:SetSize( 200, 200 )
DermaList:SetSpacing( 5 ) -- Spacing between items
DermaList:EnableHorizontal( false ) -- Only vertical items
DermaList:EnableVerticalScrollbar( true ) -- Allow scrollbar if you exceed the Y axis
 
    local CategoryContentOne = vgui.Create( "DCheckBoxLabel" )
    CategoryContentOne:SetText( "God Mode" )
    CategoryContentOne:SetConVar( "sbox_godmode" )
    CategoryContentOne:SetValue( 1 )
    CategoryContentOne:SizeToContents()
DermaList:AddItem( CategoryContentOne ) -- Add the item above
 
    local CategoryContentTwo = vgui.Create( "DCheckBoxLabel" )
    CategoryContentTwo:SetText( "Player Damage" )
    CategoryContentTwo:SetConVar( "sbox_plpldamage" )
    CategoryContentTwo:SetValue( 1 )
    CategoryContentTwo:SizeToContents()
DermaList:AddItem( CategoryContentTwo ) -- Add the item above
 
    local CategoryContentThree = vgui.Create( "DCheckBoxLabel" )
    CategoryContentThree:SetText( "Fall Damage" )
    CategoryContentThree:SetConVar( "mp_falldamage" )
    CategoryContentThree:SetValue( 1 )
    CategoryContentThree:SizeToContents()
DermaList:AddItem( CategoryContentThree ) -- Add the item above
 
    local CategoryContentFour = vgui.Create( "DCheckBoxLabel" )
    CategoryContentFour:SetText( "Noclip" )
    CategoryContentFour:SetConVar( "sbox_noclip" )
    CategoryContentFour:SetValue( 1 )
    CategoryContentFour:SizeToContents()
DermaList:AddItem( CategoryContentFour ) -- Add the item above
 
    local CategoryContentFive = vgui.Create( "DCheckBoxLabel" )
    CategoryContentFive:SetText( "All Talk" )
    CategoryContentFive:SetConVar( "sv_alltalk" )
    CategoryContentFive:SetValue( 1 )
    CategoryContentFive:SizeToContents()
DermaList:AddItem( CategoryContentFive ) -- Add the item above
 
    local CategoryContentSix = vgui.Create( "DNumSlider" )
    CategoryContentSix:SetSize( 150, 50 ) -- Keep the second number at 50
    CategoryContentSix:SetText( "Max Props" )
    CategoryContentSix:SetMin( 0 )
    CategoryContentSix:SetMax( 256 )
    CategoryContentSix:SetDecimals( 0 )
    CategoryContentSix:SetConVar( "sbox_maxprops" )
DermaList:AddItem( CategoryContentSix ) -- Add the item above
 
    local CategoryContentSeven = vgui.Create("DSysButton", DermaPanel)
    CategoryContentSeven:SetType( "close" )
    CategoryContentSeven.DoClick = function()
        RunConsoleCommand("sv_password", "toyboat")
    end
    CategoryContentSeven.DoRightClick = function()
        RunConsoleCommand("sv_password", "**")
    end
DermaList:AddItem( CategoryContentSeven ) -- Add the item above
 
Outputpanellistts8.png


Methods

NewerClient.png DPanelList.AddItem
NewerClient.png DPanelList.Clear
NewerClient.png DPanelList.EnableHorizontal
NewerClient.png DPanelList.EnableVerticalScrollbar
NewerClient.png DPanelList.GetAutoSize
NewerClient.png DPanelList.GetBottomUp
NewerClient.png DPanelList.GetCanvas
NewerClient.png DPanelList.GetDrawBackground
NewerClient.png DPanelList.GetItems
NewerClient.png DPanelList.GetNoSizing
NewerClient.png DPanelList.GetPadding
NewerClient.png DPanelList.GetSpacing
NewerClient.png DPanelList.Init
NewerClient.png DPanelList.OnMousePressed
NewerClient.png DPanelList.OnMouseWheeled
NewerClient.png DPanelList.OnVScroll
NewerClient.png DPanelList.Paint
NewerClient.png DPanelList.PerformLayout
NewerClient.png DPanelList.Rebuild
NewerClient.png DPanelList.RemoveItem
NewerClient.png DPanelList.SetAutoSize
NewerClient.png DPanelList.SetBottomUp
NewerClient.png DPanelList.SetDrawBackground
NewerClient.png DPanelList.SetNoSizing
NewerClient.png DPanelList.SetPadding
NewerClient.png DPanelList.SetSpacing
NewerClient.png DPanelList.SetSize
NewerClient.png DPanelList.SizeToContents
NewerClient.png DPanelList.SortByMember

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox