Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDirk Fauth2017-11-23 14:02:40 +0000
committerDirk Fauth2017-11-23 14:02:40 +0000
commitf27921974f597b505e2a4bcc51917cfd371edfcc (patch)
tree5d49564dcbaa4defbd6d2674cf47d98ecc415d12
parent70187a55c24d21d7b47d67d232b79bddcd7d7f07 (diff)
downloadorg.eclipse.nebula.widgets.nattable-f27921974f597b505e2a4bcc51917cfd371edfcc.tar.gz
org.eclipse.nebula.widgets.nattable-f27921974f597b505e2a4bcc51917cfd371edfcc.tar.xz
org.eclipse.nebula.widgets.nattable-f27921974f597b505e2a4bcc51917cfd371edfcc.zip
Bug 527677 - [NatCombo] inconsistent behavior on pressing arrow down
with no selection Change-Id: I1cfae05f3b4214d544c0ab3277da197e0b3d098f Signed-off-by: Dirk Fauth <dirk.fauth@googlemail.com>
-rw-r--r--org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/widget/NatCombo.java24
1 files changed, 21 insertions, 3 deletions
diff --git a/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/widget/NatCombo.java b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/widget/NatCombo.java
index 81525700..8766dcb7 100644
--- a/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/widget/NatCombo.java
+++ b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/widget/NatCombo.java
@@ -485,9 +485,13 @@ public class NatCombo extends Composite {
showDropdownControl();
int selectionIndex = getDropdownTable().getSelectionIndex();
- if (selectionIndex < 0)
- selectionIndex = 0;
- getDropdownTable().select(selectionIndex);
+ if (selectionIndex < 0) {
+ select(0);
+ } else {
+ // only visualize the selection in the dropdown, do not
+ // perform a selection
+ getDropdownTable().select(selectionIndex);
+ }
// ensure the arrow key events do not have any further
// effect
@@ -669,6 +673,20 @@ public class NatCombo extends Composite {
}
});
+ this.dropdownTable.addKeyListener(new KeyAdapter() {
+ @Override
+ public void keyPressed(KeyEvent event) {
+ if (event.keyCode == SWT.ARROW_DOWN) {
+ int selected = NatCombo.this.dropdownTable.getSelectionIndex();
+ if (selected < 0) {
+ // no selection before, select the first entry
+ select(0);
+ event.doit = false;
+ }
+ }
+ }
+ });
+
this.dropdownTable.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {

Back to the top