diff --git a/ZRCola/zrcolacomppnl.cpp b/ZRCola/zrcolacomppnl.cpp index 24ebb92..f91c15d 100644 --- a/ZRCola/zrcolacomppnl.cpp +++ b/ZRCola/zrcolacomppnl.cpp @@ -24,7 +24,9 @@ // wxZRColaComposerPanel ////////////////////////////////////////////////////////////////////////// -wxZRColaComposerPanel::wxZRColaComposerPanel(wxWindow* parent) : wxZRColaComposerPanelBase(parent) +wxZRColaComposerPanel::wxZRColaComposerPanel(wxWindow* parent) : + m_progress(false), + wxZRColaComposerPanelBase(parent) { } @@ -36,17 +38,29 @@ wxZRColaComposerPanel::~wxZRColaComposerPanel() void wxZRColaComposerPanel::OnDecomposedText(wxCommandEvent& event) { - // TODO: Do the real ZRCola composition here. - m_composed->SetValue(m_decomposed->GetValue()); - - event.Skip(); + if (m_progress) { + // We are being updated by wxZRColaComposerPanel::OnComposedText() + event.Skip(); + } else { + // TODO: Do the real ZRCola composition here. + m_progress = true; + m_composed->SetValue(m_decomposed->GetValue()); + event.Skip(); + m_progress = false; + } } void wxZRColaComposerPanel::OnComposedText(wxCommandEvent& event) { - // TODO: Do the real ZRCola decomposition here. - m_decomposed->SetValue(m_composed->GetValue()); - - event.Skip(); + if (m_progress) { + // We are being updated by wxZRColaComposerPanel::OnDecomposedText() + event.Skip(); + } else { + // TODO: Do the real ZRCola decomposition here. + m_progress = true; + m_decomposed->SetValue(m_composed->GetValue()); + event.Skip(); + m_progress = false; + } } diff --git a/ZRCola/zrcolacomppnl.h b/ZRCola/zrcolacomppnl.h index 31dc631..1873869 100644 --- a/ZRCola/zrcolacomppnl.h +++ b/ZRCola/zrcolacomppnl.h @@ -43,4 +43,7 @@ public: protected: virtual void OnDecomposedText(wxCommandEvent& event); virtual void OnComposedText(wxCommandEvent& event); + +protected: + bool m_progress; ///< A boolean flag to avoid recursive updates of composed and decomposed text controls };