If I could simply getCursorPos() in my RichTextArea according to the
text displayed (getText()), then I could use space boundaries between
words to discover the word that is being changed, and use simple
String replace methods to affect the HTML. But I really don't mind
knowing a position according to the HTML either! Pardon my ignorance,
but do you actually have the methods for me to do this with my
RichTextArea?

But for me this is really all about the fact that any editing of the
text by the user (e.g. adding/deleting a character) happens AFTER the
keypress/keydown events are fired, so I cannot know WHAT the resulting
String will be!! This is crazy, and that's what necessitates me to
know the cursorPos, so that I can add the character being added/
deleted (which is told to me by the keypress event) in its PROSPECTIVE
position (which, again, I have no way of knowing!!).

So, for the time being, how do I do a time delayed function in GWT
i.e. what's the equivalent of JavaScript's "setInterval" in GWT? So
that I can grab the new and old Strings and compare them to know at
which cursor position I am.

Regards,
N

On Apr 26, 4:26 pm, kozura <[email protected]> wrote:
> Sure, those sorts of functionality are what this covers, but it's not
> terribly useful for what you're saying to get the cursor relative to
> the basic getText() string.  Sure, you can check the words in the
> string, but how do you then change the actual DOM document without
> affecting other markup?  With my API, you get the actual DOM Text
> element that the selection is in, from which you can get the text of
> the word the user is on or moved from, and surgically make changes
> like surround a word with color style tags.
>
> But maybe a good and simple addition to the API would be a function to
> expand a range forward and/or backwards to (user-defined) word
> boundaries.  Then you could get the cursor, expand to get the word it
> encompasses, getText() of the word (without tags) to do your spell
> checking etc, then either surround() it with the color tags you want
> or replace it with the correct spelling.  I think I will add this!
>
> The rest of the API is spelled out 
> here:http://groups.google.com/group/google-web-toolkit/browse_thread/threa...
>
> jk
>
> On Apr 26, 8:27 am, Navigateur <[email protected]> wrote:
>
> > Oh I have a real need for this. I want certain words to be re-checked
> > against a dictionary when they are edited by the user. This would mean
> > knowing which word is currently being edited and which character is
> > currently being typed or deleted, so for this I would need to know the
> > cursor position (corresponding to the charAt position in the getText()
> > String). Also, to set the colour of that word when the cursor is moved
> > away from it (also needing the cursor position).
>
> --
> 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 
> athttp://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.

Reply via email to