On 8 avr, 09:37, "vaibhav" <vaibhav....@gmail.com> wrote:
> Hi,
> I want to access the text box written in HTML from GWT on the basis of
> element ID. I am able to get this elemt in GWT and also show that. Even I am
> able to change the text of the text box but I am not able to add the events
> to the element. How to add the event. I have written some bit of code but
> not able to sink the event.
>
> I have extended the text box to add the element
>
> --------------------------------------------------------------------------- --
>
> Public class MarkupTextBox extends TextBox{
>
>  Public MarkupTextBox(String markupTextboxID) {
>
>   This(DOM.getElementById(markupTextboxID));
>  }
>
>  Protected MarkupTextBox(Element element) {
>
>   Super(element);
>  }}
>
> --------------------------------------------------------------------------- --
>
> And then adding listener to it
>
> --------------------------------------------------------------------------- --
> --
> Final MarkupTextBox box = new MarkupTextBox("poctext");
> Box.setText("Hi how are you");
> Box.addClickListener(new ClickListener(){
> Public void onClick(Widget sender) {}});
>
> Box.addChangeListener(new ChangeListener(){
> Public void onChange(Widget sender) {
> Box.setText("Hi how are you");}});
>
> ---------------------------------------------------------------------
>
> May be I making some mistake.

Your widget isn't "attached", so events are actually not sunk. Why not
just use TextBox.wrap(DOM.getElementById(markupTextboxID)) instead of
building your own "MarkupTextBox"?
--~--~---------~--~----~------------~-------~--~----~
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