Garry's Mod Wiki

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 from DPanel.

Methods

boolean DCheckBoxLabel:GetChecked()
Gets the checked state of the checkbox. This calls the checkbox's DCheckBox:GetChecked function.
number DCheckBoxLabel:GetIndent()
Gets the indentation of the element on the X axis.
DCheckBoxLabel:OnChange( boolean bVal )
Called when the "checked" state is changed.
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 instread 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:SetFont( string font )
Sets the font of the text part of the DCheckBoxLabel.
DCheckBoxLabel:SetIndent( number ident )
Sets the indentation of the element on the X axis.
DCheckBoxLabel:SetTextColor( table color )
Sets the text color for the DCheckBoxLabel.
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.

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
Output:

Page Links


Special Pages


Wikis

?

Render Time: 50ms

DB GetPage 2
Generate Html 10
SaveChanges (1) 24
Render Body 0
Render Sidebar 11