changeset 1062:55f02057dc37

6516404: regression: Choice vertical scrollbar is not seen when the item in the choice is increased more than Reviewed-by: art, dav
author dcherepanov
date Mon, 23 Mar 2009 11:59:55 +0300
parents c58f41b4bfbd
children adaee9531504
files src/windows/native/sun/windows/awt_Choice.cpp
diffstat 1 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/windows/native/sun/windows/awt_Choice.cpp	Fri Mar 20 08:41:43 2009 -0400
+++ b/src/windows/native/sun/windows/awt_Choice.cpp	Mon Mar 23 11:59:55 2009 +0300
@@ -77,6 +77,8 @@
 
 BOOL AwtChoice::sm_isMouseMoveInList = FALSE;
 
+static const UINT MINIMUM_NUMBER_OF_VISIBLE_ITEMS = 8;
+
 /*************************************************************************
  * AwtChoice class methods
  */
@@ -176,6 +178,10 @@
             env->SetIntField(target, AwtComponent::widthID,  (jint) rc.right);
             env->SetIntField(target, AwtComponent::heightID, (jint) rc.bottom);
 
+            if (IS_WINXP) {
+                ::SendMessage(c->GetHWnd(), CB_SETMINVISIBLE, (WPARAM) MINIMUM_NUMBER_OF_VISIBLE_ITEMS, 0);
+            }
+
             env->DeleteLocalRef(dimension);
         }
     } catch (...) {
@@ -195,7 +201,7 @@
 {
     int itemHeight =(int)::SendMessage(GetHWnd(), CB_GETITEMHEIGHT, (UINT)0,0);
     int numItemsToShow = (int)::SendMessage(GetHWnd(), CB_GETCOUNT, 0,0);
-    numItemsToShow = numItemsToShow > 8 ? 8 : numItemsToShow;
+    numItemsToShow = min(MINIMUM_NUMBER_OF_VISIBLE_ITEMS, numItemsToShow);
     // drop-down height snaps to nearest line, so add a
     // fudge factor of 1/2 line to ensure last line shows
     return itemHeight*numItemsToShow + itemHeight/2;