event.stopPropagation()

169 views
Skip to first unread message

Wojtek Mamrak

unread,
Feb 27, 2012, 10:41:02 AM2/27/12
to Google Web Toolkit
Hello group,

I defined a header in my StackLayoutPanel as a composition of few
other components (i.e. text node and label inside an HTMLPanel). When
the label is clicked, I would like to stop the mouseUp event from
bubbling to the header, so that the animation is not generated. I've
been googling for few hours and tested such solutions as [1] and [2],
but with no success.

myLabel.addMouseUpHandler(new MouseUpHandler() {
@Override
public void onMouseUp(MouseUpEvent event) {
event.stopPropagation(); //[1]
DOM.eventCancelBubble(DOM.eventGetCurrentEvent(), true); //[2]
}
});

How to overcome such issue? Thanks for help!

Jens

unread,
Feb 27, 2012, 1:19:25 PM2/27/12
to google-we...@googlegroups.com
Maybe StackLayoutPanel uses ClickEvent/ClickHandler instead of MouseUpEvent/MouseUpHandler (haven't looked into the source, but feel free to do it yourself). If so, you should stop propagation of ClickEvents instead of MouseUpEvents..

-- J.

Wojtek Mamrak

unread,
Feb 27, 2012, 2:00:09 PM2/27/12
to google-we...@googlegroups.com
Yes it does, thank you Jens.

2012/2/27 Jens <jens.ne...@gmail.com>:

> --
> You received this message because you are subscribed to the Google Groups
> "Google Web Toolkit" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/google-web-toolkit/-/YuZ3STQRqqYJ.
> To post to this group, send email to google-we...@googlegroups.com.
> To unsubscribe from this group, send email to
> google-web-tool...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/google-web-toolkit?hl=en.

Reply all
Reply to author
Forward
0 new messages