Theres no automatic way to do this. What you would need to do is:

Add a KeyboardListener to the TextArea and in onKeyDown look for the number of 
lines in the TextArea's content (plus one if the key is KEY_ENTER). Use 
TextArea.setVisibleLines to make sure that the size of the TextArea is >= the 
number of lines in it's content.

Something like:

final TextArea text = new TextArea();

text.addKeyboardListener(new KeyboardListenerAdapter() {
        public void onKeyDown(Widget sender, char keyCode, int mods) {
                int lines = 0;
                final String content = text.getText();
                
                for(int i = 0; i != -1; i = content.indexOf("\n", i + 1)) {
                        lines++;
                }
                
                if(keyCode == KEY_ENTER) {
                        lines++;
                }
                
                if(text.getVisibleLines() < lines) {
                        text.setVisibleLines(lines);
                }
        }
});


Should do the trick.

sri wrote:
> Hello,
> I'm new to GWT. Is there a way to NOT have a scrollbar for the
> TextArea and have it grow automatically when data goes beyond the
> visible lines? We do not use gwt-ext. I was able to take the scrollbar
> out with overflow:hidden but was not able to do the autosize part.
> 
> Thanks in advance for any help.
> 
> -sri
> 
> > 
> 


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to