Re: Stop keyboard events
Only if u kill the user before he does that! :)
But if u are satisfied with filtering what's being pressed you can do
like this (example uses uibinding syntax):
@UiHandler("inputValue")
void onInputValueInserted(KeyUpEvent e) {
if(!inputValue.getText().isEmpty()) {
if(!inputValue.getText().matches("[1-9]\\d{0,}")) { // I want to
filter out what's not a number and those numbers starting with 0
inputValue.setText(inputValue.getText().subSequence(0,
inputValue.getText().length() - 1).toString()); // remove the last
char
}
}
}
HTH,
C
On Mar 15, 12:17 am, Magno Machado <magn...@gmail.com> wrote:
> Is it possible to prevent a key from being pressed on an textbox?
>
> --
> Magno Machado Paulohttp://blog.magnomachado.com.brhttp://code.google.com/p/emballo/
--
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.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home