wxtreectrl get item with description

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
Wolfgang
I live to help wx-kind
I live to help wx-kind
Posts: 174
Joined: Mon Jan 28, 2019 8:22 am

wxtreectrl get item with description

Post by Wolfgang » Thu Sep 19, 2019 12:07 pm

I know in a trreevent I get the item Description like that:

Code: Select all

wxTreeItemId test;
	test = event.GetItem();
	MyTreeItemData *item = (MyTreeItemData *)m_treeCtrl->GetItemData(test);
	wxString help, help1, help2, help3;
	wxInt16 helpd1, helpd2, helpd3;
	help = item->GetDesc();
But now I would need to select the item fitting to a description, and not within an event.

PB
Part Of The Furniture
Part Of The Furniture
Posts: 2512
Joined: Sun Jan 03, 2010 5:45 pm

Re: wxtreectrl get item with description

Post by PB » Thu Sep 19, 2019 12:29 pm

If you want to find an item with a specific item data, you probably need to iterate the whole tree (which can be slow).

See e.g. here for examples showing how to do that
https://wiki.wxwidgets.org/WxTreeCtrl#I ... wxTreeCtrl

Post Reply