Category:DCheckBoxLabel

From Garry's Mod
Jump to: navigation, search

Contents

DescriptionPanelPage

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)

Inherited Functions

Inherits the following functions from DPanel and its parents up to 3 levels deep:


Examples

Example

Creates a DCheckBoxLabel, ties it to a convar, and sets its initial value.

local DermaCheckbox = vgui.Create("DCheckBoxLabel") // Create the checkbox
DermaCheckbox:SetParent(DermaPanel)
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(0)             // Initial value (will determine whether the box is ticked too)
DermaCheckbox:SizeToContents()                      // Make its size the same as the contents

Output:



DCheckBoxLabel.png
Personal tools
Navigation