optionsbutton.lzx

<!--
* X_LZ_COPYRIGHT_BEGIN ****************************************************
* Copyright 2001-2008 Laszlo Systems, Inc.  All Rights Reserved.          *
* Use is subject to license terms.                                        *
* X_LZ_COPYRIGHT_END ******************************************************-->
<library>

    <class name="optionsbutton" clickable="true" focusable="${!clips.visible}">
        <attribute name="text" type="string" value=""/>
        <basebutton name="btn" resource="option_button_rsc" stretches="width" width="100%" onclick="parent.onclick.sendEvent()">
            <handler name="onmousedown" reference="classroot">
                this.onmouseover.sendEvent();
                this.onmousedown.sendEvent();
            </handler>
            <handler name="onmouseup" reference="classroot">
                this.onmouseup.sendEvent();
            </handler>
        </basebutton>
        
        <view height="${parent.height}" width="1" bgcolor="0xd2d0ef"/>
        <view height="${parent.height}" width="1" x="${parent.width - 1}" bgcolor="0x130a7b"/>
        <text text="${parent.text}" fontstyle="bold" fontsize="9" fgcolor="0xc3bff7" x="${(parent.width - this.getTextWidth())/2.0}" y="3"/>

        <method name="getCanvasFocusRect">
            var rect = [ this.getAttributeRelative('x', canvas) - 2,
                         this.getAttributeRelative('y', canvas) - 2,
                         this.getAttributeRelative('width', canvas) + 4,
                         this.getAttributeRelative('height', canvas) + 4];
            return rect;
        </method>
        
        
        <method name="findnext">
            
            if(this['next'] && this['next'].visible){
                return this.next;
            }
            
        </method>
        <method name="findprev">
            if(this['prev']){
                return this.prev;
            }
        </method>
        <method name="handlekeydown" args="k">
            if(k == 13){
                this.onmousedown.sendEvent();
            }
        </method>
        <method name="handlekeyup" args="k">
            if(k == 13){
                this.onmouseup.sendEvent();
                this.onclick.sendEvent();
            }
        </method>
        <method name="construct" args="parent, args">
            this.focusable = true;
            super.construct(parent, args);
            if(navmanager) navmanager.add(this);
        </method>
    </class>

    
</library>

Cross References

Classes