P T Withington wrote:
On 2009-04-28, at 12:59EDT, André Bargull wrote:

On 4/28/2009 6:02 PM, P T Withington wrote:
On 2009-04-28, at 09:21EDT, André Bargull wrote:
[...]
We don't want to scan the text everytime to detect a hyperlink. That's why we implemented the workaround at LPP-7551. Maybe we could re-use the notifying event mechanism Tucker used recently. But that means hyperlinks aren't active and aren't displayed as clickable in swf9, until a listener for ontextlink is installed..
I guess I had better make notifying events generic! :)
Here's my proposal.  Add a method to:
LzDeclaredEventClass {
 function actualEventClass() { return LzEvent; }
}
You would subclass this class and create a singleton that you would initialize your events to (instead of LzDeclaredEvent) if you want your actual event class to be something different (like a subclass of LzEvent).

This requires you to write two classes for each special event type: One subclass of LzDeclaredEventClass and one subclass of LzEvent.
Can this be optimized in some way?


Yes.  Silly of me not to think of this the first time around:

class LzDeclaredEventClass {
  var actual;

  function LzDeclaredEventClass(actual=LzEvent) {
    this.actual = actual;
  }

  function actualEventClass() { return this.actual; }
}

So all you have to do is make your own declared event instance to initialize your event to, you don't have to make a separate class.

How would this work in declarative syntax?

--
Regards,
Max Carlson
OpenLaszlo.org

Reply via email to