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/thread/44f7b52732af5047/022af186c9626484

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 at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to