Name

checkbox — shortdesc

Synopsis

LZX: checkbox
JavaScript: checkbox
Type: Class
Access: public
Topic: Components.Laszlo Components
Declared in: lps/components/lz/checkbox.lzx

Description

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 42. 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.write('value: '+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.

A checkbox component representing a boolean

Superclass Chain

node (LzNode) » view (LzView) » basecomponent » basevaluecomponent » baseformitem » checkbox

Known Subclasses

Details

Properties (1)

text_y
<attribute name="text_y" type="number" value="${this.cb.height/2 - this._title.height/2+1}" />
public var text_y : Number;
the y position of the text label. default: centered

Methods (2)

doSpaceUp()
<method name="doSpaceUp" />
public function doSpaceUp();
toggles the value when the space bar is pressed while focused
setValue()
<method name="setValue" args="val" />
public function setValue(val);
setter for 'value' attribute. The checkbox value is always true or false.

LZX Synopsis

<class name="checkbox" extends=" baseformitem ">
  <attribute name=" text_y " type="number" value="${this.cb.height/2 - this._title.height/2+1}" />
  <method name=" doSpaceUp " />
  <method name=" setValue " args="val" />
</class>

JavaScript Synopsis

public checkbox extends  baseformitem  {
  public var text_y  : Number;
  prototype public function doSpaceUp ();
  prototype public function setValue (val);
}