diff --git a/source/xUI/UITree.cpp b/source/xUI/UITree.cpp index e3f3ae17847da466fb7232bc59559725a89c285d..4992ed0c705ef2389f972ac95e69c677f16df612 100644 --- a/source/xUI/UITree.cpp +++ b/source/xUI/UITree.cpp @@ -294,13 +294,10 @@ void CUITree::dispatchEvent(gui::IEvent *ev) if(m_pAdapter) { - UINT uCols = m_pAdapter->getColumnCount(); - for(UINT i = 0; i < uCols; ++i) - { - setColumnWidth(i, m_pAdapter->getColumnHeaderWidth(i, m_uWidth)); - } + abortEdit(); - updateVisibleNodes(); + m_bScheduledResize = true; + m_pUIWindow->registerForUpdate(this); } } } @@ -427,7 +424,21 @@ void CUITree::dispatchEvent(gui::IEvent *ev) } else if(ev->type == gui::GUI_EVENT_TYPE_UPDATE) { - updateDataset(); + if(m_bScheduledDatasetChange) + { + m_bScheduledDatasetChange = false; + updateDataset(); + } + if(m_bScheduledResize) + { + m_bScheduledResize = false; + UINT uCols = m_pAdapter->getColumnCount(); + for(UINT i = 0; i < uCols; ++i) + { + setColumnWidth(i, m_pAdapter->getColumnHeaderWidth(i, m_uWidth)); + } + updateVisibleNodes(); + } } } @@ -455,7 +466,11 @@ void XMETHODCALLTYPE CUITree::notifyDatasetChanged() abortEdit(); - m_pUIWindow->registerForUpdate(this); + if(!m_bScheduledDatasetChange) + { + m_bScheduledDatasetChange = true; + m_pUIWindow->registerForUpdate(this); + } } void XMETHODCALLTYPE CUITree::notifySelectionChanged() diff --git a/source/xUI/UITree.h b/source/xUI/UITree.h index aed8ea05091e28b691a1d931c65500ff0a9686c1..cb5b837505817e9888f6c5a2bf6256ebeadfc2a6 100644 --- a/source/xUI/UITree.h +++ b/source/xUI/UITree.h @@ -104,6 +104,9 @@ private: UITreeNodeHandle m_hFocusNode = NULL; + bool m_bScheduledResize = false; + bool m_bScheduledDatasetChange = false; + private: void setColumnCount(UINT uCount); UINT getColumnCount();