Commit aa7941d4 authored by Fabian Maurer's avatar Fabian Maurer Committed by Alexandre Julliard

comdlg32/fontdlg: Allow setting value by typing it into the edit fields.

The font-dialog allows the user to select a value from the combobox by typing it into its edit field. This operation seems unique to the fontdialog. It works case-insensitively and doesn't change the selection in the edit field. Signed-off-by: 's avatarFabian Maurer <dark.shadow4@web.de> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 500f077d
......@@ -940,14 +940,37 @@ static LRESULT CFn_WMCommand(HWND hDlg, WPARAM wParam, LPARAM lParam, LPCHOOSEFO
int i;
long l;
HDC hdc;
BOOL cmb_selected_by_edit = FALSE;
if (!lpcf) return FALSE;
if(HIWORD(wParam) == CBN_EDITCHANGE)
{
int idx;
WCHAR str_edit[256], str_cmb[256];
int cmb = LOWORD(wParam);
GetDlgItemTextW(hDlg, cmb, str_edit, sizeof(str_edit) / sizeof(str_edit[0]));
idx = SendDlgItemMessageW(hDlg, cmb, CB_FINDSTRING, -1, (LPARAM)str_edit);
if(idx != -1)
{
SendDlgItemMessageW(hDlg, cmb, CB_GETLBTEXT, idx, (LPARAM)str_cmb);
/* Select listbox entry only if we have an exact match */
if(lstrcmpiW(str_edit, str_cmb) == 0)
{
SendDlgItemMessageW(hDlg, cmb, CB_SETCURSEL, idx, 0);
SendDlgItemMessageW(hDlg, cmb, CB_SETEDITSEL, 0, -1); /* Remove edit field selection */
cmb_selected_by_edit = TRUE;
}
}
}
TRACE("WM_COMMAND wParam=%08X lParam=%08lX\n", (LONG)wParam, lParam);
switch (LOWORD(wParam))
{
case cmb1:
if (HIWORD(wParam)==CBN_SELCHANGE)
if (HIWORD(wParam) == CBN_SELCHANGE || cmb_selected_by_edit)
{
INT pointsize; /* save current pointsize */
LONG pstyle; /* save current style */
......@@ -998,7 +1021,7 @@ static LRESULT CFn_WMCommand(HWND hDlg, WPARAM wParam, LPARAM lParam, LPCHOOSEFO
case cmb2:
case cmb3:
case cmb5:
if (HIWORD(wParam)==CBN_SELCHANGE || HIWORD(wParam)== BN_CLICKED )
if (HIWORD(wParam) == CBN_SELCHANGE || HIWORD(wParam) == BN_CLICKED || cmb_selected_by_edit)
{
WCHAR str[256];
WINDOWINFO wininfo;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment