When you create a view, you have to pass its parent to the constructor. Look at the construct() method for view in the docs:
http://www.laszlosystems.com/lps-3.2/docs/reference/index.html On Mon, Apr 10, 2006 at 10:58 PM, Robin wrote: > Dan Stowell wrote: >> That could get a bit messy, but is otherwise a great idea. Layouts >> are >> for coordinating visual state between different views - that's what >> you're trying to do here. > I ended up going with a layout, it's going to be part of a custom > component > anyway, so that's fine. I got it working, however part of the update() > method > contains: > for (var i=0; i < c; i++) { > var v = new hrule(); > v.setAttribute('width', this.parent.width); > v.setAttribute('bgcolor', this.linecolor); > this.addSubview(v); > } > > where 'c' is calculated as the number of hrules there should be, and > is simply: > > <class name="hrule" extends="view" x="0" height="1" /> > > for some reason I can't understand, the this.addSubview call seems to > add the > hrule to the canvas, rather than the view that contains the layout. > This means > that if I move the view away from x=0, y=0, the lines don't shift with > it. How > can I make the layout add things to the view? > > Robin. _______________________________________________ Laszlo-user mailing list [email protected] http://www.openlaszlo.org/mailman/listinfo/laszlo-user
