[PATCH] comdlg32/fontdlg: Allow setting value by typing it into the edit fields
Fabian Maurer
dark.shadow4 at web.de
Sat Nov 11 09:15:17 CST 2017
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-insensitive and doesn't change the selection
in the edit field.
Signed-off-by: Fabian Maurer <dark.shadow4 at web.de>
---
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 c08b246e12..82992cb5a4 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;
--
2.15.0
More information about the wine-devel
mailing list