Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » Missing focusLost when keyboard-triggering default button(Different behaviour between SWT and RWT when activating default button via ENTER fo)
Missing focusLost when keyboard-triggering default button [message #987400] Mon, 26 November 2012 08:32 Go to next message
Marco Missfeldt is currently offline Marco Missfeldt
Messages: 5
Registered: November 2012
Junior Member
I have a view with some controls and a default button, set by setDefaultButton(Button).

In SWT, when I press ENTER to trigger the default button, the focus changes to the default button before it is triggered. In RWT the focus doesn't change.

This only affects keyboard triggering. When I use the mouse to trigger the default button, the focus change occurs.

This is a big issue for us because we use the focus lost events on text controls to perceive content changes as a whole (and not on every single key press).

So the effect in RWT for example is when I enter a password and directly hit ENTER to trigger the Login-Button, the password input is not recognized because of the missing focus change. When I use the mouse instead everything is fine.

I wonder if nobody else has problems with this or am I missing an important point?
Re: Missing focusLost when keyboard-triggering default button [message #987469 is a reply to message #987400] Mon, 26 November 2012 12:48 Go to previous messageGo to next message
Ivan Furnadjiev is currently offline Ivan Furnadjiev
Messages: 1691
Registered: July 2009
Senior Member
Hi Marko,
which RAP version are you using?
Best,
Ivan

On 11/26/2012 3:36 PM, Marco Missfeldt wrote:
> I have a view with some controls and a default button, set by
> setDefaultButton(Button).
>
> In SWT, when I press ENTER to trigger the default button, the focus
> changes to the default button before it is triggered. In RWT the focus
> doesn't change.
>
> This only affects keyboard triggering. When I use the mouse to trigger
> the default button, the focus change occurs.
>
> This is a big issue for us because we use the focus lost events on
> text controls to perceive content changes as a whole (and not on every
> single key press).
>
> So the effect in RWT for example is when I enter a password and
> directly hit ENTER to trigger the Login-Button, the password input is
> not recognized because of the missing focus change. When I use the
> mouse instead everything is fine.
>
> I wonder if nobody else has problems with this or am I missing an
> important point?

--
Ivan Furnadjiev

Twitter: @EclipseRAP
Blog: http://eclipsesource.com/blogs/

Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
Re: Missing focusLost when keyboard-triggering default button [message #987568 is a reply to message #987469] Tue, 27 November 2012 03:19 Go to previous messageGo to next message
Marco Missfeldt is currently offline Marco Missfeldt
Messages: 5
Registered: November 2012
Junior Member
Hi Ivan,

I use RAP version 2.0.0-M3-20121112-1148.

Btw - I found a little workaround for this problem. If I check and transfer the focus in my Button-Listener, I am able to get the behaviour which is the standard in SWT - here the snippet:

// getControl() returns the Button
this.getControl().addSelectionListener(new SelectionListener() {
   @Override
   public void widgetSelected(final SelectionEvent e) {
      // Workaround for RAP - ensure that the old control loses and the button gets the focus
      if (!PvTButton.this.getControl().isFocusControl()) {
         PvTButton.this.getControl().forceFocus();
      }
      ... // calling some controller action
   }
   ...
});

While this helps me for the moment I think there should be the same behaviour between RWT and SWT.

Best regards
Marco

[Updated on: Tue, 27 November 2012 03:24]

Report message to a moderator

Re: Missing focusLost when keyboard-triggering default button [message #987571 is a reply to message #987568] Tue, 27 November 2012 03:23 Go to previous messageGo to next message
Ivan Furnadjiev is currently offline Ivan Furnadjiev
Messages: 1691
Registered: July 2009
Senior Member
Hi Marko,
please open a bugzilla about this issue and we will investigate it.
Thanks,
Ivan

On 11/27/2012 10:19 AM, Marco Missfeldt wrote:
> Hi Ivan,
>
> I use RAP version 2.0.0-M3-20121112-1148.
>
> Btw - I found a little workaround for this problem. If I check and
> transfer the focus in my Button-Listener, I am able to get the
> behaviour which is the standard in SWT - here the snippet:
>
>
> // getControl() returns the Button
> this.getControl().addSelectionListener(new SelectionListener() {
> @Override
> public void widgetSelected(final SelectionEvent e) {
> // Workaround for RAP - ensure that the old control loses and the
> button gets the focus
> if (!PvTButton.this.getControl().isFocusControl()) {
> PvTButton.this.getControl().forceFocus();
> }
> ... // calling some controller action
> }
> ...
> });
>
> While this helps me for the moment I still there should be the same
> behaviour between RWT and SWT.
>
> Best regards
> Marco

--
Ivan Furnadjiev

Twitter: @EclipseRAP
Blog: http://eclipsesource.com/blogs/

Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
Re: Missing focusLost when keyboard-triggering default button [message #987575 is a reply to message #987571] Tue, 27 November 2012 03:40 Go to previous messageGo to next message
Marco Missfeldt is currently offline Marco Missfeldt
Messages: 5
Registered: November 2012
Junior Member
Ok, done.

Ivan Furnadjiev wrote on Tue, 27 November 2012 03:23
Hi Marko,
please open a bugzilla about this issue and we will investigate it.
Thanks,
Ivan

Re: Missing focusLost when keyboard-triggering default button [message #987634 is a reply to message #987400] Tue, 27 November 2012 06:35 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas Schindl
Messages: 5014
Registered: July 2009
Senior Member
Just to make sure.

Have you tested this behavior on all SWT platforms? On Mac normally a
button can never receive focus so if you rely on this your application
it is broken on Mac OS-X as well!

In the RAP case the behavior you see might be a bug, on OS-X it is
desired, bottom line do not use focus-out, or explicitly sync your model
from the UI before you execute actions attached to the SWT buttons.

Tom

Am 26.11.12 14:36, schrieb Marco Missfeldt:
> I have a view with some controls and a default button, set by
> setDefaultButton(Button).
>
> In SWT, when I press ENTER to trigger the default button, the focus
> changes to the default button before it is triggered. In RWT the focus
> doesn't change.
>
> This only affects keyboard triggering. When I use the mouse to trigger
> the default button, the focus change occurs.
>
> This is a big issue for us because we use the focus lost events on text
> controls to perceive content changes as a whole (and not on every single
> key press).
>
> So the effect in RWT for example is when I enter a password and directly
> hit ENTER to trigger the Login-Button, the password input is not
> recognized because of the missing focus change. When I use the mouse
> instead everything is fine.
>
> I wonder if nobody else has problems with this or am I missing an
> important point?
Re: Missing focusLost when keyboard-triggering default button [message #987639 is a reply to message #987634] Tue, 27 November 2012 07:05 Go to previous messageGo to next message
Marco Missfeldt is currently offline Marco Missfeldt
Messages: 5
Registered: November 2012
Junior Member
Tom, we don't use Macs here, so I just can take Win-32 as the native comparison platform.

Your suggestion to explicitly sync view and model before action executing would be a technically valid option, but it would compromise the way our existing MVC architecture works (we also support Swing and other UI-Systems) and would lead to a number of difficulties concerning locality and contexts.

And still we would also need the focus-lost behaviour, because we want the new content to appear inside the model attribute just after it has been entered completely.

I really would love to have an alternative to focus-lost. In Swing you can use an InputVerifier as a good alternative, because it is only triggered after focus leaves, but in SWT the ModifyListener and VerifyListener both are triggered after each key typed, which would lead to far too many updates in our models.

Marco

[Updated on: Tue, 27 November 2012 07:06]

Report message to a moderator

Re: Missing focusLost when keyboard-triggering default button [message #987674 is a reply to message #987639] Tue, 27 November 2012 09:32 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas Schindl
Messages: 5014
Registered: July 2009
Senior Member
As I said your app is broken on Mac as well. What you want is what we
call in Eclipse Databinding a delayed observable.

So we install a modify-listener and so on each keystroke we get a change
event but instead of immediately syncing we wait for 400ms and in case
another key-stroke happens we cancel the update to the backing bean.

Still this doesn't free you from making sure that the model is synced
when the user executes a button press.

Tom


Am 27.11.12 13:05, schrieb Marco Missfeldt:
> Tom, we don't use Macs here, so I just can take Win-32 as the native
> comparison platform.
> Your suggestion to explicitly sync view and model before action
> executing would be a technically valid option, but it would compromise
> the way our existing MVC architecture works (we also support Swing and
> other UI-Systems) and would lead to a number of difficulties concerning
> locality and contexts.
> And still we would also need the focus-lost behaviour, because we want
> the new content to appear inside the model attribute just after it has
> been entered completely.
> I really would love to have an alternative to focus-lost. In Swing you
> can use an InputVerifier as a good alternative, because it is only
> triggered after focus leaves, but in SWT the ModifyListener and
> VerifyListener both are triggered after each key typed, which would lead
> to far too many updates in our models.
>
> Marco
Re: Missing focusLost when keyboard-triggering default button [message #987793 is a reply to message #987674] Wed, 28 November 2012 03:27 Go to previous message
Marco Missfeldt is currently offline Marco Missfeldt
Messages: 5
Registered: November 2012
Junior Member
Hi Thomas,

this delayed observable would be no solution for us, only new complexity. As you wrote correctly, this would not free us from explicitely syncing. And even worse: As many of our customers are no high-performance writers, still various intermediate results would be written into our models - leading to misleading attribute validations in the worst cases.

You're right that we would have a problem on Mac-SWT, but this is not a platform we plan to use. And if we must, we still have Swing as a proven alternative. We mainly support SWT because of RAP - as we looked for an AJAX-Platform that fits nicely into our architecture. Of course it's a great bargain that native SWT works too.

Now for the conclusion: I still think it's right to see this issue as a bug, because RAP is not Mac and in RAP the button is capable of getting the focus. So it should do, as is the case on other SWT platforms with focussable buttons like Windows.

Marco
Previous Topic:Getting Started
Next Topic:Trigger UI update with javascript
Goto Forum:
  


Current Time: Sun Apr 20 19:44:38 EDT 2014

Powered by FUDForum. Page generated in 0.01659 seconds