Positioning things in a textarea is at least close to impossible...
thats why I started my project http://code.google.com/p/axedarea/
first place, it is useable to a certain degree, but you yet won't find
you being truely happy with it, as especially on the WYSIWYG quite
some front stuff is missing. As pure Texteditor with a lot of
additional awareness (like size, where each line/letter is positioned,
copy/paste events, keyboard events) it works already quite nice... And
AFAIK it has currently the best online VIM emulation avialable.

On Aug 26, 8:49 pm, Folke <[EMAIL PROTECTED]> wrote:
> You can simply adjust the "height" until "scrollHeight" is equals to
> "clientHeight".
> The problem is that you cannot use this to shrink the TextArea
> automatically. In this case you would have to set the height to
> something very low, like 10px, and then check scrollHeight and
> readjust "height" again.
>
> On 26 Aug., 11:59, "jakob.korherr" <[EMAIL PROTECTED]> wrote:
>
> > I'm afraid it is not that easy. You can not just count the '\n's in
> > the text, because you also have to look at the length of each line. As
> > we all know if the line is longer than the width of the textarea, it
> > will display the new words in a new line automatically and without a
> > '\n'.
>
> > So you have to:
>
> > 1) count the '\n's in the text
> > 2) take a look at the length of every line and find out how often it
> > is broken automatically (maybe with scrollWidth - I don't know..)
>
> > On Aug 25, 10:31 am, Jason Morris <[EMAIL PROTECTED]> wrote:
>
> > > 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 Google-Web-Toolkit@googlegroups.com
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