Terrence,

In openlaszlo, parent refers to the parent node in the openlaszlo "dom," not
to the parent class of the object. Therefore, in your example below, the
call to parent in the <view bgcolor="yellow"... > tag refers to the node
created by the <class name="borderedbox" ...> tag.

Hope that clears it up.

David

On Wed, Apr 6, 2011 at 10:53 AM, Terrence Brannon <[email protected]>wrote:

> In the "Laszlo in 10 minutes"/Object-Oriented/Attribute section (
> http://bit.ly/gomk4w ) the child class refers to the attribute .bordersize
> in its *parent* even though the attribute is only defined for the child...
> how can this work?
>
> Source code follows:
> <canvas>
>   <simplelayout spacing="5"/>
>
>   <class name="box" height="100" width="100" bgcolor="red"/>
>
>   <class name="borderedbox" extends="box">
>     <attribute name="bordersize" value="3"/>
>     <view bgcolor="yellow"
>           x="${parent.bordersize}"
>           y="${parent.bordersize}"
>           width="${parent.width - parent.bordersize*2}"
>           height="${parent.height - parent.bordersize*2}"/>
>   </class>
>
>   <borderedbox/>
>   <borderedbox bordersize="6"/>
>   <borderedbox bordersize="9"/>
> </canvas>
>
>

Reply via email to