Sunday, November 27, 2011

about input event of NpTextBox

GWT version:2.3.0
background:
there is a variable : " NpTextBox createTxt "
there is a button, by default thisButton.setEnabled(false).

what logic I want :
when user put something into createTxt. I will "
thisButton.setEnabled(true)."

user may type or middle click the mouse to paste something into
createTxt.

my question is :

what event type I should handle to implement my logic especially
when user middle click mouse :

I do some test as below :


I add 4 handlers of 'Click', 'MouseDown', 'MouseUp', and 'MouseOver'
event .

I add System.out.println(). on some lines for test and got below
output .(because
eclipse beakpoints on these lines in GWT debug mode not always work.)

I copy a string "projectname" then I move my mouse to the createTxt on
the Web UI page and click middle button of mouse twice and find output
as below .


...
-----------MouseOver--------------
----------createTxt.getAbsoluteLeft(): [0]-------------
----------createTxt.getValue(): []-------------
----------createTxt.getText(): []-------------
-----------MouseDown--------------
----------createTxt.getAbsoluteLeft(): [0]-------------
----------createTxt.getValue(): []-------------
----------createTxt.getText(): []-------------
-----------MouseUp--------------
----------createTxt.getAbsoluteLeft(): [0]-------------
----------createTxt.getValue(): []-------------
----------createTxt.getText(): []-------------
-----------MouseClick--------------
----------createTxt.getAbsoluteLeft(): [0]-------------
----------createTxt.getValue(): []-------------
----------createTxt.getText(): []-------------

[ reminder : here is the place that fist click is done ]

-----------MouseDown--------------
----------createTxt.getAbsoluteLeft(): [22]-------------
----------createTxt.getValue(): [projectnameprojectname]-------------
----------createTxt.getText(): [projectnameprojectname]-------------
-----------MouseUp--------------
----------createTxt.getAbsoluteLeft(): [22]-------------
----------createTxt.getValue(): [projectnameprojectname]-------------
----------createTxt.getText(): [projectnameprojectname]-------------
-----------MouseClick--------------
----------createTxt.getAbsoluteLeft(): [22]-------------
----------createTxt.getValue(): [projectnameprojectname]-------------
----------createTxt.getText(): [projectnameprojectname]-------------
....


we can see after first click on mouse middle button the
createTxt.getText() will return empty string.

Gwt ve
from the second click it will work.
seems the 'Click', 'MouseDown', 'MouseUp', and 'MouseOver' events are
handler before GWT set value to ' createTxt' .

question 1> : which even should I monitor and which handler should
I add to createTxt so that I can catch the content after the first
click here ?

question 2> if user right click mouse , OS (here I use Ubuntu)
will feedback a menu with a option 'paste' , now if user click this
option . GWT Web UI can not catch this click event, but this event can
be catch
by OS. I want to know in this case which even should I monitor and
which handler should I add to createTxt so that I can catch the
content after user first click this 'paste'
option and the createTxt have the value.

thanks !!
//Bruce

--
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 google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment