DCheckBoxLabel/OnChange

From Garry's Mod
Jump to: navigation, search
 DCheckBoxLabel:OnChange( )

Contents

DescriptionPanelHook

Called when the "checked" state is changed.

Arguments

boolean bVal

Whether the checkbox is checked or unchecked.

Examples

Example

Creates a a DCheckBoxLabel that prints to the console when ticked/unticked

local Frame = vgui.Create( "DFrame" )
Frame:SetSize( 300, 100 )
Frame:SetPos( 200, 200 )

local LabelBox = vgui.Create( "DCheckBoxLabel", Frame )
LabelBox:SetPos( 10, 40 )
LabelBox:SetText( "This is a DLabel" )
function LabelBox:OnChange( val )
	if val then
		print( "The box has been ticked!" )
	else
		print( "The box has been unticked!" )
	end
end

Output:

The box has been ticked!
Personal tools
Navigation