metasarah
05-29-2003, 11:27 AM
Here's the code for a checkbox that is written in LZX. It's actually much simpler than the redmond code which is written completely in Javascript. It also has visual feedback for mouseover and mousedown, as well as just check and unchecked states.
<class name="mycheckbox" >
<attribute name="value" value="false" />
<attribute name="label" value="my checkbox" type="string"/>
<basebutton onclick="parent.setAttribute('value',!parent.value)">
<attribute name="resource" value="unchecked"/>
<method event="oninit">
// display the initial value
this.setResource(parent.value ? 'checked' : 'unchecked');
</method>
<method event="onvalue" reference="parent">
// whenever the parent's value changes, update resource
this.setResource(parent.value ? 'checked' : 'unchecked');
</method>
</basebutton>
<text resize="true">
<attribute name="label" constraint="parent.label"/>
</text>
<simplelayout axis="x"/>
</class>
If you want to use this, the resources are enclosed in the attached zip file.
<class name="mycheckbox" >
<attribute name="value" value="false" />
<attribute name="label" value="my checkbox" type="string"/>
<basebutton onclick="parent.setAttribute('value',!parent.value)">
<attribute name="resource" value="unchecked"/>
<method event="oninit">
// display the initial value
this.setResource(parent.value ? 'checked' : 'unchecked');
</method>
<method event="onvalue" reference="parent">
// whenever the parent's value changes, update resource
this.setResource(parent.value ? 'checked' : 'unchecked');
</method>
</basebutton>
<text resize="true">
<attribute name="label" constraint="parent.label"/>
</text>
<simplelayout axis="x"/>
</class>
If you want to use this, the resources are enclosed in the attached zip file.