From aeb807ca16d7f5b2a8cdfadc593fb68c710f8c0c Mon Sep 17 00:00:00 2001 From: Zero Fanker Date: Sat, 14 Dec 2024 15:22:04 -0500 Subject: [PATCH] Fix: Trigger Name not updated when switching tab . --- MissionEditor/TriggerOptionsDlg.cpp | 19 ++++++++++++++++++- MissionEditor/TriggerOptionsDlg.h | 2 ++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/MissionEditor/TriggerOptionsDlg.cpp b/MissionEditor/TriggerOptionsDlg.cpp index 0eac96e..11c8cc5 100644 --- a/MissionEditor/TriggerOptionsDlg.cpp +++ b/MissionEditor/TriggerOptionsDlg.cpp @@ -65,6 +65,7 @@ void CTriggerOptionsDlg::DoDataExchange(CDataExchange* pDX) BEGIN_MESSAGE_MAP(CTriggerOptionsDlg, CDialog) //{{AFX_MSG_MAP(CTriggerOptionsDlg) + ON_WM_SHOWWINDOW() ON_CBN_EDITCHANGE(IDC_HOUSE, OnEditchangeHouse) ON_CBN_EDITCHANGE(IDC_ATTACHEDTRIGGER, OnEditchangeAttachedtrigger) ON_EN_KILLFOCUS(IDC_NAME, OnChangeName) @@ -237,10 +238,26 @@ void CTriggerOptionsDlg::OnKillfocusName() void CTriggerOptionsDlg::OnKillFocus(CWnd* pNewWnd) { CDialog::OnKillFocus(pNewWnd); - ((CTriggerEditorDlg*)(this->GetOwner()->GetOwner()))->UpdateDialog(); } +void CTriggerOptionsDlg::OnShowWindow(BOOL bShow, UINT nStatus) +{ + if (!bShow) { + if (auto pOldFocus = GetFocus()) { + switch (pOldFocus->GetDlgCtrlID()) + { + case IDC_NAME: { + this->OnChangeName(); + } break; + default: + break; + } + } + } + CDialog::OnShowWindow(bShow, nStatus); +} + void CTriggerOptionsDlg::OnEditchangeTriggertype() { CIniFile& ini = Map->GetIniFile(); diff --git a/MissionEditor/TriggerOptionsDlg.h b/MissionEditor/TriggerOptionsDlg.h index 3a96609..360be8a 100644 --- a/MissionEditor/TriggerOptionsDlg.h +++ b/MissionEditor/TriggerOptionsDlg.h @@ -66,6 +66,8 @@ protected: CToolTipCtrl m_tooltip; virtual BOOL OnInitDialog(); + void OnShowWindow(BOOL bShow, UINT nStatus); + // Generierte Nachrichtenzuordnungsfunktionen //{{AFX_MSG(CTriggerOptionsDlg) afx_msg void OnChangeName();