This allows to test whether an item is brought into view by selecting it,
see #11154.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64650
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
MENU_LINK(ShowPrevSibling)
MENU_LINK(ShowNextSibling)
MENU_LINK(ScrollTo)
MENU_LINK(ShowPrevSibling)
MENU_LINK(ShowNextSibling)
MENU_LINK(ScrollTo)
#undef MENU_LINK
END_EVENT_TABLE()
#undef MENU_LINK
END_EVENT_TABLE()
item_menu->AppendSeparator();
item_menu->Append(TreeTest_ScrollTo, "Scroll &to item",
"Scroll to the last by one top level child");
item_menu->AppendSeparator();
item_menu->Append(TreeTest_ScrollTo, "Scroll &to item",
"Scroll to the last by one top level child");
+ item_menu->Append(TreeTest_SelectLast, "Select &last item",
+ "Select the last item");
#ifndef NO_MULTIPLE_SELECTION
item_menu->AppendSeparator();
#ifndef NO_MULTIPLE_SELECTION
item_menu->AppendSeparator();
m_treeCtrl->ScrollTo(item);
}
m_treeCtrl->ScrollTo(item);
}
+void MyFrame::OnSelectLast(wxCommandEvent& WXUNUSED(event))
+{
+ // select the very last item of the tree
+ wxTreeItemId item = m_treeCtrl->GetRootItem();
+ for ( ;; )
+ {
+ wxTreeItemId itemChild = m_treeCtrl->GetLastChild(item);
+ if ( !itemChild.IsOk() )
+ break;
+
+ item = itemChild;
+ }
+
+ CHECK_ITEM( item );
+
+ m_treeCtrl->SelectItem(item);
+}
+
void MyFrame::OnSetFgColour(wxCommandEvent& WXUNUSED(event))
{
wxColour col = wxGetColourFromUser(this, m_treeCtrl->GetForegroundColour());
void MyFrame::OnSetFgColour(wxCommandEvent& WXUNUSED(event))
{
wxColour col = wxGetColourFromUser(this, m_treeCtrl->GetForegroundColour());
{ DoShowRelativeItem(&wxTreeCtrl::GetNextSibling, "next sibling"); }
void OnScrollTo(wxCommandEvent& event);
{ DoShowRelativeItem(&wxTreeCtrl::GetNextSibling, "next sibling"); }
void OnScrollTo(wxCommandEvent& event);
+ void OnSelectLast(wxCommandEvent& event);
void OnIdle(wxIdleEvent& event);
void OnSize(wxSizeEvent& event);
void OnIdle(wxIdleEvent& event);
void OnSize(wxSizeEvent& event);
TreeTest_ShowPrevSibling,
TreeTest_ShowNextSibling,
TreeTest_ScrollTo,
TreeTest_ShowPrevSibling,
TreeTest_ShowNextSibling,
TreeTest_ScrollTo,