Some characters are not entering KeyPress event [message #506094] |
Tue, 05 January 2010 23:59  |
Eclipse User |
|
|
|
Hi all,
I'm trying to filter characters typed by users in keyPress event, but it
seems that when you type fast enough, some characters are not passed to
this event at all, hence it's impossible to filter them.
Here's a little snippet to reproduce:
....
Text text = new Text(parent, null);
text.addKeyListener
(
new KeyAdapter()
{
@Override
public void keyPressed(KeyEvent e)
{
System.out.println("char : " + e.character);
}
}
);
....
Just type arbitrary characters fast and expect that some characters
don't show up in the console.
I've tried the same snippet on RCP and it works fine there.
Best Regards,
Setya
|
|
|
Re: Some characters are not entering KeyPress event [message #506109 is a reply to message #506094] |
Wed, 06 January 2010 03:28   |
Eclipse User |
|
|
|
Hi Setya,
The current scope of the key event implementation is to provide the
infrastructure necessary to bring Cell Editors to work (see bug 225764
for more details). In order to filter the user input you can use a
verify/modify listener. An example how to allow user to type only
numbers is available in Controls Demo -> TextTab (
org.eclipse.rap.demo.controls.TextTab.java ).
HTH,
Ivan
On 1/6/2010 6:59 AM, Setya wrote:
> Hi all,
>
> I'm trying to filter characters typed by users in keyPress event, but
> it seems that when you type fast enough, some characters are not
> passed to this event at all, hence it's impossible to filter them.
>
> Here's a little snippet to reproduce:
>
> ...
> Text text = new Text(parent, null);
> text.addKeyListener
> (
> new KeyAdapter()
> {
> @Override
> public void keyPressed(KeyEvent e)
> {
> System.out.println("char : " + e.character);
> }
> }
> );
> ...
>
> Just type arbitrary characters fast and expect that some characters
> don't show up in the console.
>
> I've tried the same snippet on RCP and it works fine there.
>
>
> Best Regards,
>
> Setya
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.25687 seconds