Cross update of composed and decomposed text controls fixed

This commit is contained in:
Simon Rozman 2016-02-08 14:57:46 +01:00
parent 21fa70a828
commit aad2b347a6
2 changed files with 26 additions and 9 deletions

View File

@ -24,7 +24,9 @@
// wxZRColaComposerPanel // 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) void wxZRColaComposerPanel::OnDecomposedText(wxCommandEvent& event)
{ {
// TODO: Do the real ZRCola composition here. if (m_progress) {
m_composed->SetValue(m_decomposed->GetValue()); // We are being updated by wxZRColaComposerPanel::OnComposedText()
event.Skip(); 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) void wxZRColaComposerPanel::OnComposedText(wxCommandEvent& event)
{ {
// TODO: Do the real ZRCola decomposition here. if (m_progress) {
m_decomposed->SetValue(m_composed->GetValue()); // We are being updated by wxZRColaComposerPanel::OnDecomposedText()
event.Skip(); event.Skip();
} else {
// TODO: Do the real ZRCola decomposition here.
m_progress = true;
m_decomposed->SetValue(m_composed->GetValue());
event.Skip();
m_progress = false;
}
} }

View File

@ -43,4 +43,7 @@ public:
protected: protected:
virtual void OnDecomposedText(wxCommandEvent& event); virtual void OnDecomposedText(wxCommandEvent& event);
virtual void OnComposedText(wxCommandEvent& event); virtual void OnComposedText(wxCommandEvent& event);
protected:
bool m_progress; ///< A boolean flag to avoid recursive updates of composed and decomposed text controls
}; };