Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » Some characters are not entering KeyPress event
Some characters are not entering KeyPress event [message #506094] Wed, 06 January 2010 04:59 Go to next message
Setya Nugdjaja is currently offline Setya NugdjajaFriend
Messages: 567
Registered: July 2009
Senior Member
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 08:28 Go to previous messageGo to next message
Ivan Furnadjiev is currently offline Ivan FurnadjievFriend
Messages: 2426
Registered: July 2009
Location: Sofia, Bulgaria
Senior Member
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 09:07 Go to previous messageGo to next message
Setya Nugdjaja is currently offline Setya NugdjajaFriend
Messages: 567
Registered: July 2009
Senior Member
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 09:19 Go to previous messageGo to next message
Ivan Furnadjiev is currently offline Ivan FurnadjievFriend
Messages: 2426
Registered: July 2009
Location: Sofia, Bulgaria
Senior Member
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 10:18 Go to previous message
Setya Nugdjaja is currently offline Setya NugdjajaFriend
Messages: 567
Registered: July 2009
Senior Member
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: Tue Apr 16 07:55:11 GMT 2024

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

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

Back to the top