I do something similar with other events, so I would imagine it should
work the same way. I have a class extending Composite that contains,
among other things, a button. When that button is clicked, a
CloseEvent is raised by the class. This is accomplished by having my
class (extending Composite) implement ClickHandler (to receive the
button clicks) and HasCloseHandlers<Boolean> (so other classes can
receive the CloseEvent being raised). In my onClick method, I issue a
statement like this (this statement exactly to be precise):

    CloseEvent.fire(this, true);

I also do something similar with ValueChangeHandler and
HasValueChangeHandlers to allow this class to raise ValueChangeEvent
caused by internal controls. In your case, you will need to create a
ClickEvent with the class as the source and fire it.

HTH,
Chad

On Jun 2, 3:47 am, romant <[email protected]> wrote:
> Hi men,
> I am trying to implement my own Composite named MenuItem composing of
> a Grid with 3 cells next to each other and a Label placed in the
> middle cell. I call initWidget(the Grid).
>
> The issue now is that I register a click handler for the Label which
> should determine if the MenuItem was clicked or not. The Grid should
> not react on clicks, thus I do not register click handler for it.
>
> Now, naturally, the source of the click event will be always the
> Label. But in my application I need to get as the source of the event
> the MenuItem object, not the Label which composes just a part of the
> MenuItem Composite.
>
> Is there any smooth way to do that? My only idea is not to extend
> Composite class, but the Label itself and add it in a Grid. Is this a
> correct solution?
>
> Thanks.
--~--~---------~--~----~------------~-------~--~----~
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