[Laszlo-user] Laszlo Code Question

Max Carlson max at laszlosystems.com
Thu Apr 27 16:46:14 EDT 2006


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

   <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 name="onaddsubview" args="view">
      if (view.name <http://view.name> == null) return;
      Debug.write("view = " + view.name <http://view.name>);

More information about the Laszlo-user mailing list