Water 5-User Interface-Rich Widgets
class ui.item.checkbox
Contract
Parameter keyDefault valueType
nameoptstring
labelnullstring
xactive_valuenonnegative
yactive_valuenonnegative
widthactive_valuenonnegative
heightactive_valuenonnegative
foreground_colorblackcolor
background_colorwhitecolor
visibilityactive_valueboolean
tool_tipnulltype.<one_of string/>
the_valueactive_valueboolean
clickoptmethod
Water Contract
<class ui.item.checkbox
  name          =opt=string
  label         =null=string
  the_value     =<active_value></active_value>=boolean
  click         =opt=method
/>

See also: radiobutton

Checkbox displays its label next to a small rectangle. When the user clicks on it, the checkbox will toggle between checked and unchecked. the_value is set to the new value of the checkbox with 'true' meaning checked and 'false' meaning unchecked. Then the click method is called with the checkbox clicked on as the subject of the call. The default value of the_value is false indicating an unchecked state, but the_value can be initialized during button creation to 'true' if you like. the_value can also be read and set programmatically using get (or the dot syntax) and the 'set' method.
ui.<window name="mywin">
 null
 ui.<row>
  ui.<checkbox name="check0" click=<method null> <echo "the_value is " _subject.the_value/></>/>
  ui.<checkbox name="check1" the_value=true/>
 </row>
</window>
ui.mywin.center.1.<set the_value=false/> <!-- programmatically set the value -->
ui.mywin.center.1.the_value              <!-- returns false -->
Note that check1 in the above example doesn't have a click method. That's fine. Often check boxes are just read by the program when the program is ready to read them. If you want some action to happen as soon as the user clicks on the checkbox, give the checkbox a click method.