Remove code maintaining last item from the treectrl sample.
The code was buggy (e.g. it didn't update the last item correctly after executing "Append many items" menu command) and seems to be unnecessary. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@75987 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -758,7 +758,12 @@ void MyFrame::OnCollapseAndReset(wxCommandEvent& WXUNUSED(event))
|
||||
|
||||
void MyFrame::OnEnsureVisible(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
m_treeCtrl->DoEnsureVisible();
|
||||
const wxTreeItemId
|
||||
idLast = m_treeCtrl->GetLastChild(m_treeCtrl->GetRootItem());
|
||||
if ( idLast.IsOk() )
|
||||
m_treeCtrl->EnsureVisible(idLast);
|
||||
else
|
||||
wxLogMessage("No last item");
|
||||
}
|
||||
|
||||
void MyFrame::OnSetFocus(wxCommandEvent& WXUNUSED(event))
|
||||
@@ -1167,12 +1172,6 @@ void MyTreeCtrl::AddItemsRecursively(const wxTreeItemId& idParent,
|
||||
wxTreeItemIcon_Expanded);
|
||||
}
|
||||
|
||||
// remember the last child for OnEnsureVisible()
|
||||
if ( !hasChildren && n == numChildren - 1 )
|
||||
{
|
||||
m_lastItem = id;
|
||||
}
|
||||
|
||||
AddItemsRecursively(id, numChildren, depth - 1, n + 1);
|
||||
}
|
||||
}
|
||||
@@ -1307,7 +1306,6 @@ void MyTreeCtrl::LogEvent(const wxChar *name, const wxTreeEvent& event)
|
||||
void MyTreeCtrl::name(wxTreeEvent& event) \
|
||||
{ \
|
||||
LogEvent(wxT(#name), event); \
|
||||
SetLastItem(wxTreeItemId()); \
|
||||
event.Skip(); \
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user