I didn't test, but I think this should be:
new new_class(canvas, {name: "first", width: 100,
height: 100, bgcolor: blue},
[ { name : "LzView" ,
attrs: {name: "second", bgcolor: red, x: 100,
width: 20, height: 20} ], true );
A
On Apr 27, Max Carlson wrote:
> Hi,
>
> I can't get this code example to work correctly to demonstrate how to
> instantiate a new class. The third argument is suppose to be for the
> children of this instantiated class, but how do you set the parent view
> of the children. Right now, the view "second" is appearing at the top
> level. This occurs naturally enough because I have supplied "null" as
> its parent argument, but canvas.first produces a "first property not
> found" error. The small red square should appear inside the blue square
> and be its child
>
> <canvas>
> <class name="new_class" width="100" height="100"/>
> <handler name="oninit">
> var parentview =
> new new_class(canvas, {name: "first", width: 100,
> height: 100, bgcolor: blue},
> [ new LzView(null, {name: "second", bgcolor: red, x: 100, width: 20,
> height: 20})], true);
> </handler>
> <handler name="onaddsubview" args="view">
> if (view.name <http://view.name> == null) return;
> Debug.write("view = " + view.name <http://view.name>);
> </handler>
> </canvas>
>
> _______________________________________________
> Laszlo-user mailing list
> [email protected]
> http://www.openlaszlo.org/mailman/listinfo/laszlo-user
>
_______________________________________________
Laszlo-user mailing list
[email protected]
http://www.openlaszlo.org/mailman/listinfo/laszlo-user