[Laszlo-dev] Setting constraints on a newed object
P T Withington
ptw at pobox.com
Tue Jul 19 10:21:45 PDT 2005
Well, a constraint boils down to a method that sets the constrained
attribute and a set of events that listen to the dependencies of the
constraint. The compiler has a simple analyzer to find the
dependencies in a constraint expression. You'd have to do this
analysis manually for a constraint created at runtime. Your simple
case could be done as:
obj.constrainWidth = function () {
this.setAttribute('width', parent.width);
}
new LzDelegate(obj, 'constrainWidth', obj.parent, 'onwidth');
If there were multiple dependencies, you'd create a delegate for your
constraintMethod and register it on each of the dependencies.
On 19 Jul 2005, at 12:52, Andrew McClain wrote:
> What's the best way to set up constraints on a javascript-created
> object?
>
> e.g. convert <LZClass height="40" width="${parent.width}" /> into
> javascript
>
> var obj = new LZClass(this, {height: 40});
>
> ... then what?
>
>
> andrew
>
> _______________________________________________
> Laszlo-dev mailing list
> Laszlo-dev at openlaszlo.org
> http://www.openlaszlo.org/mailman/listinfo/laszlo-dev
>
>
More information about the Laszlo-dev
mailing list