The checkbox tag provides a simple toggle button.
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.
<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.
See Also:For details on how this component is constructed, see the Checkbox section of the Component Design Guide.
| Attributes | |||||
| Name | Usage | Type (Tag) | Type (JS) | Default | Category |
| text_y | Tag & JS | number | Number | setter | |
|
the y position of the text label. default: centered |
|||||
|
|
|||||
doesenter, enabled, hasdefault, isdefault, style, styleable, text
changed, ignoreform, onchanged, onvalue, rollbackvalue, submit, submitname
class, classroot, cloneManager, datapath, id, ignoreAttribute, ignoreplacement, immediateparent, initstage, name, nodeLevel, onconstruct, oninit, parent, placement, subnodes
aaactive, aadescription, aaname, aasilent, aatabindex, align, bgcolor, clickable, clickregion, clip, cursor, defaultplacement, fgcolor, focusable, focustrap, font, fontsize, fontstyle, frame, framesloadratio, hassetheight, hassetwidth, height, layout, loadratio, mask, onblur, onclick, ondata, ondblclick, onfocus, onkeydown, onkeyup, onmousedown, onmouseout, onmouseover, onmouseup, onselect, opacity, options, pixellock, play, resource, resourceheight, resourcewidth, rotation, selectiontype, showhandcursor, source, stretches, subviews, totalframes, unstretchedheight, unstretchedwidth, valign, visible, width, x, xoffset, y, yoffset
| doSpaceUp() | ||
| checkbox.doSpaceUp() | ||
|
toggles the value when the space bar is pressed while focused |
||
|
|
| setValue() | ||
| checkbox.setValue(val) | ||
|
setter for 'value' attribute. The checkbox value is always true or false. |
||
| Parameters | ||
| Name | Type | Desc |
| 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 | |
|
|
||
doEnterDown, doEnterUp, doSpaceDown, doSpaceUp, setStyle, setTint, updateDefault
applyData, commit, findForm, init, rollback, setChanged, setValue, toXML, updateData
animate, applyConstraint, childOf, completeInstantiation, createChildren, dataBindAttribute, destroy, determinePlacement, getAttribute, getOption, getUID, lookupSourceLocator, searchImmediateSubnodes, searchSubnodes, setAttribute, setDatapath, setID, setName, setOption
addProxyPolicy, addSubview, bringToFront, construct, containsPt, getAttributeRelative, getBounds, getColor, getColorTransform, getContextMenu, getCurrentTime, getDepthList, getHeight, getID3, getMouse, getPan, getTotalTime, getVolume, getWidth, measureHeight, measureWidth, play, releaseLayouts, removeProxyPolicy, searchParents, searchSubviews, seek, sendBehind, sendInFrontOf, sendToBack, setAAActive, setAADescription, setAAName, setAASilent, setAATabIndex, setAlign, setAttributeRelative, setBGColor, setClickable, setColor, setColorTransform, setContextMenu, setCursor, setHeight, setLayout, setOpacity, setPan, setPlay, setResource, setResourceNumber, setRotation, setShowHandCursor, setSource, setValign, setVisible, setVolume, setWidth, setX, setY, shouldYieldFocus, stop, stretchResource, unload, updateResourceSize
| Events |
onaddsubresource, onaddsubview, onblur, onclick, ondblclick, onerror, onfocus, onframe, onheight, onlastframe, onload, onmousedown, onmousedragin, onmousedragout, onmouseout, onmouseover, onmouseup, onmouseupoutside, onopacity, onplay, onremovesubview, onstop, ontimeout, onwidth, onx, ony
Copyright © 2002-2005 Laszlo Systems, Inc. All Rights Reserved. Unauthorized use, duplication or distribution is strictly prohibited. This is the proprietary information of Laszlo Systems, Inc. Use is subject to license terms.