On Feb 14, 9:58 am, Thomas Broyer <[email protected]> wrote:
> I don't have time to try it out with GWT, sorry, but just to add some input
> to the possible issue: mouseover and mouseout events bubble, so if your
> mouse enters a child element of the B widget's root element, the event will
> bubble up to B's root element. GWT filters those events out in
> Widget#onBrowserEvent's default implementation to somehow mimic IE's (and
> now HTML5's / DOM3 Events') mouseenter and mouseleave 
> events:http://code.google.com/p/google-web-toolkit/source/browse/trunk/user/...

 thomas, hi, thanks for pointing this out.  what we had was using
DOM.eventGetFromElement for mouseover, whereas the code in GWT uses
eventGetToElement.

 i've modified the equivalent pyjamas code to this:

    elif etype == "mouseover":
        to_element = DOM.eventGetToElement(event)
        if to_element and not DOM.isOrHasChild(sender.getElement(),
to_element):
            for listener in listeners:
                listener.onMouseEnter(sender)
        return True
    elif etype == "mouseout":
        to_element = DOM.eventGetToElement(event)
        if to_element and not DOM.isOrHasChild(sender.getElement(),
to_element):
            for listener in listeners:
                listener.onMouseLeave(sender)
        return True
    return False

where it is this in java:

 public void onBrowserEvent(Event event) {
    switch (DOM.eventGetType(event)) {
      case Event.ONMOUSEOVER:
        // Only fire the mouse over event if it's coming from outside
this
        // widget.
      case Event.ONMOUSEOUT:
        // Only fire the mouse out event if it's leaving this
        // widget.
        Element related = event.getRelatedEventTarget().cast();
        if (related != null && getElement().isOrHasChild(related)) {
          return;
        }
        break;
    }
    DomEvent.fireNativeEvent(event, this, this.getElement());
  }

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to