1. Att: Mat re:setListviewIndex
- Posted by Tony Steward <figjam at nlc.net.au> Jul 29, 2001
- 349 views
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. Thanks Tony Steward --cut from Matts email -- this function should be in .56, although the name will be different global function getLViItemFromlParam( integer id, integer lv_id ) atom findlv, item findlv = struct_LVFINDINFO( LVFI_PARAM, "", lv_id, 0, 0, 0 ) item = sendMessage( id, LVM_FINDITEM, -1, findlv ) release_mem( findlv ) return item end function -- Can set multiple selections, and first item will be made visible procedure setLVIndex( integer id, object sel ) integer iItem atom lvitem if atom(sel) then sel = {sel} end if lvitem = struct_LVITEM( LVIF_STATE, 0, 0, LVIS_SELECTED, LVIS_SELECTED, 0,0,0) for i = length( sel ) to 1 by -1 do iItem = getLViItemFromlParam( id, sel[i] ) store( lvitem, LVITEM_iItem, iItem ) VOID = sendMessage( id, LVM_SETITEMSTATE, iItem, lvitem ) end for VOID = sendMessage( id, LVM_ENSUREVISIBLE, iItem, 0 ) end procedure Matt Lewis -- end Matts email