Sign in to follow this  
Followers 0
Stickman

GUICtrlCreateListView(), $LVS_SORTASCENDING and listviewID

1 post in this topic

I'm having a problem with a ListView control. It goes like this:

- I create the ListView with GUICtrlCreateListView() using the $LVS_SORTASCENDING option

- I populate the ListView with ListViewItems using GUICtrlCreateListViewItem(), from an array of data

- I store the listViewId returned from GUICtrlCreateListViewItem() in a lookup array (so I can link a listViewITem to the array element it's populated with)

All fine and dandy, except that when I test it, it seems that the lookup array is wrong: when I select a listViewItem and use the lookup array to find the corresponding array element, the wrong element is returned. However, if I remove the $LVS_SORTASCENDING option from GUICtrlCreateListView(), the problem goes away.

I've checked (and checked and checked...) and I'm sure the items are going in in the correct order, and the correct IDs are being stored with each listViewItem. It seems like the re-ordering of the listViewItems isn't preserving the relationship between listViewId and the text that appears in each listViewItem (ie. the IDs are in the same order, but the text 'moves').

I feel like I haven't explained it very well, but I hope that this makes sense.

So, does anyone have any suggestions that might help (besides "Don't use $LVS_SORTASCENDING" :whistle:).

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
Sign in to follow this  
Followers 0