wxListView only returning one column of data Topic is solved

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
rkamarowski
Knows some wx things
Knows some wx things
Posts: 34
Joined: Fri Jan 14, 2022 5:54 pm

wxListView only returning one column of data

Post by rkamarowski »

c++
vs2022

I have 3 columns of data in my listview. when I use GetItem(), I'm only getting the first (0) column.

Here's how I'm setting the data:
/

Code: Select all

/ 
		auto pos = it->first.find(".");
		auto rtn = it->first.substr(0, pos - 1);
		long iData = InsertItem(row, rtn);
		SetItem(row, 1, it->second.path);
		SetItem(row, 2, it->second.pathAndName);
Here's the event:

Code: Select all

Bind(wxEVT_LIST_ITEM_SELECTED, [this](wxListEvent& event)
		{
			onSelection(event.GetItem());
		});
Here's the onSelection:

Code: Select all

void BRoutineListView::onSelection(wxListItem item)
{
	
	int i = 0;
}
I have a breakpoint at the int i =0; line. Looking at 'item' there is only the first column of data. Not sure what I'm doing wrong.
I'd apprectiate any help.
User avatar
doublemax
Moderator
Moderator
Posts: 19116
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: wxListView only returning one column of data

Post by doublemax »

You need to fetch the data for the other columns yourself.
wxListCtrl::GetItemText()
https://docs.wxwidgets.org/trunk/classw ... 24f53e915f
Use the source, Luke!
rkamarowski
Knows some wx things
Knows some wx things
Posts: 34
Joined: Fri Jan 14, 2022 5:54 pm

Re: wxListView only returning one column of data

Post by rkamarowski »

Thank you doublemax!
Post Reply