Hi Rahul,
This code snippet might help:

  public void onModuleLoad() {
    TextBoxPanel v2 = new TextBoxPanel();
    RootPanel.get().add(v2);
  }

public class TextBoxPanel extends Composite implements ClickHandler {
  private VerticalPanel v2 = new VerticalPanel();
  private TextBox[] t1 = new TextBox[10];

  public TextBoxPanel() {
    for (int i = 0; i < t1.length; i++) {
      t1[i] = new TextBox();
      t1[i].addClickHandler(this);
      t1[i].setName("TextBox" + i);
      v2.add(t1[i]);
    }
    initWidget(v2);
  }

  @Override
  public void onClick(ClickEvent event) {
    Object source = event.getSource();
    if (source instanceof TextBox) {
      Window.alert(((TextBox) source).getName());
    }
  }
}

Hope that helps,
-Sumit Chandel

On Tue, Jul 28, 2009 at 7:50 AM, Rahul <coolrahul18...@gmail.com> wrote:

>
> Hi
> I am defining an vertical panel with 10 textboxes. like this :
> VerticalPanel v2 = new VerticalPanel();
> TextBox [] t1 = new TextBox[10];
>                for (i=0;i<10;i++)
>                {
>                        t1[i] = new TextBox();
>                        v2.add(t1[i]);
>                }
>
> now i want to have a mouse click event that shows a text on the
> textbox it clicks on. I register my mousedownhandler with the vertical
> panel v2. now how would i get the individual textbox from the vertical
> panel i clicked my mouse on?is there a way to get index of the textbox
> on which i clicked on?
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
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-Web-Toolkit@googlegroups.com
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to