Re: Matt re:setListviewIndex
- Posted by Tony Steward <figjam at nlc.net.au> Aug 01, 2001
- 437 views
Hi Matt & all Euphorians, Thanks again Matt but the proc. you sent (Below) does not make the row set in setIndex for a listview visible. Ie it doesn't scroll into view automatically. I have played with it quite a bit but with my limited knowledge I cant make it do what I want. Also as you said with large LV it is very slow, how can I get it to only go through the selected items in the list to reset them. Alternatively the earlier proc you sent me works fine I just need to know how to set the selected items to unselected. Thanks again Tony Steward > >----- Original Message ----- >From: "Tony Steward" <figjam at nlc.net.au> > > > Hi Matt or anyone who can help, > > Matt sent me the routine below so I could set the index of a listview, > > which works well thanks thankyou. At the moment when you set one index > that > > index is made visible and highlighted. If you then set a second index both > > are highlighted. I would prefer that when an index is set that the > previous > > selection be cleared. Is this possible. > >You're correct. That code only changes the status of the item you've >specified, but doesn't 'unselect' the currently selected item(s). I'm not >certain when I sent that to you, but in my copy of .55, I've modified setIndex >(did it on 1/26/01): > >I added integers: >integer msg, >-- added for listview: > start, check, ix, count > >and added an elsif clause that cycles through the listview and >deselects/selects as appropriate. It might be faster for larger listviews to >merely get the selected group of items and deselect those, then selecting your >list. > >elsif window_type[id] = ListView then > > if atom( index ) then > index = { index } > end if > > start = 0 > > result = struct_LVITEM( LVIF_STATE, start, 0, 0, > LVIS_SELECTED, 0, 0, 0 ) > > store( result, LVITEM_stateMask, LVIS_SELECTED ) > count = sendMessage( id, LVM_GETITEMCOUNT, 0, 0) > while count do > > ix = getLVItemlParam( id, start ) > if find( ix, index ) then > store( result, LVITEM_state, LVIS_SELECTED ) > else > store( result, LVITEM_state, 0 ) > end if > > VOID = sendMessage( id, LVM_SETITEMSTATE, start, result ) > start += 1 > count -= 1 > end while > > -- release the structure from memory > ix = new_memset() > manage_mem( ix, result ) > release_mem( ix ) > return > > >===== >Matt Lewis >http://www14.brinkster.com/matthewlewis > > Regards Tony Steward Come Visit Me At www.locksdownunder.com Give your hardest tasks to the laziest workers, as they will find the easiest way to complete it.