ListIconGadget speed
ListIconGadget speed
Hey guys. I've got a ListIconGadget I need to populate with 70,000 (give or take) items. I was using Listview for this, but it runs out of space and can't handle that many items.
In populating the items, it takes a really long time. It was faster in XP and Windows 7, but under Windows 10 it takes a long time. Is there a way to speed up how fast we can populate such a list?
It was fast enough when I only had 30,000 but it's annoyingly slow now.
Any help is greatly appreciated.
In populating the items, it takes a really long time. It was faster in XP and Windows 7, but under Windows 10 it takes a long time. Is there a way to speed up how fast we can populate such a list?
It was fast enough when I only had 30,000 but it's annoyingly slow now.
Any help is greatly appreciated.
Missed it by that much!!
HK
HK
Re: ListIconGadget speed
Search incremental load listicongadget / listviewgadget.
There is no need to load that many rows.
Only load what can be showed within the viewable scroll area.
There is no need to load that many rows.

Only load what can be showed within the viewable scroll area.
The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum
Re: ListIconGadget speed
when populating, turn display off:
SendMessage_(GadgetID(#ListIcon),#WM_SETREDRAW,0,0)
at finish, turn it on:
SendMessage_(GadgetID(ListIcon),#WM_SETREDRAW,1,0)
HTH
SendMessage_(GadgetID(#ListIcon),#WM_SETREDRAW,0,0)
at finish, turn it on:
SendMessage_(GadgetID(ListIcon),#WM_SETREDRAW,1,0)
HTH
PureBasic: Surprisingly simple, diabolically powerful
Re: ListIconGadget speed
@harkon,
Please have a look at ListEx gadget by Thorsten1867.
It allows one to stop the gadget updating on the screen during the population.
It should load in 70,000 in a fraction of a second; at least that is my experience.
https://www.purebasic.fr/english/viewto ... 73#p533673
Please have a look at ListEx gadget by Thorsten1867.
It allows one to stop the gadget updating on the screen during the population.
It should load in 70,000 in a fraction of a second; at least that is my experience.
https://www.purebasic.fr/english/viewto ... 73#p533673
DE AA EB
- netmaestro
- PureBasic Bullfrog
- Posts: 8451
- Joined: Wed Jul 06, 2005 5:42 am
- Location: Fort Nelson, BC, Canada
Re: ListIconGadget speed
For quick loading of large datasets to a listicon gadget the key is #LVS_OWNERDATA. This is generally known as a "virtual listicon". You can search it on the forums for examples, here's one I found that didn't work and needed a couple tweaks:
Code: Select all
itemcount.i = 70000
Global Dim myItems.s(0)
#LVSICF_NOINVALIDATEALL = 1
#LVN_ODCACHEHINT = #LVN_FIRST - 13
Procedure WinCallback(hwnd, msg, wParam, lParam)
result = #PB_ProcessPureBasicEvents
Static field.s
Select msg
Case #WM_NOTIFY
*pnmh.NMHDR = lParam
Select *pnmh\code
Case #LVN_ODCACHEHINT
result = 0
Case #LVN_GETDISPINFO ;
*pnmlvdi.NMLVDISPINFO = lParam
If *pnmlvdi\item\mask & #LVIF_TEXT
line.s = myItems(*pnmlvdi\item\iItem)
If line
field = StringField(line, *pnmlvdi\item\iSubItem+1, #LF$)
EndIf
*pnmlvdi\item\pszText = @field
;
EndIf
EndSelect
EndSelect
ProcedureReturn result
EndProcedure
If OpenWindow(0, 100, 100, 800, 600, "ListIcon Example", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
SetWindowCallback(@WinCallback())
ListIconGadget(0, 5, 5, 780, 390, "A", 250,#LVS_OWNERDATA)
SendMessage_(GadgetID(0), #LVM_SETITEMCOUNT, 0, #LVSICF_NOINVALIDATEALL)
AddGadgetColumn(0, 1, "B", 255)
AddGadgetColumn(0, 2, "C", 200)
SendMessage_(GadgetID(0), #LVM_SETITEMCOUNT, ItemCount+1, #LVSICF_NOINVALIDATEALL)
For pos = 0 To itemcount
ReDim myItems(pos)
myItems(pos) = Str(pos) + #LF$ + "This is a bunch of text for "+Str(pos) + #LF$ + "This is a bunch more text"
Next
Repeat
Event = WaitWindowEvent()
Until Event = #PB_Event_CloseWindow
EndIf
BERESHEIT
Re: ListIconGadget speed
Thanks Netmeastro, that worked 100%. The project is cross platform and Linux has no issues with loading that many items into a listview. Windows was limited to the max number of items in the listview so I needed to use listicon. Rolled your code into my project and boom, starts right up.
With listicon, is there a way to eliminate the title row? If not it's no big deal.
With listicon, is there a way to eliminate the title row? If not it's no big deal.
Missed it by that much!!
HK
HK
Re: ListIconGadget speed
Specify the #LVS_NOCOLUMNHEADER flag for no ListIconGadget() header.harkon wrote:is there a way to eliminate the title row?
Code: Select all
ListIconGadget(0, 5, 5, 780, 390, "A", 250,#LVS_OWNERDATA|#LVS_NOCOLUMNHEADER)
Re: ListIconGadget speed
harkon wrote:The project is cross platform ...
Cross-platform exampleharkon wrote:With listicon, is there a way to eliminate the title row?
Re: ListIconGadget speed
Fabulous !!!
Thanks for this very simple solution.
Works perfectly for my needs (loading 15K-20K data lines into a ListView)
PB Forums : Proof positive that 2 heads (or more...) are better than one 
