[Laszlo-dev] how to convert applyConstraint to applyConstraintMethod in lps-4.1.x
P T Withington
ptw at pobox.com
Wed Aug 6 11:38:18 PDT 2008
In preparation for swf9, we need constraint closures to be methods (so
they will get proper references to `this`). The conversion you need
to make is to take the closure:
function() { this.setAttribute("x", this.parent.width -
this.width); }
and make it a method on the class:
<method name="constrain_x">this.setAttribute("x", this.parent.width
- this.width);</method>
and apply it by:
this.applyConstraintMethod('constrain_x', [p, "width", this,
"width"])
Better yet, if the constraint can be written in LZX, as in the comment:
// _vs.x="${parent.width - this.width}"
you would not need to do any of this. I don't know enough about the
rich-text component to say why it was done this way.
On 2008-08-06, at 14:00EDT, Sebastian Wagner wrote:
> hi,
> I try to use the Rich-Text Editor in lps-4.1.1
>
> Besides others you get Messages like that:
> INFO @lz/vscrollbar.lzx#9: vscrollbar.applyConstraint is
> deprecated. Use
> vscrollbar.applyConstraintMethod instead
>
> see:
> http://www.openlaszlo.org/lps4.1/lps/components/incubator/rich-text/test/richtexteditor-test.lzx?lzr=swf8&debug=true
>
> I was able to fix all the other Errors but
> *vscrollbar.applyConstraint is
> deprecated* confuses me cause actually applyConstraint is still a
> valid
> method in the Documenation and applyConstraintMethod has different
> arguments
> then applyConstraint, so how can we convert that?
>
> The result of the Error is that the scollbar does not work in the
> Rich-Text
> Editor.
>
> The Error comes from this part:
>
> var vsinit = function () {
> var p = this.parent;
>
>
> // _vs.x="${parent.width - this.width}"
> this.applyConstraint("x",
> function() { this.setAttribute("x",
> this.parent.width - this.width); },
>
> [p, "width", this, "width"]);
>
> .....
>
> in the File:
> http://www.openlaszlo.org/lps4.1/lps/components/incubator/rich-text/scrollrichedittext.lzx?lzt=source
>
> how to convert applyConstraint to applyConstraintMethod or did the
> compile
> actually mean something different?
>
>
> thx
> sebastian
>
> --
> Sebastian Wagner
> http://www.webbase-design.de
> http://openmeetings.googlecode.com
> http://www.laszlo-forum.de
> seba.wagner at gmail.com
More information about the Laszlo-dev
mailing list