Widget target = (Widget)event.getSource()

On May 13, 10:02 am, CJ Bilkins <[email protected]> wrote:
> How do I get the target of a clickevent in 2.0?  From what I can tell,
> this is impossible?  But that can't be... so I must just be missing
> something.
>
> I've found:
>
> event.getNativeEvent().getEventTarget()
>
> But I can't seem to get that EventTarget to turn back into my Button.
>
> Here is the scenario:  I have 20 buttons, each one has an ID
> associated with it (I'm using setAttribute... wrong?).  I don't want
> to have to handcode 20 different onClick functions, so I make just
> one.  I want my onClick to fire for all those buttons, and grab the
> associated ID and do something.
>
> Also: In pure javascript, I would achieve this by attaching a single
> event to the parent element of those buttons and catch clicks that
> way.  This doesn't seem possible in gwt?  It looks like I have to add
> a clickhandler to each button individually.  Please correct me if I'm
> wrong.
>
> 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 
> athttp://groups.google.com/group/google-web-toolkit?hl=en.

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