Make sure edit and listbox controls are of same ASCII/Unicode style as
the combo box. Fixed a few MBCS issues with WM_GETTEXTLENGTH handling.
This commit is contained in:
parent
935e3df35c
commit
741325b86a
|
@ -492,7 +492,8 @@ static LRESULT COMBO_WindowPosChanging(
|
|||
/***********************************************************************
|
||||
* COMBO_Create
|
||||
*/
|
||||
static LRESULT COMBO_Create( HWND hwnd, LPHEADCOMBO lphc, HWND hwndParent, LONG style )
|
||||
static LRESULT COMBO_Create( HWND hwnd, LPHEADCOMBO lphc, HWND hwndParent, LONG style,
|
||||
BOOL unicode )
|
||||
{
|
||||
static const WCHAR clbName[] = {'C','o','m','b','o','L','B','o','x',0};
|
||||
static const WCHAR editName[] = {'E','d','i','t',0};
|
||||
|
@ -574,16 +575,22 @@ static LRESULT COMBO_Create( HWND hwnd, LPHEADCOMBO lphc, HWND hwndParent, LONG
|
|||
}
|
||||
}
|
||||
|
||||
lphc->hWndLBox = CreateWindowExW(lbeExStyle,
|
||||
clbName,
|
||||
NULL,
|
||||
lbeStyle,
|
||||
lphc->droppedRect.left,
|
||||
lphc->droppedRect.top,
|
||||
lphc->droppedRect.right - lphc->droppedRect.left,
|
||||
lphc->droppedRect.bottom - lphc->droppedRect.top,
|
||||
hwnd, (HMENU)ID_CB_LISTBOX,
|
||||
GetWindowLongA( hwnd, GWL_HINSTANCE ), lphc );
|
||||
if (unicode)
|
||||
lphc->hWndLBox = CreateWindowExW(lbeExStyle, clbName, NULL, lbeStyle,
|
||||
lphc->droppedRect.left,
|
||||
lphc->droppedRect.top,
|
||||
lphc->droppedRect.right - lphc->droppedRect.left,
|
||||
lphc->droppedRect.bottom - lphc->droppedRect.top,
|
||||
hwnd, (HMENU)ID_CB_LISTBOX,
|
||||
GetWindowLongA( hwnd, GWL_HINSTANCE ), lphc );
|
||||
else
|
||||
lphc->hWndLBox = CreateWindowExA(lbeExStyle, "ComboLBox", NULL, lbeStyle,
|
||||
lphc->droppedRect.left,
|
||||
lphc->droppedRect.top,
|
||||
lphc->droppedRect.right - lphc->droppedRect.left,
|
||||
lphc->droppedRect.bottom - lphc->droppedRect.top,
|
||||
hwnd, (HMENU)ID_CB_LISTBOX,
|
||||
GetWindowLongA( hwnd, GWL_HINSTANCE ), lphc );
|
||||
|
||||
if( lphc->hWndLBox )
|
||||
{
|
||||
|
@ -610,15 +617,20 @@ static LRESULT COMBO_Create( HWND hwnd, LPHEADCOMBO lphc, HWND hwndParent, LONG
|
|||
|
||||
if (!IsWindowEnabled(hwnd)) lbeStyle |= WS_DISABLED;
|
||||
|
||||
lphc->hWndEdit = CreateWindowExW(0,
|
||||
editName,
|
||||
NULL,
|
||||
lbeStyle,
|
||||
lphc->textRect.left, lphc->textRect.top,
|
||||
lphc->textRect.right - lphc->textRect.left,
|
||||
lphc->textRect.bottom - lphc->textRect.top,
|
||||
hwnd, (HMENU)ID_CB_EDIT,
|
||||
GetWindowLongA( hwnd, GWL_HINSTANCE ), NULL );
|
||||
if (unicode)
|
||||
lphc->hWndEdit = CreateWindowExW(0, editName, NULL, lbeStyle,
|
||||
lphc->textRect.left, lphc->textRect.top,
|
||||
lphc->textRect.right - lphc->textRect.left,
|
||||
lphc->textRect.bottom - lphc->textRect.top,
|
||||
hwnd, (HMENU)ID_CB_EDIT,
|
||||
GetWindowLongA( hwnd, GWL_HINSTANCE ), NULL );
|
||||
else
|
||||
lphc->hWndEdit = CreateWindowExA(0, "Edit", NULL, lbeStyle,
|
||||
lphc->textRect.left, lphc->textRect.top,
|
||||
lphc->textRect.right - lphc->textRect.left,
|
||||
lphc->textRect.bottom - lphc->textRect.top,
|
||||
hwnd, (HMENU)ID_CB_EDIT,
|
||||
GetWindowLongA( hwnd, GWL_HINSTANCE ), NULL );
|
||||
|
||||
if( !lphc->hWndEdit )
|
||||
bEdit = FALSE;
|
||||
|
@ -1907,7 +1919,7 @@ static LRESULT ComboWndProc_common( HWND hwnd, UINT message,
|
|||
hwndParent = ((LPCREATESTRUCTA)lParam)->hwndParent;
|
||||
style = ((LPCREATESTRUCTA)lParam)->style;
|
||||
}
|
||||
return COMBO_Create(hwnd, lphc, hwndParent, style);
|
||||
return COMBO_Create(hwnd, lphc, hwndParent, style, unicode);
|
||||
}
|
||||
|
||||
case WM_PRINTCLIENT:
|
||||
|
@ -1973,9 +1985,10 @@ static LRESULT ComboWndProc_common( HWND hwnd, UINT message,
|
|||
case WM_CLEAR:
|
||||
if ((message == WM_GETTEXTLENGTH) && !ISWIN31 && !(lphc->wState & CBF_EDIT))
|
||||
{
|
||||
int j = SendMessageW(lphc->hWndLBox, LB_GETCURSEL, 0, 0);
|
||||
if (j == -1) return 0;
|
||||
return SendMessageW(lphc->hWndLBox, LB_GETTEXTLEN, j, 0);
|
||||
int j = SendMessageW(lphc->hWndLBox, LB_GETCURSEL, 0, 0);
|
||||
if (j == -1) return 0;
|
||||
return unicode ? SendMessageW(lphc->hWndLBox, LB_GETTEXTLEN, j, 0) :
|
||||
SendMessageA(lphc->hWndLBox, LB_GETTEXTLEN, j, 0);
|
||||
}
|
||||
else if( lphc->wState & CBF_EDIT )
|
||||
{
|
||||
|
@ -2218,7 +2231,8 @@ static LRESULT ComboWndProc_common( HWND hwnd, UINT message,
|
|||
wParam = (INT)(INT16)wParam;
|
||||
/* fall through */
|
||||
case CB_GETLBTEXTLEN:
|
||||
return SendMessageW(lphc->hWndLBox, LB_GETTEXTLEN, wParam, 0);
|
||||
return unicode ? SendMessageW(lphc->hWndLBox, LB_GETTEXTLEN, wParam, 0) :
|
||||
SendMessageA(lphc->hWndLBox, LB_GETTEXTLEN, wParam, 0);
|
||||
case CB_GETITEMDATA16:
|
||||
wParam = (INT)(INT16)wParam;
|
||||
/* fall through */
|
||||
|
|
|
@ -969,7 +969,9 @@ static LRESULT WINAPI EditWndProc_common( HWND hwnd, UINT msg,
|
|||
|
||||
case WM_GETTEXTLENGTH:
|
||||
DPRINTF_EDIT_MSG32("WM_GETTEXTLENGTH");
|
||||
result = strlenW(es->text);
|
||||
if (unicode) result = strlenW(es->text);
|
||||
else result = WideCharToMultiByte( CP_ACP, 0, es->text, strlenW(es->text),
|
||||
NULL, 0, NULL, NULL );
|
||||
break;
|
||||
|
||||
case WM_HSCROLL:
|
||||
|
|
|
@ -2608,8 +2608,10 @@ static LRESULT WINAPI ListBoxWndProc_common( HWND hwnd, UINT msg,
|
|||
case LB_GETTEXTLEN:
|
||||
if ((INT)wParam >= descr->nb_items || (INT)wParam < 0)
|
||||
return LB_ERR;
|
||||
return (HAS_STRINGS(descr) ? strlenW(descr->items[wParam].str)
|
||||
: sizeof(DWORD));
|
||||
if (!HAS_STRINGS(descr)) return sizeof(DWORD);
|
||||
if (unicode) return strlenW( descr->items[wParam].str );
|
||||
return WideCharToMultiByte( CP_ACP, 0, descr->items[wParam].str,
|
||||
strlenW(descr->items[wParam].str), NULL, 0, NULL, NULL );
|
||||
|
||||
case LB_GETCURSEL16:
|
||||
case LB_GETCURSEL:
|
||||
|
|
Loading…
Reference in New Issue