Fabian Maurer : comdlg32/fontdlg: Allow setting value by typing it into the edit fields.
Alexandre Julliard
julliard at winehq.org
Mon Nov 20 16:01:35 CST 2017
Module: wine
Branch: master
Commit: aa7941d41b2c66066dbc281bfa57364c1a60d863
URL: http://source.winehq.org/git/wine.git/?a=commit;h=aa7941d41b2c66066dbc281bfa57364c1a60d863
Author: Fabian Maurer <dark.shadow4 at web.de>
Date: Sat Nov 11 16:15:17 2017 +0100
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: Fabian Maurer <dark.shadow4 at web.de>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/comdlg32/fontdlg.c | 27 +++++++++++++++++++++++++--
1 file changed, 25 insertions(+), 2 deletions(-)
diff --git a/dlls/comdlg32/fontdlg.c b/dlls/comdlg32/fontdlg.c
index c08b246..82992cb 100644
--- a/dlls/comdlg32/fontdlg.c
+++ b/dlls/comdlg32/fontdlg.c
@@ -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;
More information about the wine-cvs
mailing list