DCheckBoxLabel
Description
The DCheckBoxLabel is a DCheckBox with a DLabel next to it. It allows you to get a boolean value from the user (true/false - yes/no)
Parent
Derives methods, etc not listed on this page from DPanel.
Methods
boolean DCheckBoxLabel:GetChecked()
Gets the checked state of the checkbox. This calls the checkbox's DCheckBox:GetChecked function.
DCheckBoxLabel:SetBright( boolean bright )
We advise against using this. It may be changed or removed in a future update.
You really should be using DCheckBoxLabel:SetTextColor instead
Sets the color of the DCheckBoxLabel's text to the bright text color defined in the skin.
DCheckBoxLabel:SetChecked( boolean checked )
Sets the checked state of the checkbox. Does not call DCheckBoxLabel:OnChange or Panel:ConVarChanged, unlike DCheckBoxLabel:SetValue.
DCheckBoxLabel:SetConVar( string convar )
Sets the console variable to be set when the checked state of the DCheckBoxLabel changes.
DCheckBoxLabel:SetDark( boolean darkify )
We advise against using this. It may be changed or removed in a future update.
You really should be using DCheckBoxLabel:SetTextColor instread
Sets the text of the DCheckBoxLabel to be dark colored.
DCheckBoxLabel:SetValue( boolean checked )
Sets the checked state of the checkbox, and calls DCheckBoxLabel:OnChange and the checkbox's Panel:ConVarChanged methods.
DCheckBoxLabel:Toggle()
Toggles the checked state of the DCheckBoxLabel.
Example
Creates a DCheckBoxLabel, ties it to a convar, and sets its initial value.
concommand.Add( "example_checkboxlabel", function( ply, cmd, args )
local window = vgui.Create( "DFrame" )
window:SetSize( 300, 200 )
window:Center()
window:MakePopup()
local DermaCheckbox = window:Add( "DCheckBoxLabel" ) -- Create the checkbox
DermaCheckbox:SetPos( 25, 50 ) -- Set the position
DermaCheckbox:SetText("God Mode") -- Set the text next to the box
DermaCheckbox:SetConVar("sbox_godmode") -- Change a ConVar when the box it ticked/unticked
DermaCheckbox:SetValue( true ) -- Initial value
DermaCheckbox:SizeToContents() -- Make its size the same as the contents
end )
Output: 
