Garry's Mod Wiki

DCheckBox:OnChange

  DCheckBox:OnChange( boolean bVal )

Description

Called when the "checked" state is changed.

Arguments

1 boolean bVal
Whether the CheckBox is checked or not.

Example

Creates a metamethod on the DCheckBox class to print any changes to the console.

function DCheckBox:OnChange(bVal) if (bVal) then print("Checked!") else print("Unchecked!") end end
Output: All new checkboxes created will print Checked! or Unchecked! when their checked state is changed.