Garry's Mod Wiki

DCheckBox

Description

The DCheckBox is a checkbox. It allows you to get a boolean value from the user (true/false - yes/no)

Parent

Derives from DButton.

Methods

boolean DCheckBox:GetChecked()
Gets the checked state of the checkbox.
boolean DCheckBox:IsEditing()
Returns whether the state of the checkbox is being edited. This means whether the user is currently clicking (mouse-down) on the checkbox, and applies to both the left and right mouse buttons.
DCheckBox:OnChange( boolean bVal )
Called when the "checked" state is changed.
DCheckBox:SetChecked( boolean checked )
Sets the checked state of the checkbox. Does not call the checkbox's DCheckBox:OnChange and Panel:ConVarChanged methods, unlike DCheckBox:SetValue.
DCheckBox:SetValue( boolean checked )
Sets the checked state of the checkbox, and calls the checkbox's DCheckBox:OnChange and Panel:ConVarChanged methods.
DCheckBox:Toggle()
Toggles the checked state of the checkbox, and calls the checkbox's DCheckBox:OnChange and Panel:ConVarChanged methods. This is called by DCheckBox:DoClick.

Example

Creates a DCheckBox and sets its initial value.

local window = vgui.Create( "DFrame" ) window:SetSize( 300, 200 ) window:Center() window:MakePopup() local checkbox = window:Add( "DCheckBox" ) -- Create the checkbox checkbox:SetPos( 25, 50 ) -- Set the position checkbox:SetValue( true ) -- Initial "ticked" value

Page Links


Special Pages


Wikis

?

Render Time: 251ms

DB GetPage 85
Generate Html 7
SaveChanges (1) 145
Render Body 0
Render Sidebar 12