summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSilenio Quarti <silenio>2010-04-26 14:54:23 +0000
committerSilenio Quarti <silenio>2010-04-26 14:54:23 +0000
commit47d0546ba3731de37d78b0000e37af058a2168b0 (patch)
treee9acbeb5ce55a3006bf2472a389cc42a38229cb6
parent41ad2a506242e46d3b0d85d794d3bd6a732e7252 (diff)
downloadeclipse.platform.swt-47d0546ba3731de37d78b0000e37af058a2168b0.tar.gz
eclipse.platform.swt-47d0546ba3731de37d78b0000e37af058a2168b0.tar.xz
eclipse.platform.swt-47d0546ba3731de37d78b0000e37af058a2168b0.zip
Bug 310401 - Combo shows only 5 items if items are set after first layout
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Combo.java30
1 files changed, 23 insertions, 7 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 c85456dd95..c6ac7aa839 100755
--- 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
@@ -1886,13 +1886,7 @@ public void setVisibleItemCount (int count) {
checkWidget ();
if (count < 0) return;
visibleCount = count;
- if ((style & SWT.DROP_DOWN) != 0) {
- forceResize ();
- RECT rect = new RECT ();
- OS.GetWindowRect (handle, rect);
- int flags = OS.SWP_NOMOVE | OS.SWP_NOZORDER | OS.SWP_DRAWFRAME | OS.SWP_NOACTIVATE;
- setBounds (0, 0, rect.right - rect.left, rect.bottom - rect.top, flags);
- }
+ updateDropDownHeight ();
}
void subclass () {
@@ -1958,6 +1952,27 @@ void unsubclass () {
}
}
+void updateDropDownHeight () {
+ /*
+ * Feature in Windows. If the combo box has the CBS_DROPDOWN
+ * or CBS_DROPDOWNLIST style, Windows uses the height that the
+ * programmer sets in SetWindowPos () to control height of the
+ * drop down list. See #setBounds() for more details.
+ */
+ if ((style & SWT.DROP_DOWN) != 0) {
+ RECT rect = new RECT ();
+ OS.SendMessage (handle, OS.CB_GETDROPPEDCONTROLRECT, 0, rect);
+ int visibleCount = getItemCount() == 0 ? VISIBLE_COUNT : this.visibleCount;
+ int height = getTextHeight () + (getItemHeight () * visibleCount) + 2;
+ if (height != (rect.bottom - rect.top)) {
+ forceResize ();
+ OS.GetWindowRect (handle, rect);
+ int flags = OS.SWP_NOMOVE | OS.SWP_NOZORDER | OS.SWP_DRAWFRAME | OS.SWP_NOACTIVATE;
+ SetWindowPos (handle, 0, 0, 0, rect.right - rect.left, height, flags);
+ }
+ }
+}
+
String verifyText (String string, int start, int end, Event keyEvent) {
Event event = new Event ();
event.text = string;
@@ -2427,6 +2442,7 @@ LRESULT wmCommandChild (int /*long*/ wParam, int /*long*/ lParam) {
break;
case OS.CBN_DROPDOWN:
setCursor ();
+ updateDropDownHeight ();
break;
case OS.CBN_KILLFOCUS:
/*