提交 e1200347 编写于 作者: D dcherepanov

6516404: regression: Choice vertical scrollbar is not seen when the item in...

6516404: regression: Choice vertical scrollbar is not seen when the item in the choice is increased more than
Reviewed-by: art, dav
上级 351aa86f
...@@ -77,6 +77,8 @@ BOOL AwtChoice::skipNextMouseUp = FALSE; ...@@ -77,6 +77,8 @@ BOOL AwtChoice::skipNextMouseUp = FALSE;
BOOL AwtChoice::sm_isMouseMoveInList = FALSE; BOOL AwtChoice::sm_isMouseMoveInList = FALSE;
static const UINT MINIMUM_NUMBER_OF_VISIBLE_ITEMS = 8;
/************************************************************************* /*************************************************************************
* AwtChoice class methods * AwtChoice class methods
*/ */
...@@ -176,6 +178,10 @@ AwtChoice* AwtChoice::Create(jobject peer, jobject parent) { ...@@ -176,6 +178,10 @@ AwtChoice* AwtChoice::Create(jobject peer, jobject parent) {
env->SetIntField(target, AwtComponent::widthID, (jint) rc.right); env->SetIntField(target, AwtComponent::widthID, (jint) rc.right);
env->SetIntField(target, AwtComponent::heightID, (jint) rc.bottom); 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); env->DeleteLocalRef(dimension);
} }
} catch (...) { } catch (...) {
...@@ -195,7 +201,7 @@ int AwtChoice::GetDropDownHeight() ...@@ -195,7 +201,7 @@ int AwtChoice::GetDropDownHeight()
{ {
int itemHeight =(int)::SendMessage(GetHWnd(), CB_GETITEMHEIGHT, (UINT)0,0); int itemHeight =(int)::SendMessage(GetHWnd(), CB_GETITEMHEIGHT, (UINT)0,0);
int numItemsToShow = (int)::SendMessage(GetHWnd(), CB_GETCOUNT, 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 // drop-down height snaps to nearest line, so add a
// fudge factor of 1/2 line to ensure last line shows // fudge factor of 1/2 line to ensure last line shows
return itemHeight*numItemsToShow + itemHeight/2; return itemHeight*numItemsToShow + itemHeight/2;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册