Bug 372610 - SWT: Scout model value not updated because of a missing lost focus event
Summary: SWT: Scout model value not updated because of a missing lost focus event
Status: CLOSED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Scout (show other bugs)
Version: unspecified   Edit
Hardware: PC All
: P2 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: helpwanted
Depends on:
Blocks:
 
Reported: 2012-02-26 16:47 EST by Claudio Guglielmo CLA
Modified: 2021-08-19 11:17 EDT (History)
6 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Claudio Guglielmo CLA 2012-02-26 16:47:12 EST
I have a dialog with some fields. Pressing ok saves the content of those fields. It works well on windows. On Mac OS X Lion not.

Steps to reproduce: 
1. Create a form with fields (or download http://wiki.eclipse.org/Scout/Tutorial/Project_From_Existing_Workspace)
2. Open the form as dialog
3. Change a value in a field and click "cancel". The messagebox "Save changes?" should appear. It does not.
4. Open the dialog again, change a value in a field and press tab before clicking cancel. The messagebox appears -> fine

Btw: If I press the enter key it saves the value. If I use the mouse and click ok without leaving the field first, it does not.
Comment 1 Jeremie Bresson CLA 2012-09-27 00:02:54 EDT
Input from juewe at:
http://www.eclipse.org/forums/index.php/mv/msg/384383/924486/#msg_924486
Comment 2 Jeremie Bresson CLA 2014-01-10 13:26:00 EST
You can also produce such a situation under windows, if you use a ToolButton bar in your form [1].

In this case, there is also no lost_focus event on the SWT Field corresponding to the Scout Value Field. The Scout model has no information about the current value in the UI, leading to unexpected behavior for the user.

[1] http://www.eclipse.org/forums/index.php/t/631535/
Comment 3 Judith Gull CLA 2014-01-15 04:41:56 EST
A similar problem is solved in RWT, where there is no focus lost when ESC is used: See RwtUtility.verifyUiInput(focusControl); in 

org.eclipse.scout.rt.ui.rap.window.dialog.RwtScoutDialog.DialogImpl.close()

The UI value of the field containing the focus is written to the model when the dialog is closed.

Something similar could be done when a toolbutton or ok button is clicked.
Comment 4 Jeremie Bresson CLA 2014-01-15 09:19:27 EST
We discussed an additional case (similar to what Judith has described): 

If you call doOk() in the execAction() of a KeyStroke, there is also no lost focus event.
Comment 5 Matthias Nick CLA 2014-01-22 04:14:31 EST
Pushed change to gerrit: 
https://git.eclipse.org/r/#/c/20929/
Comment 6 Jeremie Bresson CLA 2014-01-27 04:53:03 EST
Commit for 3.10.0-M5:
6a151d0739c5c98ec249e1f667ba557ca40b7ccf
http://git.eclipse.org/c/scout/org.eclipse.scout.rt.git/commit/?id=6a151d0739c5c98ec249e1f667ba557ca40b7ccf

@Claudio Guglielmo:
Can you verify please?
Comment 7 Jeremie Bresson CLA 2014-01-30 03:42:55 EST
Additional commit for this bug (3.10.0-M5):
f227a697cb4bc2f5a4b823976d250498ad5abae2

http://git.eclipse.org/c/scout/org.eclipse.scout.rt.git/commit/?id=f227a697cb4bc2f5a4b823976d250498ad5abae2

This is in order to support following use case:
- value V1 in the SmartField
- [Down][Down][Down] (to select an other Value: V2) + [Tab]
- value V2 should be set in the SmartField.
Comment 8 Lukas Huser CLA 2014-01-31 13:18:26 EST
Hi all

I think that a commit for this bug breaks the functionality of tray icon menus for an SWT client.

More specifically, when a tray icon menu is clicked, AbstractSwtMenuAction.handleSwtAction() is triggered. Here, a new check with SwtUtility.runSwtInputVerifier fails (returns false), because there is no currently focused control. As a consequence, the menu action is not executed.
Comment 9 Judith Gull CLA 2014-02-03 03:31:04 EST
see comment 8
Comment 10 Matthias Nick CLA 2014-02-11 03:36:22 EST
Hi Lukas,
thank you very much for your analysis, you are right.

Pushed a new patch to gerrit: https://git.eclipse.org/r/#/c/21792/
Comment 11 Matthias Zimmermann CLA 2014-02-20 08:09:13 EST
to be fixed on branch 3.10 as well
Comment 13 Matthias Nick CLA 2014-03-06 08:01:05 EST
pushed backport to 3.10 to gerrit: https://git.eclipse.org/r/#/c/22980/
Comment 14 Matthias Nick CLA 2014-03-06 08:51:05 EST
changed was merged to 3.10 with commit http://git.eclipse.org/c/scout/org.eclipse.scout.rt.git/commit/?h=release/3.10.0&id=9ec39f7063291c3b61cd4babbb15146b960a8c22

@Erich, can you please verify?
Comment 15 Erich Steiger CLA 2014-03-14 11:19:47 EDT
tested with 3.10.0.20140314-1207 -> Test OK
Comment 16 Judith Gull CLA 2014-03-15 05:06:03 EDT
see comment 15
Comment 17 Jeremie Bresson CLA 2014-05-16 08:19:28 EDT
The use case described in comment #2 is not working. See Bug 435052.
Comment 18 Matthias Zimmermann CLA 2014-07-01 03:19:52 EDT
Shipped with Eclipse Luna Release