MouseOverHandler not called for text of Checkbox

112 views
Skip to first unread message

dave

unread,
Nov 5, 2009, 12:34:50 PM11/5/09
to Google Web Toolkit
I've got a GWT Checkbox (created with text label) to which I add a
MouseOverHandler and MouseOutHandler with the goal of doing some
action on hover (and closing when leaving).

The problem is that the OverHandler is only called when hovering over
the actual checkbox square from the top, left, or right. It does not
fire when hovering over the text (or entering the actual checkbox from
the left, when already over the text label).

The MouseOutHandler handles the text label correctly, as it is not
called when moving the mouse from over the textbox to over the text.
It is only fired (correctly) when leaving the text.

What am I missing? There's nothing fancy to my example: just a
Checkbox in a FlowPanel that adds the mouse handlers.

Thanks for any tips!
dave

dave

unread,
Nov 19, 2009, 8:01:23 PM11/19/09
to Google Web Toolkit
First and only time I'll bump this, but I've yet to find a solution.

Adding a MouseOverHandler to the GWT CheckBox widget only fires when
mousing over the checkbox itself from the top, left, or bottom. It
does not fire when mousing over the text label or when moving from
the text over the actual checkbox.

How can I add a MouseOverHandler that will fire when over the label of
a CheckBox?


On Nov 5, 9:34 am, dave <dpdear...@gmail.com> wrote:
> I've got a GWTCheckbox(created with text label) to which I add a
> MouseOverHandler and MouseOutHandler with the goal of doing some
> action on hover (and closing when leaving).
>
> The problem is that the OverHandler is only called when hovering over
> the actualcheckboxsquare from the top, left, or right.  It does not
> fire when hovering over the text (or entering the actualcheckboxfrom
> the left, when already over the text label).
>
> The MouseOutHandler handles the text label correctly, as it is not
> called when moving the mouse from over the textbox to over the text.
> It is only fired (correctly) when leaving the text.
>
> What am I missing?  There's nothing fancy to my example: just aCheckboxin a FlowPanel that adds the mouse handlers.

vaibhav saxena

unread,
Nov 20, 2009, 2:07:08 AM11/20/09
to google-we...@googlegroups.com
Hi,
Why do you not create a composite which will act as the wrapper for the check box and add the mouse handler to the composite. This will solve your problem and you can use that composite anywhere where you need check box in your app.

--

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=.



Thomas Broyer

unread,
Nov 20, 2009, 6:18:50 AM11/20/09
to Google Web Toolkit


On Nov 20, 2:01 am, dave <dpdear...@gmail.com> wrote:
> First and only time I'll bump this, but I've yet to find a solution.
>
> Adding a MouseOverHandler to the GWT CheckBox widget only fires when
> mousing over the checkbox itself from the top, left, or bottom.  It
> does not fire when mousing over the text label or  when moving from
> the text over the actual checkbox.
>
> How can I add a MouseOverHandler that will fire when over the label of
> a CheckBox?

If you ask me, this is a bug in CheckBox (it uses many "hacks" to get
events sunk on the checkbox rather than <span> that encloses both the
checkbox and label, which leads to this behavior and which I'm really
not sure is needed –cannot it take advantage of events bubbling to the
span?–)

In the mean time, you'd have to copy/fix CheckBox (or in other words
create your own).

dave

unread,
Nov 20, 2009, 3:36:10 PM11/20/09
to Google Web Toolkit
Thanks to both of you for the info. I suspected it was an issue with
the CheckBox itself, but wanted to make sure that I wasn't missing
something obvious.

My fix (for now) has just been to manually add my own Label (instead
of using the CheckBox label) and handling mouse over the Label events,
as the CheckBox itself isn't essential.

If I do switch back, your suggestion of a Composite is exactly what
I'll do.
Thanks!
Reply all
Reply to author
Forward
0 new messages