Re: Win32Lib ListView + setUserProperty query
- Posted by Dave Probert <zingo at purpletiger.com> Jul 12, 2005
- 488 views
Derek Parnell wrote: > > Dave Probert wrote: > > [snip] > > > 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 > > > > The 'id' in the setUserProperty() call is meant to be a CONTROL and not the > value returned > by addLVItem(). It is designed to add a property to a control. Another method > you might > like to look at instead is ... > > }}} <eucode> -- loop through current LVITEM ids and remove the associated UserProperties here > 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(loclv,id&"identifier",ids[i]) > end if > end for > </eucode> {{{ Ah, thanks - that makes more sense. I kinda get confused with the Control (handles) and Indexes,etc that are returned by the various functions associated with Listviews, Treeviews and Droplists. I guess that it would be sensible to insert a routine to remove the old UserProperties just before the eraseItems() so that the userProps internal list doesn't fill up with junk. > > And then to retrieve the hidden data for a particular id ... > > }}} <eucode> > sequence temp > sequence hidden > temp = getUserProperty(loclv, id&"identifier") > if length(temp) > 0 then > hidden = temp[1] > else > hidden = {} > end if > </eucode> {{{ > Thanks again Derek. I guess I'd better go back through all my old code and fix it ;) Cheers, Dave . .. : :: = == == = :: : .. . 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 . .. : :: = == == = :: : .. .