scrollrichedittext.lzx
<library>
<include href="baserichedittext.lzx"/>
<class name="scrollrichedittext" extends="baserichedittext" multiline="true">
<attribute name="border" value="0
"/>
<attribute name="vscrollbarclassname" type="string" value="vscrollbar
"/>
<attribute name="vscrollwidth" value="${(_vs && _vs.visible) ? _vs.width : 0}"/>
<attribute name="_vs" value="null
"/>
<method name="ensurevscrollbar">
if (this._vs == null) {
var classname = this.vscrollbarclassname;
if (classname == "") {
classname = "vscrollbar";
}
if ($debug) {
if (typeof(lz[classname]) == "undefined") {
Debug.error("%s.scrollbarclassname invalid: %s", this, classname);
}
}
this._vs = new (lz[classname])(this,
{ axis: "y",
scrollattr: "pos",
scrolltarget: this.inp });
var vsinit = function () {
var p = this.parent;
// _vs.x="${parent.width - this.width}"
this.addProperty("__constraintX", function(ignore) { this.setAttribute("x", this.parent.width - this.width); });
this.applyConstraintMethod("__constraintX", [p, "width", this, "width"]);
// _vs.stepsize="${parent.inp.lineheight}"
this.addProperty("__constraintStepsize", function(ignore) { this.setAttribute("stepsize", this.parent.inp.lineheight); });
this.applyConstraintMethod("__constraintStepsize", [p.inp, "lineheight"]);
// _vs.scrollmax="${parent.inp.maxheight}"
this.addProperty("__constraintScrollmax", function(ignore) { this.setAttribute("scrollmax", this.parent.inp.maxheight); });
this.applyConstraintMethod("__constraintScrollmax", [p.inp, "maxheight"]);
}
vsinit.call(this._vs);
}
</method>
<method name="init">
super.init();
this.ensurevscrollbar();
</method>
<_richinternalinputtext name="inp" x="${parent.border}" y="${parent.border}" height="${parent.height-parent.border*2}" width="${parent.width - parent.vscrollwidth - parent.border*2 }">
<attribute name="maxheight" value="${this.height + this.lineheight * (this.maxscroll - 1)}"/>
<event name="onpos"/>
<attribute name="pos" value="0
" setter="this.setPos(pos)"/>
<method name="init">
super.init();
// Store a link to the enclosing rich text edit area deep in this
// swf sprite, so that we can do a clever fix for LPP-4396,
// "clicking bold moves insertion point."
// See the lz.ModeManager.rawMouseEvent handler defined in
// richtexteditarea.lzx to see how we use this breadcrumb.
this.sprite.__LZtextclip.__LZrte = this.parent;
</method>
<method name="setPos" args="p">
if (this.isinited) {
this.setAttribute('scroll', Math.ceil(1 - (p / this.lineheight)));
this.pos = p;
if (this.onpos) this.onpos.sendEvent(p);
}
</method>
<handler name="onscroll">
this.setPos(-this.lineheight * (this.scroll - 1), true);
</handler>
</_richinternalinputtext>
<method name="_placeTextY">
// Do nothing.
</method>
</class>
</library>
Cross References
Includes
Classes