It works actually. I just tried it :) What's the error you're getting? Hm, while I haven't played much with the event handlers in GWT yet, I think a better approach might be to implement the ClickHandler interface and attach the same object to all the buttons rather than creating new objects for an array of buttons.
-neha "nay-ha" On Tue, Jul 21, 2009 at 10:46 PM, stymie <[email protected]> wrote: > Anyone? Please help if you're able. > Thanks > > On Jul 16, 7:44 pm, stymie <[email protected]> wrote: > > The following code does not work, what am I doing wrong?I have an > > array of buttons named myButtons. > > Thanks > > > > for(int i=0;i<2;i++){ > > myButtons[i].addClickHandler(new ClickHandler(){ > > @Override > > public void onClick(ClickEvent event) { > > > > > if(event.getSource().equals(clickMeButton)) > > { > > Window.alert("works"); > > } > > > if(event.getSource().equals(clickMe2)){ > > Window.alert("works2"); > > } > > } > > }); > > } > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
