That click stuff is more complicated than that. I found it when I was struggling with
DynAPi X a while ago. If you remember, the button example did not fire click events
over the "this button grows when clicked" text.

It is not Sn not firing onclick events. It does most of the times. However, if any of
the the two previous events ( mousedown + mouseup ) are cancelled ( via
cancelBrowserEvent, I'm not talking bubbling ) the onclick is not generated. I makes
sense since the browser expects a mousedown and then a mouseup in order to generate a
click, and since one of them did not reach the browser, the click is not triggered.

The sollution to this ? I think setting the mouseup to be a click is wrong ( we loose
the mouseup event ) and simply triggering a mouseclick on each mouseup is wrong as
well, because if no events were cancelled we will get a native click and that would
give us two of them.

I don't know if this can be solved from the core in an effective way. We could keep
track of mousedown and mouseups cancellations and then, if a afetr a mouseup we have
our 'cancelled' flags to true, generate the 'click' event.

If you look at the label.js, I manually generated a new event because I knew label was
cancelling events in order to avoid selection.

By the way, you can pass an event to the constructor of MouseEvent in order to copy it.

invokeEvent(currentMouseUpEvent)

if( haveToSimulateClick) {
    newEvent = new MouseEvent(currentMouseUpEvent)
    newEvent.type = "click"
    invokeEvent(newEvent)
}


I don't have access to the sources now. If anyone wants to implement this go ahead.


_______________________________________________
Dynapi-Dev mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/dynapi-dev

Reply via email to