How to get OnMouseOver Event on DIV Element

2,302 views
Skip to first unread message

Chad

unread,
Apr 11, 2010, 11:23:44 PM4/11/10
to Google Web Toolkit
I have a custom widget that extends SimplePanel. This widget consists
of a few extra DIV tags and for one I would like to receive the
onmouseover and onmouseout events. What is the proper method for
getting these events for a specific DOM element within a custom
Widget?

Thanks,
-- Chad

Subhrajyoti Moitra

unread,
Apr 11, 2010, 11:34:56 PM4/11/10
to google-we...@googlegroups.com
extends MouseOutHandler and MouseOverHandler in your widget.
implement the necessary methods.

Subhro.



--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
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.


myapplicationquestions

unread,
Apr 12, 2010, 9:47:21 AM4/12/10
to Google Web Toolkit
I also have the same issue where the mouseover is not getting
reisgtered in a div added via an HTML widget. I am trying to listen to
mouseover using the native preview handler.

FYI: This works in GWT 1.7.1 but once i upgrade to GWT 2.0 it stops
working.. anyone has seen this happening?

On Apr 11, 11:34 pm, Subhrajyoti Moitra <subhrajyo...@gmail.com>
wrote:


> extends MouseOutHandler and MouseOverHandler in your widget.
> implement the necessary methods.
>
> Subhro.
>
>
>
> On Mon, Apr 12, 2010 at 8:53 AM, Chad <cha...@sbcglobal.net> wrote:
> > I have a custom widget that extends SimplePanel. This widget consists
> > of a few extra DIV tags and for one I would like to receive the
> > onmouseover and onmouseout events. What is the proper method for
> > getting these events for a specific DOM element within a custom
> > Widget?
>
> > Thanks,
> > -- Chad
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Google Web Toolkit" group.
> > 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<google-web-toolkit%2Bunsubs­cr...@googlegroups.com>


> > .
> > For more options, visit this group at

> >http://groups.google.com/group/google-web-toolkit?hl=en.- Hide quoted text -
>
> - Show quoted text -

Trevor Skaife

unread,
Apr 12, 2010, 11:44:54 AM4/12/10
to Google Web Toolkit
Here is an example of a FlowPanel that I added some handlers to...

public class FlowPanelMouse extends FlowPanel implements
HasMouseOverHandlers, HasMouseOutHandlers, HasClickHandlers
{

public HandlerRegistration addMouseOverHandler(MouseOverHandler
handler)
{
return addDomHandler(handler, MouseOverEvent.getType());
}

public HandlerRegistration addMouseOutHandler(MouseOutHandler
handler)
{
return addDomHandler(handler, MouseOutEvent.getType());
}

public HandlerRegistration addClickHandler(ClickHandler handler)
{
return addDomHandler(handler, ClickEvent.getType());
}

}

On Apr 12, 8:47 am, myapplicationquestions <parag.bhag...@cgi.com>
wrote:

> > >http://groups.google.com/group/google-web-toolkit?hl=en.-Hide quoted text -

Subhrajyoti Moitra

unread,
Apr 12, 2010, 11:54:50 AM4/12/10
to google-we...@googlegroups.com
yes one way is the one mentioned below. heres how i am doing it a particular case.

public class UserListRow extends Composite implements MouseOverHandler,MouseOutHandler {
public interface UserListRowBinder extends UiBinder<Widget, UserListRow>{
}
public UserListRow() {
initWidget(binder.createAndBindUi(this));
addDomHandler(this, MouseOverEvent.getType());
addDomHandler(this, MouseOutEvent.getType());
}

}

Now any other widget can include this widget and add mouseout/over handlers to it.

this is working on GWT 2.0.3 on IE6/FF3.5.x/Chrome. Didnt check for safari/opera.

HTH

Thanks,
Subhro.


To unsubscribe from this group, send email to google-web-tool...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages