Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexandr Miloslavskiy2018-12-17 18:06:49 +0000
committerNiraj Modi2019-01-21 18:35:00 +0000
commitc3c708b46f94fc701d08f0339ebbbfcdc6ad32af (patch)
tree356c19bef98b4269aefe6fc6e1adf4bdb09b11fc
parent5970d5d79cf7605de4826347008adda9cf67a2ef (diff)
downloadeclipse.platform.swt-c3c708b46f94fc701d08f0339ebbbfcdc6ad32af.tar.gz
eclipse.platform.swt-c3c708b46f94fc701d08f0339ebbbfcdc6ad32af.tar.xz
eclipse.platform.swt-c3c708b46f94fc701d08f0339ebbbfcdc6ad32af.zip
Bug 409572 - [Win32] Combobox's text is shown partially + caret goes out of view
Change-Id: Ib86169831c0b81a624959e7254fb000c8dc0ed57 Signed-off-by: Alexandr Miloslavskiy <alexandr.miloslavskiy@syntevo.com>
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Combo.java23
1 files changed, 23 insertions, 0 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Combo.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Combo.java
index af22df8de4..7c063e794f 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Combo.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Combo.java
@@ -2948,6 +2948,29 @@ LRESULT WM_SIZE (long /*int*/ wParam, long /*int*/ lParam) {
* the combo box has been resized.
*/
if ((style & SWT.H_SCROLL) != 0) setScrollWidth (scrollWidth);
+
+ /*
+ * When setting selection, Combo automatically scrolls selection's end into view.
+ * We force it to do such scrolling after every resize to achieve multiple goals:
+ * 1) Text is no longer partially shown when there's free space after resizing
+ * Without workaround, this happens when all of these are true:
+ * a) Combo has focus
+ * b) Combo can't fit all text
+ * c) Caret is not at position 0
+ * d) Combo is resized bigger.
+ * 2) Text is no longer partially shown after .setSelection() before its size was calculated
+ * This is just another form of problem 1.
+ * 3) Caret no longer goes out of view when shrinking control.
+ */
+ if ((style & SWT.READ_ONLY) == 0) {
+ Point oldSelection = this.getSelection();
+ Point tmpSelection = new Point(0, 0);
+ if (!oldSelection.equals(tmpSelection)) {
+ this.setSelection(tmpSelection);
+ this.setSelection(oldSelection);
+ }
+ }
+
return result;
}

Back to the top