Skip to main content



      Home
Home » Eclipse Projects » Remote Application Platform (RAP) » Some characters are not entering KeyPress event
Some characters are not entering KeyPress event [message #506094] Tue, 05 January 2010 23:59 Go to next message
Eclipse UserFriend
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 Go to previous messageGo to next message
Eclipse UserFriend
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
Re: Some characters are not entering KeyPress event [message #506115 is a reply to message #506109] Wed, 06 January 2010 04:07 Go to previous messageGo to next message
Eclipse UserFriend
Hi Ivan,

> 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 ).

Thank you for your pointer.

Initially I was using the same approach as shown by the example, but
then I notice that the invalid character had a chance to show up briefly
and quickly vanished. Since I thought this might confuse users, I
decided to move the character screening in the keyPressed event
especially after Text#getCaretPosition is available.

Can we consider this as a bug/enhancement since the same snippet works
in RCP ?


Best Regards,

Setya
Re: Some characters are not entering KeyPress event [message #506116 is a reply to message #506115] Wed, 06 January 2010 04:19 Go to previous messageGo to next message
Eclipse UserFriend
Setya,

due to client server turnaround delay I don't think that we can do much
to fix/enhance such a functionality.

Best,
Ivan

On 1/6/2010 11:07 AM, Setya wrote:
> Hi Ivan,
>
>> 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 ).
>
> Thank you for your pointer.
>
> Initially I was using the same approach as shown by the example, but
> then I notice that the invalid character had a chance to show up
> briefly and quickly vanished. Since I thought this might confuse
> users, I decided to move the character screening in the keyPressed
> event especially after Text#getCaretPosition is available.
>
> Can we consider this as a bug/enhancement since the same snippet works
> in RCP ?
>
>
> Best Regards,
>
> Setya
Re: Some characters are not entering KeyPress event [message #506137 is a reply to message #506116] Wed, 06 January 2010 05:18 Go to previous message
Eclipse UserFriend
Hi,

> due to client server turnaround delay I don't think that we can do much
> to fix/enhance such a functionality.

OK. Thank you for your clarification.


Regards,

Setya
Previous Topic:ScrolledComposite#showControl doesn't work for new children
Next Topic:Is Tabbed Properties View available in a RAP Project
Goto Forum:
  


Current Time: Fri Jul 04 09:43:57 EDT 2025

Powered by FUDForum. Page generated in 0.25687 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top