DPanel

From GMod Wiki

Jump to: navigation, search
Derma Control: DPanel
Parent Class:Panel
Subclasses:
Description:
A basic panel that you can parent other controls to. It's main purpose is a base for other panels.

Examples

DescriptionThis creates a blank frame (almost like DFrame) where you can use it as a parent and use DermaPanel:SetPos(w,h) with items. This item can be added inside other items like DPropertySheet.
Used onNewerClient.png
Code
 
local DermaPanel = vgui.Create( "DFrame" )
DermaPanel:SetPos( 50, 50 )
DermaPanel:SetSize( 300, 325 )
DermaPanel:SetTitle( "Testing Derma Stuff" )
DermaPanel:SetVisible( true )
DermaPanel:SetDraggable( true )
DermaPanel:ShowCloseButton( true )
DermaPanel:MakePopup()
 
local TestingPanel = vgui.Create( "DPanel", DermaPanel )
TestingPanel:SetPos( 25, 50 )
TestingPanel:SetSize( 250, 250 )
TestingPanel.Paint = function() -- Paint function
    --Set our rect color below us; we do this so you can see items added to this panel
    surface.SetDrawColor( 50, 50, 50, 255 ) 
    surface.DrawRect( 0, 0, TestingPanel:GetWide(), TestingPanel:GetTall() ) -- Draw the rect
end
 
local DermaButton = vgui.Create( "DButton", TestingPanel )
DermaButton:SetText( "Click here for cheezburger!" )
DermaButton:SetPos( 20, 10 )
DermaButton:SetSize( 200, 100 )
DermaButton.DoClick = function ()
    RunConsoleCommand( "kill" )
end
 
Outputdpanelim5.png


Methods

NewerClient.png DPanel.ApplySchemeSettings
NewerClient.png DPanel.GetDisabled
NewerClient.png DPanel.GetPaintBackground
NewerClient.png DPanel.Init
NewerClient.png DPanel.Paint
NewerClient.png DPanel.PerformLayout
NewerClient.png DPanel.SetDisabled
NewerClient.png DPanel.SetPaintBackground

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox