diff --git a/include/wx/treelist.h b/include/wx/treelist.h index 65208cb0a1..9782903ef4 100644 --- a/include/wx/treelist.h +++ b/include/wx/treelist.h @@ -313,6 +313,7 @@ public: void SelectAll(); void UnselectAll(); + void EnsureVisible(wxTreeListItem item); // Checkbox handling // ----------------- diff --git a/interface/wx/treelist.h b/interface/wx/treelist.h index 6928a2d91d..e2e468f7f4 100644 --- a/interface/wx/treelist.h +++ b/interface/wx/treelist.h @@ -710,6 +710,13 @@ public: */ void UnselectAll(); + /** + Call this to ensure that the given item is visible. + + @since 3.1.0 + */ + void EnsureVisible(wxTreeListItem item); + //@} diff --git a/src/generic/treelist.cpp b/src/generic/treelist.cpp index fbcf393f9c..635ceef643 100644 --- a/src/generic/treelist.cpp +++ b/src/generic/treelist.cpp @@ -1400,6 +1400,14 @@ void wxTreeListCtrl::UnselectAll() m_view->UnselectAll(); } +void wxTreeListCtrl::EnsureVisible(wxTreeListItem item) +{ + wxCHECK_RET( m_view, "Must create first" ); + + m_view->EnsureVisible(m_model->ToDVI(item)); +} + + // ---------------------------------------------------------------------------- // Checkbox handling // ----------------------------------------------------------------------------