The way events are declared and handled is changing:

http://wiki.openlaszlo.org/Event_and_handler_tags

In the current syntax, if you want to have overriding or combining of handlers, in the class you need to say:

  <method event="ondate" name="ondatehandler"> ... </method>

and in your subclass:

  <method name="ondatehandler">
    super();
    ...
  </method>

In the new syntax, you will be more explicit in the class:

  <handler name="ondate" method="ondatehandler" />

  <method name="ondatehandler"> ... </method>

the subclass would stay the same.

I'd be interested to know if you find the new syntax more intuitive?


On 28 Dec 2005, at 10:11, Mathieu Guillaume wrote:


What happens when you declare methods event="onstuff" in a class and in its subclass? I see they're both called, and I seem to remember I saw something about this in the doc, but I can't find it again.
Is there anything set about the order in which the methods are called?

In my case, I'm trying to make a somewhat reuseable calendar class (which uses event="ondate"), and extend it in my application. The extended class would also use event="ondate", but I need variables that are set in the superclass's ondate. Am I guaranteed that the superclass's ondate will execute first, or should I find another way to do it?



I tried to do it with generating a different event that said "hey, I'm updated" in the superclass and catch it in my extended classes, but it didn't work:

<class name="calendar">
<attribute name="date"/>
<method event="oninit">
        this.del=new LzDelegate(this,"oncalupdate");
        this.del.register(this,"calupdate");
</method>
<method event="ondate">
        <!-- lots of stuff -->
        this.calupdate.sendEvent();
</method>
</class>

<class name="extendedcal" extends="calendar">
<method event="oncalupdate">
        Debug.write("Event: calupdate");
</method>
</class>

but I never got anything in the extendedcal instances, so I suppose there's something I didn't understand in the way events+delegates work.

--
Mathieu Guillaume <[EMAIL PROTECTED]>
_______________________________________________
Laszlo-user mailing list
[email protected]
http://www.openlaszlo.org/mailman/listinfo/laszlo-user

_______________________________________________
Laszlo-user mailing list
[email protected]
http://www.openlaszlo.org/mailman/listinfo/laszlo-user

Reply via email to