borderinput.lzx
<library>
<class name="borderinput">
<attribute name="changed" value="${this.txt.changed}"/>
<attribute name="text" setter="this.setText(text, false)"/>
<attribute name="labelwidth" type="number" value="80
"/>
<attribute name="label" type="string" when="once" setter="label_text.setAttribute('text', label)"/>
<attribute name="labelstyle" value="null
" when="once"/>
<text name="label_text" fontsize="11" resize="true" y="2"/>
<view name="border" bgcolor="0xACACBF" x="${parent.labelwidth}"/>
<baseedittext name="txt" y="2" fontsize="11" height="17">
<_newinternalinputtext name="txt" width="${parent.width}" height="${parent.height}" bgcolor="white">
<method name="getPrevSelection">
if ( parent['getPrevSelection'] ) {
return parent.getPrevSelection();
}
return null; // so that default tab order occurs
</method>
<method name="getNextSelection">
if ( parent['getNextSelection'] ) return parent.getNextSelection()
return null; // so that default tab order occurs
</method>
</_newinternalinputtext>
</baseedittext>
<setter name="width" args="w">
super.setAttribute('width', w);
if (this.isinited ) {
this.border.setAttribute('width', w - this.labelwidth);
this.txt.setAttribute('width', w - this.labelwidth - 2);
}
</setter>
<method name="setText" args="t,isinitvalue">
this.txt.setValue(t,isinitvalue);
</method>
<method name="setSelection" args="ns,ne=null">
this.txt.setSelection(ns,ne);
</method>
<method name="getText">
return this.txt.value;
</method>
<method name="init">
super.init();
this.setAttribute('width', width);
this.border.setAttribute('height', this.txt.height + 2 );
this.label_text.setAttribute('x', this.labelwidth - 6 - this.label_text.width);
this.border.setAttribute('x', this.labelwidth);
this.txt.setAttribute('x', this.labelwidth + 1);
if (this.labelstyle != null)
this._applystyle(this.labelstyle);
</method>
<method name="_applystyle" args="s">
if (s != null) {
this.label_text.setAttribute("fgcolor", s.textcolor);
this.label_text.setAttribute("font", s.font);
this.label_text.setAttribute("fontsize", s.fontsize);
this.label_text.setAttribute('x', this.labelwidth - 6 - this.label_text.width);
}
</method>
</class>
</library>