RE: Listview Item identifiers
- Posted by totorangi at hotmail.com Oct 01, 2002
- 449 views
As often happens I managed to solve most of this soon after posting! I had addLV.. and setLV.. back to front. I mistakenly said that setLVItemText uses the item Identifier whereas it actually needs the current row Index. Found a post about LVFINDINFO and so have used this to create a function called findLVItemIndex that returns the current item index after being passed an item identifier. Seems to do the trick. However, I would still like to know how to programmatically select and focus a row in a ListView. Rangi totorangi at hotmail.com wrote: > Trying to come to grips with Listviews and have found the archive here > useful but still have a problem with Identifiers. > > I have a listview with several columns of data. I also maintain a > sequence that duplicates data in the listview plus has additional data. > I want to programmatically update particular rows in the Listview with > data from the sequence. > > I made the now obvious classic mistake of using the Index returned from > addLVItem as my key for updating the Listview and it worked until I > happened to sort the listview. I use setLVItemText and SetLVImage to > update the Listview and I now see that they need the item Identifier and > > not the row Index. Problem is then how to get the item's Identifier > after doing each initial addLVItem. The only way I can find of getting > an Identifier is with getLVSelected but this assumes that a row is > selected in the first place. This is not the case after the AddLVItem. > I have tried a setIndex to programmatically select the row after it is > added but this doesn't seem to work on ListViews. > > Would appreciate tips on this. > > Thanks > Rangi > > Also, is it possible to view a whole thread on this list ? Search > returns useful stuff but I can't find any way of seeing the threads. > >