Fix regression Run Macro Multiple Times cmd

Not changing times immediately from edit control.

Fix #13561, close #13563
This commit is contained in:
ozone10 2023-04-21 21:54:17 +02:00 committed by Don Ho
parent c76f178534
commit 80b34f0adf
1 changed files with 48 additions and 3 deletions

View File

@ -130,17 +130,62 @@ intptr_t CALLBACK RunMacroDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM l
return TRUE;
case IDOK:
{
if (::SendDlgItemMessage(_hSelf, IDC_MACRO_COMBO, CB_GETCOUNT, 0, 0) > 0)
::SendMessage(_hParent, WM_MACRODLGRUNMACRO, 0, 0);
return TRUE;
}
default:
if ((HIWORD(wParam) == CBN_SELCHANGE) && (LOWORD(wParam) == IDC_MACRO_COMBO))
{
switch (LOWORD(wParam))
{
_macroIndex = static_cast<int32_t>(::SendDlgItemMessage(_hSelf, IDC_MACRO_COMBO, CB_GETCURSEL, 0, 0));
return TRUE;
case IDC_MACRO_COMBO:
{
if (HIWORD(wParam) == CBN_SELCHANGE)
{
_macroIndex = static_cast<int32_t>(::SendDlgItemMessage(_hSelf, IDC_MACRO_COMBO, CB_GETCURSEL, 0, 0));
return TRUE;
}
return FALSE;
}
case IDC_M_RUN_TIMES:
{
switch (HIWORD(wParam))
{
case EN_KILLFOCUS:
{
const int times = ::GetDlgItemInt(_hSelf, IDC_M_RUN_TIMES, nullptr, FALSE);
if (times < 1)
{
::SetDlgItemInt(_hSelf, IDC_M_RUN_TIMES, 1, FALSE);
return TRUE;
}
return FALSE;
}
case EN_CHANGE:
{
_times = std::max<int>(::GetDlgItemInt(_hSelf, IDC_M_RUN_TIMES, nullptr, FALSE), 1);
return TRUE;
}
default:
{
return FALSE;
}
}
}
default:
{
return FALSE;
}
}
}
}
}
}