taskforce dialog handles 'enter' key properly, synced from FA2RN expansion .

This commit is contained in:
Zero Fanker 2024-06-11 21:42:57 -04:00
parent 358fd7e288
commit 9b2134cee9
2 changed files with 38 additions and 0 deletions

View file

@ -500,3 +500,38 @@ void CTaskForce::OnChangeGroup()
UpdateDialog();
}
BOOL CTaskForce::PreTranslateMessage(MSG* pMsg)
{
if (pMsg->message == WM_KEYDOWN) {
switch (pMsg->wParam) {
case VK_RETURN:
{
auto pEdit = this->m_UnitType.GetWindow(GW_CHILD);
if (pMsg->hwnd == pEdit->m_hWnd) {
this->OnEditchangeUnittype();
}
switch (::GetDlgCtrlID(pMsg->hwnd)) {
case IDC_NAME:
this->OnChangeName();
break;
case IDC_NUMBERUNITS:
this->OnChangeNumberunits();
break;
case IDC_GROUP:
this->OnChangeGroup();
break;
default:
break;
}
}
//do not exit dialog when enter key pressed
return TRUE;
default:
break;
}
}
return this->CDialog::PreTranslateMessage(pMsg);
}

View file

@ -61,6 +61,9 @@ protected:
// Implementierung
protected:
BOOL PreTranslateMessage(MSG* pMsg) override;
// Generierte Nachrichtenzuordnungsfunktionen
//{{AFX_MSG(CTaskForce)
afx_msg void OnEditchangeTaskforces();