Fix file name field highlighted while focus is on type combobox in Save As dialog

Fix #11517, close #11540
This commit is contained in:
mere-human 2022-04-16 18:46:52 +03:00 committed by Don Ho
parent 87f4249d6b
commit c94d50842e
1 changed files with 10 additions and 1 deletions

View File

@ -302,7 +302,16 @@ public:
_currentType = dialogIndex;
generic_string name = getDialogFileName(_dialog);
if (changeExt(name, dialogIndex - 1))
return SUCCEEDED(_dialog->SetFileName(name.c_str()));
{
// Set the file name and clear the selection in the edit box.
// The selection is implicitly modified by SetFileName().
DWORD selStart = 0;
DWORD selEnd = 0;
bool ok = SUCCEEDED(_dialog->SetFileName(name.c_str()));
if (ok)
SendMessage(_hwndNameEdit, EM_SETSEL, selStart, selEnd);
return ok;
}
return false;
}