Garry's Mod Wiki

DCheckBoxLabel:OnChange

  DCheckBoxLabel:OnChange( boolean bVal )

Description

Called when the "checked" state is changed.

Arguments

1 boolean bVal
Whether the checkbox is checked or unchecked.

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!