[Laszlo-dev] I really thought I understood classroot, but I was wrong
Henry Minsky
henry.minsky at gmail.com
Tue Jan 30 10:14:06 PST 2007
classroot is bound in all the children, but it's not bound in the root
instance.
So, you could do
<canvas debug="true">
<class name="myclass">
<attribute name="button_label" type="text" value="button"/>
<handler name="onclick">
this.handleclick()
</handler>
<method name="handleclick">
Debug.write("this = " + this);
</method>
<button name="b1" text="${parent.button_label}"
onclick="Debug.write('classroot
= ' + classroot); parent.handleclick()" />
</class>
<class name="another_class" extends="myclass"/>
<myclass id="foo">
<another_class id="bar" button_label ="another button" y="25">
<method name="handleclick">
Debug.write("this = " + this);
</method>
</another_class>
</myclass>
</canvas>
On 1/30/07, John Sundman <jsundman at laszlosystems.com> wrote:
>
> Why does clicking on the child button report that classroot is null?
> How do I get it to show a real classroot?
>
> <canvas debug="true">
> <class name="myclass">
> <attribute name="button_label" type="text" value="button"/>
> <handler name="onclick">
> this.handleclick()
> </handler>
>
> <method name="handleclick">
> Debug.write("this = " + this);
> Debug.write("classroot= " + classroot);
> </method>
> <button text="${parent.button_label}" onclick="parent.handleclick
> ()" />
> </class>
>
> <class name="another_class" extends="myclass"/>
>
> <myclass>
> <another_class button_label ="another button" y="25">
> <method name="handleclick">
> Debug.write("this = " + this);
> Debug.write("another_class classroot= " + classroot);
> </method>
> </another_class>
> </myclass>
> </canvas>
>
> Thanks,
>
> jrs
>
--
Henry Minsky
Software Architect
hminsky at laszlosystems.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.openlaszlo.org/pipermail/laszlo-dev/attachments/20070130/3587d0c3/attachment.html
More information about the Laszlo-dev
mailing list