Key events in Firefox [message #534003] |
Mon, 17 May 2010 12:50  |
Eclipse User |
|
|
|
Hello,
so I have a text widget with a key listener that listens for the first key pressed, in order to check whether text data is really editable or not.
I can't change that behavior. In case of a positive outcome the listener removes itself.
In general, this works fine, but when the user decides to select parts of the text and presses the Delete key, the key listener is never informed
of that fact. This behavior is Firefox (3.6.3) specific, other browser like Chrome or IE do send the key event.
Is that desired behavior, am I missing something ? Qooxdoo seems to cope fine with registering the "keydown" event. Any idea of what is wrong ?
Thanks for your help in advance
|
|
|
Re: Key events in Firefox [message #534147 is a reply to message #534003] |
Tue, 18 May 2010 04:33   |
Eclipse User |
|
|
|
Hi,
key listeners in RAP are there to support cell editors, we are aware
that some keys do not work correctly due to cross-browser issues. Feel
free to file a bug anyway.
Regards, Ralf
tibersept wrote:
> Hello,
>
> so I have a text widget with a key listener that listens for the first
> key pressed, in order to check whether text data is really editable or
> not. I can't change that behavior. In case of a positive outcome the
> listener removes itself.
> In general, this works fine, but when the user decides to select parts
> of the text and presses the Delete key, the key listener is never
> informed of that fact. This behavior is Firefox (3.6.3) specific, other
> browser like Chrome or IE do send the key event.
> Is that desired behavior, am I missing something ? Qooxdoo seems to
> cope fine with registering the "keydown" event. Any idea of what is wrong ?
>
> Thanks for your help in advance
>
>
|
|
|
Re: Key events in Firefox [message #534174 is a reply to message #534147] |
Tue, 18 May 2010 05:56   |
Eclipse User |
|
|
|
Hi Ralf,
I've seen that the issue is not so trivial, had a look at the two KeyEventUtil
classes org.eclipse.rwt.AsyncKeyEventUtil and org.eclipse.rwt.SyncKeyEventUtil,
although I don't understand the flow exactly. I will not file a bug because the issue is well
documented.
Anyway, I need a solution and ModifyListener does not work for me, so I have extended
the RAP Text widget org.eclipse.rwt.widgets.Text and added a keydown listener. The
corresponding method checks for a specific browser + a specific key ( only if key listeners
have been added to the text widget ) and sends a Request (sendSynchronous) with
keyCode, charCode, and modifier set .
This almost works, only problem being that the the last char of the text value appears
at the selection start, so the resulting text value has to be truncated.
Could you point me to why this is happening, and, in general, to a better approach.
Thanks & Regards
[Updated on: Tue, 18 May 2010 07:25] by Moderator
|
|
|
Re: Key events in Firefox [message #534301 is a reply to message #534174] |
Tue, 18 May 2010 11:26   |
Eclipse User |
|
|
|
Hi tibersept,
our KeyEvents implementation is complicated and differs between browsers
because of the fact that KeyEvents can be discarded in a Listener. I
think using a ModifyListener would be preferable, why doesn't it work
for you? Can you explain your use-case a bit more?
If you have a custom widget or some kind widget patch in Javascript you
should make sure that you have no KeyListener attached to these widgets
but use some custom communication instead because the KeyEventsUtil
interrupts the flow of events to allow for the server-side veto.
HTH, Ralf
tibersept wrote:
> Hi Ralf,
>
> I've seen that the issue is not so trivial, had a look at the two
> KeyEventUtil classes org.eclipse.rwt.AsyncKeyEventUtil and
> org.eclipse.rwt.SyncKeyEventUtil, although I don't understand the flow
> exactly. I will not file a bug because the issue is well documented.
>
> Anyway, I need a solution and ModifyListener does not work for me, so I
> have extended the RAP Text widget org.eclipse.rwt.widgets.Text and added
> a keydown listener. The corresponding method checks for a specific
> browser + a specific key ( only if key listeners have been added to the
> text widget ) and sends a Request (sendSynchronous) with keyCode,
> charCode, and modifier set .
> This almost works for the Delete key, only problem being that the the
> last char of the selection is not deleted anymore, so the resulting text
> value has to be truncated. Could you point me to why this is
> happening, and, in general, to a better approach.
>
> Thanks & Regards
|
|
|
Re: Key events in Firefox [message #534329 is a reply to message #534301] |
Tue, 18 May 2010 13:00  |
Eclipse User |
|
|
|
Hi Ralf,
here are more details about my use case. I have a legacy system
operating behind the RAP application which requires a text widget
to always allow editing but the text value might still not be
editable. The legacy system does not provide access to that information
until the user starts editing.
With ModifyListener the user can already type a complete word
in a text widget before finding out that the text was non-editable
and seeing the typed string disappear. A KeyListener listening
for the first key pressed performs much better and the UI
in general reacts much faster with the necessary changes. That
is the whole issue.
A custom communication sounds complicated, my current
solution, although very ugly, seems to work, so I am going to
stick with it until I have more time to look at the former.
Thank you for your help and timely replies
|
|
|
Powered by
FUDForum. Page generated in 0.10682 seconds