1. Re: Listview and time...

Euman wrote: 
> Could someone check this code to make it faster..

Here's my effort, but check it very, very carefully first...
------------------------
sequence data, subdata
integer item, subitem
atom LV_ITEM, VOID, hWnd, cmd, pItem, pSubItem, 
     cString, pTextLen

-- Get the handle for this control once.
hWnd = getHandle(LV_id)

-- Pre allocate some memory areas and addresses.
LV_ITEM = struct_LVITEM(lvitem_MASK, 0, 0, 0, 0, 0, 0, 0)
pItem = LV_ITEM + 4
pSubItem = LV_ITEM + 8
-- WARNING!: This only copes with data up to 499 bytes!
cString = acquire_mem(LV_ITEM, 500)
poke4( LV_ITEM + 20, cString )
pTextLen = LV_ITEM + 24

item = 0
for ix = length(data) to 1 by -1 do
     poke4( pItem, item)
     subitem = 0
     cmd = LVM_INSERTITEM
     for xi = 1 to length(data[ix]) do
          subdata = data[ix][xi]
          poke4( pSubItem, subitem)
          poke(cString, subdata)
          poke(cString + length(subdata) , 0)
          poke4(pTextLen, length(subdata) )
          VOID =  w32Func( xSendMessage, { hWnd, cmd, subitem, LV_ITEM } )

          subitem += 1
          cmd = LVM_SETITEMTEXT
     end for
     item += 1

end for
release_mem(LV_ITEM)
----------------

Derek Parnell
Melbourne, Australia
"To finish a job quickly, go slower."

new topic     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu