Jump to content
briankyncl

Tracking list items between source array and ListView with indexes

Recommended Posts

Hello, I have an application populating a ListView. It iterates through a 2D array, adds the item to the ListView using GUICtrlCreateListViewItem(), and saves the returned controlID back into the 2D array. I then reference this controlID elsewhere in the application to read and modify the checkbox state of the item in the ListView.

I'd like to transition to populating the ListView with _GUICtrlListView_AddItem() or _GUICtrlListView_AddArray() but if an index (the position of the item in the ListView?) is returned by these functions, how do I keep track of the items relative to the original array when the item positions change, such as when a column header is clicked for sorting?

Share this post


Link to post
Share on other sites

After digging through the Help file more, I found the following functions which look like they'll solve my question.

_GUICtrlListView_MapIndexToID
_GUICtrlListView_MapIDToIndex

A good example of these functions in use found here.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...