Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeo Ufimtsev2017-08-09 20:53:17 +0000
committerLeo Ufimtsev2017-08-09 20:53:59 +0000
commita70bf22ca177056eed1efc3b4dc7517117954b95 (patch)
treee19f3bb6c84b4b261c228237e66420d777cc838a /tests/org.eclipse.swt.tests
parent5d47be650ef6f2701e7d613b93ddf27ee2c0fc94 (diff)
downloadeclipse.platform.swt-a70bf22ca177056eed1efc3b4dc7517117954b95.tar.gz
eclipse.platform.swt-a70bf22ca177056eed1efc3b4dc7517117954b95.tar.xz
eclipse.platform.swt-a70bf22ca177056eed1efc3b4dc7517117954b95.zip
Bug 304893 - [Custom Widgets] READ_ONLY CCombo does not de-select text
on FocusOut (snippet) Snippet to reproduce issue. Change-Id: I50ed901248d350b1f28f5917177ec438113c345e Signed-off-by: Leo Ufimtsev <lufimtse@redhat.com>
Diffstat (limited to 'tests/org.eclipse.swt.tests')
-rw-r--r--tests/org.eclipse.swt.tests/BugSnippets/Bug304893_CCombo_read_only_combo_text_selection.java38
1 files changed, 38 insertions, 0 deletions
diff --git a/tests/org.eclipse.swt.tests/BugSnippets/Bug304893_CCombo_read_only_combo_text_selection.java b/tests/org.eclipse.swt.tests/BugSnippets/Bug304893_CCombo_read_only_combo_text_selection.java
new file mode 100644
index 0000000000..385cb608a4
--- /dev/null
+++ b/tests/org.eclipse.swt.tests/BugSnippets/Bug304893_CCombo_read_only_combo_text_selection.java
@@ -0,0 +1,38 @@
+
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.CCombo;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+
+
+/**
+ * Description: A CCombo box that has "READ_ONLY" property still has it's text selected.
+ * Steps to reproduce: Run snippet, observe selection of CCombo
+ * Expected results: Text should not be selected, as it's read-only, there is no purpose in having text selected.
+ * Actual results: Text is selected. This looks ugly.
+ */
+public class Bug304893_CCombo_read_only_combo_text_selection {
+
+ public static void main (String [] args) {
+ Display display = new Display();
+ Shell shell = new Shell(display);
+ shell.setLayout(new GridLayout());
+
+ CCombo combo = new CCombo(shell, SWT.READ_ONLY);
+ combo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
+ for (int i = 0; i < 5; i++) {
+ combo.add("item" + i);
+ }
+ combo.setText("item0");
+
+ shell.pack();
+ shell.open();
+ while (!shell.isDisposed()) {
+ if (!display.readAndDispatch()) display.sleep();
+ }
+ display.dispose();
+ }
+}

Back to the top