[Laszlo-user] horizontal rule between components

Robin robin at kallisti.net.nz
Mon Apr 10 23:58:54 EDT 2006


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.


More information about the Laszlo-user mailing list