[Win32lib] Listview speed
- Posted by euman at bellsouth.net Jun 14, 2002
- 413 views
Hello Matt Lewis and all, The (below) procedure is faster for loading Items into a listview however, I havent figured out how I plan to sort the data using this routine. I'll work on this some more tonight. You also can not sort the listview using the current Win32lib sort algorythm and this procedure, perhaps someone who knows the lib better would do this. If your plans are to not allow sorting then this will be a better choice for speed. -- add to Win32lib global procedure LoadLVInfo(atom id, sequence alldata) integer howmany handle = getHandle(id) howmany = length(alldata) for i = 1 to howmany do LV_ITEM = acquire_mem(0, SIZEOF_LVITEM ) store( LV_ITEM, LVITEM_mask, LVIF_TEXT ) store( LV_ITEM, LVITEM_iItem, i-1) data = alldata(i) subitem = 0 for x = 1 to length(data) do store( LV_ITEM, LVITEM_iSubItem, subitem ) store( LV_ITEM, LVITEM_pszText, data[x] ) store( LV_ITEM, LVITEM_cchTextMax, length(data[x]) ) subitem += 1 if subitem = 1 then junk = w32Func( xSendMessage, { handle, LVM_INSERTITEM, 0, LV_ITEM } ) else junk = w32Func( xSendMessage, { handle, LVM_SETITEM, i-1, LV_ITEM } ) end if end for store( LV_ITEM, LVITEM_lParam, i ) release_mem(LV_ITEM) end for end procedure P.S this routine would be faster if hacked. e.g straight pokes( ) instead of store( ) and/or, inlining the routine in your program. Good Day! Euman euman at bellsouth.net ================================================================== The information contained in this message may be confidential and is intended to be exclusively for the addressee. Should you receive this message unintentionally, please do not use the contents herein and notify the sender immediately by return e-mail. ==================================================================