Win32Lib ListView + setUserProperty query
- Posted by Dave Probert <zingo at purpletiger.com> Jul 11, 2005
- 527 views
Hi All, I've been using listviews (LV) for a while with win32lib and usually I use setUserProperty (SUP) for each row with my hidden data (often sequence information). In my current application I've got an LV which is updated often from queries to a DB and the data row identifier is SUP'd each time. I use eraseItems() followed by loops of addLVItem() and SUP. But, for some reason, after a few rebuilds the userProperty vanishes - as in getUserProperty returns nothing. The first few times everything works perfectly and the code doesn't change, but it seems just to forget about the hidden data! I've pored over the win32lib.ew code and can see nothing wrong in it, and my code is the same as I've used many times before with success. Has anyone else come across this sort of problem either with ListViews or TreeViews? Sorry but the full code is waaaay to big to post here, but here's the lines that fill the listview:
-- loclv is the ListView -- data is a sequence of values for a row -- ids is a matching sequence containing the DB row id's eraseItems(loclv) tmph = 0 for i=length(data) to 1 by -1 do id = addLVItem(loclv,tmph,data[i]) -- add row at a time if i<= length(ids) then setUserProperty(id,"identifier",ids[i]) end if end for
I would use setLVUserProperty, but the row id's are often character strings. Cheers, Dave PS. Derek - looking forward to the next win32lib :) . .. : :: = == == = :: : .. . Server-Side DB driven web sites, Software Development (and part-time games developer) contact dave_p at purpletiger dot com or probert.dave at gmail dot com . .. : :: = == == = :: : .. .