Garry's Mod Wiki

Revision Difference

DCheckBox:OnChange#514217

<function name="OnChange" parent="DCheckBox" type="panelfunc">⤶ <ispanel>yes</ispanel>⤶ <description>Called when the "checked" state is changed.</description>⤶ <realm>Client</realm>⤶ <args>⤶ <arg name="bVal" type="boolean">Whether the CheckBox is checked or not.</arg>⤶ </args>⤶ </function>⤶ ⤶ <example>⤶ <description>Creates a metamethod on the DCheckBox class to print any changes to the console.</description>⤶ <code>⤶ function DCheckBox:OnChange(bVal)⤶ if (bVal) then⤶ print("Checked!")⤶ else⤶ print("Unchecked!")⤶ end⤶ end⤶ </code>⤶ <output>All new checkboxes created will print `Checked!` or `Unchecked!` when their checked state is changed.</output>⤶ ⤶ </example>