DCollapsibleCategory

From GMod Wiki

Jump to: navigation, search
Derma Control: DCollapsibleCategory
Parent Class:Panel
Subclasses:
Description:
Collapsable Category Panel

Examples

DescriptionCreates a collapsable list of items.
Used onNewerClient.png
Code
 
local DermaPanel = vgui.Create( "DFrame" )
DermaPanel:SetPos( 50,50 )
DermaPanel:SetSize( 250, 300 )
DermaPanel:SetTitle( "Testing Derma Stuff" )
DermaPanel:SetVisible( true )
DermaPanel:SetDraggable( true )
DermaPanel:ShowCloseButton( true )
DermaPanel:MakePopup()
 
local SomeCollapsibleCategory = vgui.Create("DCollapsibleCategory", DermaPanel)
SomeCollapsibleCategory:SetPos( 25,50 )
SomeCollapsibleCategory:SetSize( 200, 50 ) -- Keep the second number at 50
SomeCollapsibleCategory:SetExpanded( 0 ) -- Expanded when popped up
SomeCollapsibleCategory:SetLabel( "Our Collapsible Category" )
 
CategoryList = vgui.Create( "DPanelList" )
CategoryList:SetAutoSize( true )
CategoryList:SetSpacing( 5 )
CategoryList:EnableHorizontal( false )
CategoryList:EnableVerticalScrollbar( true )
 
--Add our list above us as the contents of the collapsible category 
SomeCollapsibleCategory:SetContents( CategoryList )
    local CategoryContentOne = vgui.Create( "DCheckBoxLabel" )
    CategoryContentOne:SetText( "God Mode" )
    CategoryContentOne:SetConVar( "sbox_godmode" )
    CategoryContentOne:SetValue( 1 )
    CategoryContentOne:SizeToContents()
CategoryList:AddItem( CategoryContentOne ) -- Add the above item to our list
 
    local CategoryContentTwo = vgui.Create( "DCheckBoxLabel" )
    CategoryContentTwo:SetText( "Player Damage" )
    CategoryContentTwo:SetConVar( "sbox_plpldamage" )
    CategoryContentTwo:SetValue( 1 )
    CategoryContentTwo:SizeToContents()
CategoryList:AddItem( CategoryContentTwo )
 
    local CategoryContentThree = vgui.Create( "DCheckBoxLabel" )
    CategoryContentThree:SetText( "Fall Damage" )
    CategoryContentThree:SetConVar( "mp_falldamage" )
    CategoryContentThree:SetValue( 1 )
    CategoryContentThree:SizeToContents()
CategoryList:AddItem( CategoryContentThree )
 
    local CategoryContentFour = vgui.Create( "DCheckBoxLabel" )
    CategoryContentFour:SetText( "Noclip" )
    CategoryContentFour:SetConVar( "sbox_noclip" )
    CategoryContentFour:SetValue( 1 )
    CategoryContentFour:SizeToContents()
CategoryList:AddItem( CategoryContentFour )
 
    local CategoryContentFive = vgui.Create( "DCheckBoxLabel" )
    CategoryContentFive:SetText( "All Talk" )
    CategoryContentFive:SetConVar( "sv_alltalk" )
    CategoryContentFive:SetValue( 1 )
    CategoryContentFive:SizeToContents()
CategoryList:AddItem( CategoryContentFive )
 
    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" )
CategoryList:AddItem( CategoryContentSix )
 
    local CategoryContentSeven = vgui.Create( "DSysButton" )
    CategoryContentSeven:SetType( "close" )
    CategoryContentSeven.DoClick = function()
        RunConsoleCommand("sv_password", "toyboat")
    end
    CategoryContentSeven.DoRightClick = function()
        RunConsoleCommand("sv_password", "**")
    end
CategoryList:AddItem( CategoryContentSeven )
 
Outputcollapsableopennw5.png


Methods

NewerClient.png DCollapsibleCategory.GetPadding
NewerClient.png DCollapsibleCategory.SetStartHeight
NewerClient.png DCollapsibleCategory.GenerateExample
NewerClient.png DCollapsibleCategory.Think
NewerClient.png DCollapsibleCategory.GetAnimTime
NewerClient.png DCollapsibleCategory.Toggle
NewerClient.png DCollapsibleCategory.SetPadding
NewerClient.png DCollapsibleCategory.ApplySchemeSettings
NewerClient.png DCollapsibleCategory.GetExpanded
NewerClient.png DCollapsibleCategory.Paint
NewerClient.png DCollapsibleCategory.Init
NewerClient.png DCollapsibleCategory.AnimSlide
NewerClient.png DCollapsibleCategory.GetDrawBackground
NewerClient.png DCollapsibleCategory.LoadCookies
NewerClient.png DCollapsibleCategory.OnMousePressed
NewerClient.png DCollapsibleCategory.PerformLayout
NewerClient.png DCollapsibleCategory.GetStartHeight
NewerClient.png DCollapsibleCategory.SetDrawBackground
NewerClient.png DCollapsibleCategory.SetExpanded
NewerClient.png DCollapsibleCategory.SetContents
NewerClient.png DCollapsibleCategory.SetLabel
NewerClient.png DCollapsibleCategory.SetAnimTime

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox