keeping track of listview items
I have a question about keeping track of listview items.
I am thinking of using a multidimensional array of pointers for the items. multidimensional for each row and column in the listview control. right now I am adding the columns' text with an array of pointers through a loop (a rather efficient method, compared to how I was doing it before with constants).
if you don't remember my last thread, I am activating a (dynamic) floating popup menu on the NM_RCLICK message from hwndList. in the popup menu, there are 3 options. Add, Remove, and Save.
I would like the Save option enabled (not MF_GRAYED) only if there are at least 2 items in the listview. in order to do this, I need to keep track of the listview items somehow. right now when they get added, I am not even properly filling the LVITEM structure. the iItem member is remaining 0, even on multiple additions (it is still working, however).
also, in order to use the multidimensional array of pointers for the item text, I need to know the number and the order of items, so that I can access them through indexing. I am thinking I could use a for loop for this (with a global iIndex variable for item numbers), but can't possibly think of how (note that there are subitems in the column) :confused: . I would need to increment iIndex by 1 every time an item is added, and decrement it every time an item is removed. I could use this same iIndex variable for the multidimensional array of pointers "rows" index, and access the item's text with it appropriately.
so that is where I am at now. I have somewhat of a design plan, but just can't think of how to possibly implement it.
could anyone please help me out here?
ANY help at all would be appreciated. I am really stuck here.