|
Re: Missing focusLost when keyboard-triggering default button [message #987469 is a reply to message #987400] |
Mon, 26 November 2012 17:48 |
Ivan Furnadjiev Messages: 2427 Registered: July 2009 Location: Sofia, Bulgaria |
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 08:19 |
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 08:24] Report message to a moderator
|
|
|
|
|
Re: Missing focusLost when keyboard-triggering default button [message #987634 is a reply to message #987400] |
Tue, 27 November 2012 11:35 |
Thomas Schindl Messages: 6651 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 12:05 |
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 12:06] Report message to a moderator
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.05369 seconds