Wednesday, November 28, 2012

Re: Textarea KeyUpHandler not working

On Wednesday, November 28, 2012 1:40:18 PM UTC+1, marco wrote:
Ok I fixed it, with the following changes

-public class ValidatableTextarea extends ComplexPanel
+public class ValidatableTextarea extends FlowPanel
-   private FlowPanel rootPanel;
    protected TextArea input;
    private Label errorLabel;

    public ValidatableTextarea() { 
        input = new TextArea(); 
-       rootPanel = new FlowPanel(); 
-       rootPanel.add(input); 
+       add(input)

-       setElement(rootPanel.getElement()); 
    public void setText(String text) { 
        input.setText(String Text); 

    public void addKeyUpHandler(KeyUpHandler keyUpHandler) { 

Don't know why but it's working now.

I know why: setElement() is only meant to be used when you create your own Widget, not when you extend an existing one. The root of your problem was actually using rootPanel;getElement() as the element for another widget, yet adding widgets to rootPanel (which is never attached to the DOM: its element is "physically" attached, by way of the ValidatableTextArea, but the FlowPanel itself is not "logically" attached.

Now, instead of extending FlowPanel, you should extend Composite instead, and use a FlowPanel with setWidget (more or less reverting to your previous code, fixing it: ComplexPanel→Composite, setElement→setWidget)

You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To view this discussion on the web visit
To post to this group, send email to
To unsubscribe from this group, send email to
For more options, visit this group at

No comments:

Post a Comment