Re: SetIndex - List View

new topic     » goto parent     » topic index » view thread      » older message » newer message

This is the same info contained in deleteItem
I looked at that too for a brief moment but
couldnt figure out how to send the new Item
to the top position in the LV.

hence my one liner which I wasnt sure would do what he wanted.

Good Job Matt

I hope someday soon to understand all the conversions from the
MS-SDK to Win32lib "I WILL EVENTUALLY"

Euman
euman at bellsouth.net



----- Original Message ----- 
From: "Matthew Lewis" > 
> -- 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
>

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu