<checkbox>
The checkbox tag provides a simple toggle button.

JavaScript: lz.checkbox

The checkbox tag provides a simple toggle button that represents a value of true or false. It has a disabled state where it does not respond to mouse events when enabled=false.

Example 54. simple checkbox

<canvas debug="true" height="160">
              <debug x="135" y="15"/>
              <checkbox id="checkMe" text="Show Green Square"/>
              <view visible="${checkMe.value}" bgcolor="green" width="20" height="20"/>

              <button text="Toggle" onclick="checkMe.setAttribute('value', !checkMe.value)"/>
              <button text="Disable" onclick="checkMe.setAttribute('enabled', false)"/>
              <button text="Enable" onclick="checkMe.setAttribute('enabled', true)"/>
              <button text="status" onclick="Debug.debug('value: %w', checkMe.value)"/>
              <simplelayout axis="y" spacing="4"/>
              </canvas>

Note that checkbox attributes may be used as constraints for other attributes. In the example above, clicking the checkbox toggles the visibility of the green square. Whenever the value of the checkbox changes, so does the visibility attribute of the green view.

Attributes

Name (CSS property) Type (tag) Type (js) Default Category
text_y number Number this.cb.height/2 - this._title.height/2+1 read/write
  the y position of the text label. default: centered

Attributes inherited from <basevaluecomponent>

type, value

Methods

doSpaceUp()
checkbox.doSpaceUp();
toggles the value when the space bar is pressed while focused

setValue()
checkbox.setValue(val, isinitvalue : Boolean);
setter for 'value' attribute. The checkbox value is always true or false.
Parameter Name Type Description
val   can be any Javascript type and is evaluated as its boolean equivalent, strings "true" and "false" are treated specially to represent true and false respectively
isinitvalue Boolean if true, the rollbackvalue is set.

Methods inherited from lz.Eventable

destroy, setAttribute

Events

Events inherited from <baseformitem>

onchanged, onvalue

Events inherited from <node>

onconstruct, ondata, oninit

Events inherited from lz.Eventable

ondestroy