diff --git a/MissionEditor/TaskForce.cpp b/MissionEditor/TaskForce.cpp index c0e0d8d..6360b84 100644 --- a/MissionEditor/TaskForce.cpp +++ b/MissionEditor/TaskForce.cpp @@ -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); +} \ No newline at end of file diff --git a/MissionEditor/TaskForce.h b/MissionEditor/TaskForce.h index 4ca7e15..4cb83f3 100644 --- a/MissionEditor/TaskForce.h +++ b/MissionEditor/TaskForce.h @@ -61,6 +61,9 @@ protected: // Implementierung protected: + + BOOL PreTranslateMessage(MSG* pMsg) override; + // Generierte Nachrichtenzuordnungsfunktionen //{{AFX_MSG(CTaskForce) afx_msg void OnEditchangeTaskforces();