How to make label auto click

58 views
Skip to first unread message

Deepak Singh

unread,
Apr 3, 2012, 1:57:42 PM4/3/12
to google-we...@googlegroups.com
Hi,

I have wrapped a div into Label. Added clickhandler to label.
Now i want that at some point of time, this label should be autoclicked but we dont have anything like click() method for label as we have for button.click().

So how can i achieve this ?

Thanks
Deepak Singh

Hilco Wijbenga

unread,
Apr 3, 2012, 3:00:51 PM4/3/12
to google-we...@googlegroups.com
On 3 April 2012 10:57, Deepak Singh <deepaks...@gmail.com> wrote:
> I have wrapped a div into Label. Added clickhandler to label.

Why? If you want to use a container, then I would suggest SimplePanel
or FlowPanel. I would keep Labels for displaying simple text.

> Now i want that at some point of time, this label should be autoclicked but
> we dont have anything like click() method for label as we have for
> button.click().

Why not simply call the corresponding onClick (or what ever you called
it) method directly? GWT doesn't really support programmatically
creating browser events.

Boris_siroB

unread,
Apr 3, 2012, 3:38:13 PM4/3/12
to google-we...@googlegroups.com

GWT doesn't really support programmatically creating browser events.

Not quite true. See this SO post.

Deepak Singh

unread,
Apr 3, 2012, 3:44:34 PM4/3/12
to google-we...@googlegroups.com
No probs. I solved my prob by changing Div to HtmlPanel.

Thanks for your support.

On Wed, Apr 4, 2012 at 1:08 AM, Boris_siroB <boris....@gmail.com> wrote:

GWT doesn't really support programmatically creating browser events.

Not quite true. See this SO post.

--
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/-/p9U0rHL7pC8J.

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.



--
Deepak Singh

Hilco Wijbenga

unread,
Apr 3, 2012, 3:45:14 PM4/3/12
to google-we...@googlegroups.com
On 3 April 2012 12:38, Boris_siroB <boris....@gmail.com> wrote:
>> GWT doesn't really support programmatically creating browser events.
>
> Not quite true. See this SO post.

I wrote "doesn't really", not "doesn't". :-) Still, all this mucking
about in the DOM is very hard to (unit) test. In most cases, creating
these events yourself is an anti-pattern. So possible but not
advisable (in general).

Reply all
Reply to author
Forward
0 new messages