Friday, December 21, 2012

Re: gwt show value of texbox

You should read the value from TextBox after button is clicked:

public void onModuleLoad() {
        final TextBox textValue = new TextBox();
 
        Button button = new Button("button", new ClickHandler() {
              public void onClick(ClickEvent event) {
                 
                  Window.alert("You selected: " + textValue.getValue());

                }
              });

         RootPanel.get().add(textValue);
         RootPanel.get().add(button);

    }
}


On Fri, Dec 21, 2012 at 6:11 AM, vector <ector1984@gmail.com> wrote:
   
i need to show the value inserted into texbox i create this code

public void onModuleLoad() {
         TextBox textValue = new TextBox();
         textValue.getSelectedText();
        final String index = textValue.getValue().toString();


         Button button = new Button("button", new ClickHandler() {
              public void onClick(ClickEvent event) {
                 
                  Window.alert("You selected: " + index);

                }
              });

         RootPanel.get().add(textValue);
         RootPanel.get().add(button);

    }
}

but into window not appears the value

can help me?


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

No comments:

Post a Comment