Issue:
The problem we have here, is that secondary inheritance isn't working well.
We have two scrollpanes here, only the first one has an eventlistener, but both return events.
The problem arises because scrollpane inherits from viewport, which inherits from dynlayer.
More info:
Basically any widget that does not inherit directly from DynLayer can not be
used more than once on a single page, unless you only want one EventListener
for the whole lot (very unlikely).
If you try to create multiple EventListeners (i.e. one for each widget of a
class not derived directly from DynLayers), only the last EventListener
assigned to one of this second generation widgets will fire. And it will
fire on all widgets that are instances of the same class.
I have been mainly working with the ButtonImage class derived from DynImage,
but I believe this will affect List, PushPanel and any other second
generation widget.
Seeing that this problem has been around for some time, I imagine the
solution will require a lot of work. A temporary solution would be to
rewrite any second generation widget to inherit directly from DynLayer and
including any other inherited functions from it's former parent. I realize
this is redundant and counter to OOP, but at least we would have complex
widgets that work. There is no point in streamlining the core for
performance if the core is broken. This would be a relatively simple fix.
And could be reversed easily once the event model is fixed. This would also
not require changes in code implementing these widgets, thus have little
effect on users other than performance due to redundancy.
The other solution is to fix the problem in the event model. This will take
longer, but should be top priority. The whole purpose of DynAPI is to have
complex widgets, and a common API. For simple widgets anyone can create
simple JavaScript that has less overhead than DynAPI. Therefore this bug
undermines the purpose of DynAPI.
We did not have this bug in 2.0. What has changed so drastically since 2.0
in the event model or in other parts of the core that introduced this bug?
Update 4/Nov/2001 :
As of now this issue seems to have been resolved, thanks to the changes to dynapi.js
and listeners.js as suggested by Joachim Lundgren.
These changes have been commented, so they can be reversed if they have any
negative influence on anything else.