Index: windows/odbcdialogparams.cpp =================================================================== --- windows/odbcdialogparams.cpp (revision 1010) +++ windows/odbcdialogparams.cpp (working copy) @@ -463,6 +463,34 @@ } } +#ifndef MAX_VISIBLE_CB_ITEMS +#define MAX_VISIBLE_CB_ITEMS 20 +#endif + +int ChangeDropdownHeight(HWND cbHwnd, unsigned int itemsCount) +{ + COMBOBOXINFO dbcbinfo; + RECT ddRect; + int newHeight = 0; + + dbcbinfo.cbSize= sizeof(COMBOBOXINFO); + ComboBox_GetDroppedControlRect(cbHwnd, &ddRect); + newHeight= ddRect.bottom - ddRect.top; + + if ( GetComboBoxInfo(cbHwnd, &dbcbinfo) ) + { + itemsCount= itemsCount < 1 ? 1 : (itemsCount > MAX_VISIBLE_CB_ITEMS ? MAX_VISIBLE_CB_ITEMS : itemsCount ); + + newHeight= itemsCount*ComboBox_GetItemHeight(cbHwnd); + MoveWindow(dbcbinfo.hwndList, ddRect.left, ddRect.top, ddRect.right-ddRect.left, newHeight, FALSE); + + /* Refresh(cbHwnd);*/ + } + + return newHeight; +} + + void FormMain_OnCommand(HWND hwnd, int id, HWND hwndCtl, UINT codeNotify) { switch (id) @@ -497,17 +525,22 @@ } case IDC_EDIT_dbname: - { - if(codeNotify==CBN_DROPDOWN) { + { + if(codeNotify==CBN_DROPDOWN) + { FillParameters(hwnd, *pParams); LIST *dbs= mygetdatabases(hwnd, pParams); LIST *dbtmp= dbs; + ComboBox_ResetContent(hwndCtl); + + ChangeDropdownHeight(hwndCtl,list_length(dbs)); + for (; dbtmp; dbtmp= list_rest(dbtmp)) ComboBox_AddString(hwndCtl, (SQLWCHAR *)dbtmp->data); list_free(dbs, 1); - } - } + } + } } return;