Patch #2884 2009-12-27 21:30
techy
Don't call Expand on wxTreeCtrl with wxTR_HIDE_ROOT(debug12)- Download
- 2884-Don_t_call_Exp.patch (503 bytes)
Index: src/plugins/openfileslist/openfileslistplugin.cpp
===================================================================
--- src/plugins/openfileslist/openfileslistplugin.cpp (revision 5986)
+++ src/plugins/openfileslist/openfileslistplugin.cpp (working copy)
@@ -257,7 +257,6 @@
if(mgr->GetActiveEditor() == ed)
m_pTree->SelectItem(item);
m_pTree->SortChildren(m_pTree->GetRootItem());
- m_pTree->Expand(m_pTree->GetRootItem());
}
m_pTree->Thaw();
History
techy 2009-12-27 21:32
wxWidgets doesn't like when Expand() is called on wxTreeCtrl object with wxTR_HIDE_ROOT so don't do it.
mortenmacfly 2009-12-28 19:51
Can you provide a reference? Why do you say so?! I didn't find a note in the wx docs accordingly...
techy 2009-12-28 21:10
Well, this doesn't seem to be documented - I just got an assertion violation. However, if you look at the source code of wxWidgets, you can clearly see the "Can't expand/collapse hidden root node!" message here: void wxTreeCtrl::DoExpand(const wxTreeItemId& item, int flag) { wxASSERT_MSG( flag == TVE_COLLAPSE || flag == (TVE_COLLAPSE | TVE_COLLAPSERESET) || flag == TVE_EXPAND || flag == TVE_TOGGLE, wxT("Unknown flag in wxTreeCtrl::DoExpand") ); // A hidden root can be neither expanded nor collapsed. wxCHECK_RET( !IsHiddenRoot(item), wxT("Can't expand/collapse hidden root node!") );