Oh I see, what I meant was if this was your code in the html:
<input type="text" value="" id="my_textbox">
in the GWT entry point class,
place a button beside that textbox and add a Click Handler
Button button = new Button("click here");
button.addClickHandler(new ButtonClickHandler());
RootPanel.get().add(button);
public class ButtonClickHandler implements ClickHandler(){
public void onClick(ClickEvent e){
String textInInputBox =
RootPanel.get("my_textbox").getElement().getAttribute("value");
RootPanel.get().add(new Label(StringInInputBox));
}
}
Notice that in the click handler I try to retrieve the contents of your
input box by getting it by its Id using
RootPanel<http://google-web-toolkit.googlecode.com/svn/javadoc/1.6/com/google/gwt/user/client/ui/RootPanel.html>.
You can also use the
DOM<http://google-web-toolkit.googlecode.com/svn/javadoc/1.6/com/google/gwt/user/client/DOM.html>class
to do this if that doesn't work.
Best,
Jeune
http://jeungun.wordpress.com
On Mon, Nov 30, 2009 at 10:03 AM, loveley <[email protected]> wrote:
> hi,
> ok, but how to "Back in GWT, retrieve the contents of the text box"?
> what is the statement?
>
> olivier.
>
> Jose Luis Roberto Asuncion a écrit :
> > Hi, the hidden input box is coded in the HTML page generated from GWT.
> > But it's not what you need.
> >
> > You need a textbox where you want to input something. So put it in the
> > HTML page and give it an id.
> >
> > Back in GWT, retrieve the contents of the text box and then make a new
> > panel, put the contents of the text box there and then add it to the
> > root panel.
> >
> > - Jeune
> > http://jeungun.wordpress.com
> >
> >
> > On Mon, Nov 30, 2009 at 3:19 AM, loveley <[email protected]
> > <mailto:[email protected]>> wrote:
> >
> > hello,
> >
> > thank you, but I did not really understand what you mean. the hidden
> > input box , it's an HTML component or is it coded in GWT?and if it
> > is in
> > GWT, is it an an other root panel?
> >
> > olivier.
> >
> > Jeune a écrit :
> > > Just reading your question, I think it's possible. I am doing
> > > something similar right now.
> > > I put values in a hidden input box with an id and then I add a
> click
> > > handler to a button in a panel. When I click the button it gets the
> > > values in the hidden input box and displays them in the panel.
> > >
> > >
> > > On Nov 27, 12:18 am, loveley <[email protected]
> > <mailto:[email protected]>> wrote:
> > >
> > >> hi,
> > >>
> > >> I think I found a method to have some GWT components on a HTML
> > page,
> > >> nothing miraculous : I create the components in eclipse, assign
> > them to
> > >> a RootPanel.get("truc"); and in the HTML page generated by
> > eclipse I add
> > >> a div with the id="truc".
> > >> If I want to modify the HTML page I only have to keep the
> > script tag and
> > >> the id I mentioned above.
> > >>
> > >> but I have a question : is there a way to make two components (ie
> > >> identified by its rootPanel) communicate, in the java code and
> > in a way
> > >> that e.g. in a first component I enter in a textBox a string
> > "abc", I
> > >> click on a button in this component, and immediately the second
> > >> component's label has as text the content of the textBox?
> > >>
> > >> thank you,
> > >>
> > >> olivier.
> > >>
> > >>
> >
> ___________________________________________________________________________
> > >> Yahoo! Mail r invente le mail ! D couvrez le nouveau Yahoo!
> > Mail et son interface r volutionnaire.http://fr.mail.yahoo.com
> > >>
> > >
> > > --
> > >
> > > 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]
> > <mailto:[email protected]>.
> > > To unsubscribe from this group, send email to
> >
> > [email protected]<google-web-toolkit%[email protected]>
> >
> > <mailto:google-web-toolkit%[email protected]<google-web-toolkit%[email protected]>
> >.
> > > For more options, visit this group at
> > http://groups.google.com/group/google-web-toolkit?hl=en.
> > >
> > >
> > >
> > >
> >
> >
> >
> >
> >
> >
> ___________________________________________________________________________
> > Yahoo! Mail réinvente le mail ! Découvrez le nouveau Yahoo! Mail
> > et son interface révolutionnaire.
> > http://fr.mail.yahoo.com
> >
> > --
> >
> > 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]
> > <mailto:[email protected]>.
> > To unsubscribe from this group, send email to
> >
> > [email protected]<google-web-toolkit%[email protected]>
> >
> > <mailto:google-web-toolkit%[email protected]<google-web-toolkit%[email protected]>
> >.
> > 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 [email protected]
> .
> > To unsubscribe from this group, send email to
> > [email protected]<google-web-toolkit%[email protected]>
> .
> > For more options, visit this group at
> > http://groups.google.com/group/google-web-toolkit?hl=en.
>
>
>
>
>
> ___________________________________________________________________________
> Yahoo! Mail réinvente le mail ! Découvrez le nouveau Yahoo! Mail et son
> interface révolutionnaire.
> http://fr.mail.yahoo.com
>
> --
>
> 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]<google-web-toolkit%[email protected]>
> .
> 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 [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.