1. Win32lib: setLVItem annoyance (a little bug actually)
- Posted by Guillermo Bonvehi <gbonvehi at gmail.com> May 13, 2007
- 657 views
Hi all again, I had to use listview for a program that handle a lot of clients data, so I toyed a little bit with addLVItem and setLVItem. The last one is faster when updating so I was choosing each based on the amount of data that was going to be updated. I first tought it was a error on my code, but doing a little of research trough the code I saw that addLVItem substracts 1 from iIcon and setLVItem doesn't. I'm just using setLVItem (lvLista, LVIF_IMAGE,1,1,0,0,"",Icono-1,0) right now, but a better solution if we follow win32lib's style would be to sub it on struct_LVITEM as it's done for row and columns numbers (addLVItem should be changed too in that case). Maybe this can be "fixed" on next release. Glad to read you all. Best regards, Guillermo Bonvehi - AKA: Caballero Rojo
2. Re: Win32lib: setLVItem annoyance (a little bug actually)
- Posted by CChris <christian.cuvier at agriculture.gouv.fr> May 15, 2007
- 652 views
Guillermo Bonvehi wrote: > > Hi all again, > I had to use listview for a program that handle a lot of clients data, so > I toyed a little bit with addLVItem and setLVItem. > The last one is faster when updating so I was choosing each based on the > amount > of data that was going to be updated. I first tought it was a error > on my code, but doing a little of research trough the code I saw that > addLVItem > substracts 1 from iIcon and setLVItem doesn't. > I'm just using setLVItem (lvLista, LVIF_IMAGE,1,1,0,0,"",Icono-1,0) right now, > but a better solution if we follow win32lib's style > would be to sub it on struct_LVITEM as it's done for row and columns numbers > (addLVItem should be changed too in that case). > Maybe this can be "fixed" on next release. > > Glad to read you all. > > Best regards, > Guillermo Bonvehi - AKA: Caballero Rojo Indeed there is an inconsistency here: addLVItem() corrects the image index by -1, since it expects Euphoria 1-based indexes and Window expects C 0-based indexes. insertLVItem() is a low level routine which doesn't make this correction. setLVItem() updates the specified item, and does not correct the image index. In that sense, it corresponds to insertLVItem() and is just as low level as it. There is probably a missing updateLVItem() more of the like of addLVItem(), which wouldn't set the state and would expect a 1-based image index if any. Use -1 (=w32GetValue soon) for text or image to mean don't touch it. Would this be a good addition to win32lib? (I am looking at all the user base here) CChris