TextArea Widget - strange cursor behavior

Hello,

In the attached example, a widget is implemented to fill in a text area with the word selcted in the combobox. I was puzzled by the cursor control for several days and without any solution:

  1. When invoke getCursorPos() at the 1st time, it returns a magic number instead of zero (no text in the text area).
  2. Press key TAB to focus the text area, the cursor always moves to the end of text.
  3. Press CTRL-Z to undo “insert”, the cursor moves to the end of text.
  4. Press F5 to fresh the page, the cursor moves to an irregular position, and insert a word into the text area.
  5. After press F5 and move the cursor to the end of the text, new word will inserted into the string, but 2 characters ahead.
  6. If the text area is initialized, the cursor also is out of control.

Is there any expert could give me some suggestions? Thanks in advance.

The project is developed with GWT and following libraries are not included in the folder \mywidget\war\WEB-INF\lib:
appengine-api-1.0-sdk-1.3.4.jar
appengine-api-labs-1.3.4.jar
appengine-jsr107cache-1.3.4.jar
datanucleus-appengine-1.0.7.final.jar
datanucleus-core-1.1.5.jar
datanucleus-jpa-1.1.5.jar
geronimo-jpa_3.0_spec-1.1.1.jar
geronimo-jta_1.1_spec-1.1.1.jar
gwt-servlet.jar
jdo2-api-2.3-eb.jar
jsr107cache-1.1.jar
vaadin-6.3.4.jar

Best Regards,
Watt
11382.zip (1.88 MB)

Hello Sami Ekblad,

My widget works as your Add-on AutoCompleteTextField, I wonder it is possible for you to look at my sample attached and then give me some suggestions.

Thanks,
Watt