Page 2 of 3

Re: Window ListIconGadget With Owner Data (Very Fast)

Posted: Sun Jan 04, 2026 12:53 pm
by ChrisR
Nicely done, thank you for sharing :)
UpdateListIconGadget after all AddGadgetItem, SetGadgetItemState or SetGadetItemColor, makes the difference for speed

Re: Window ListIconGadget With Owner Data (Very Fast)

Posted: Sun Jan 04, 2026 2:06 pm
by mk-soft
Update v1.04.7
- Changed max columns count to auto column count

The count of columns is no longer limited and the item data is automatically adjusted.
The constant #LISTICON_COLUMN_SIZE indicates the starting value of the created columns

Re: Window ListIconGadget With Owner Data (Very Fast)

Posted: Sun Jan 04, 2026 3:57 pm
by mk-soft
ChrisR wrote: Sun Jan 04, 2026 12:53 pm Nicely done, thank you for sharing :)
UpdateListIconGadget after all AddGadgetItem, SetGadgetItemState or SetGadetItemColor, makes the difference for speed
The biggest difference is the use of LVS_OWNERDATA. PureBasic needs about 300 ms to create 100000 items.
The ListView of MS several more than 50 seconds

;)

Re: Window ListIconGadget With Owner Data (Very Fast)

Posted: Sun Jan 04, 2026 7:31 pm
by Kwai chang caine
Nice work 8)
Have you planed to make manually editables cells ?

Re: Window ListIconGadget With Owner Data (Very Fast)

Posted: Mon Jan 05, 2026 1:37 am
by HeX0R
This would be a GridGadget and no ListIconGadget

Re: Window ListIconGadget With Owner Data (Very Fast)

Posted: Mon Jan 05, 2026 8:49 am
by Kwai chang caine
HeX0R wrote: Mon Jan 05, 2026 1:37 am This would be a GridGadget and no ListIconGadget
Aaaaah !!!
I hadn't noticed there was a difference. :oops:
So a gridgadget, is a manually editable listicongadget ?
And surely others options, but i don't know wich
So PB doesn't have Gridgadget, which is so useful. :|
Thanks HEXOR for have learning to me this différence 8)

Re: Window ListIconGadget With Owner Data (Very Fast)

Posted: Mon Jan 05, 2026 12:47 pm
by HeX0R
There were some quite good GridGadgets based on Canvas here in the forum, might be worth a search?

Re: Window ListIconGadget With Owner Data (Very Fast)

Posted: Mon Jan 05, 2026 3:02 pm
by Mindphazer
Hi mk-soft
That's indeed, pretty fast !!
It takes about 10000 ms to fill a "standard" ListIconGadget with 20.000 elements, and... 31 ms with your method !

It will be very useful for me !!
Thanks a lot

Re: Window ListIconGadget With Owner Data (Very Fast)

Posted: Tue Jan 06, 2026 4:18 pm
by mk-soft
Update v1.05.1
- Added Item Images Support
- Bugfix AddGadgetColumn

I've expanded it a little bit ;)

Re: Window ListIconGadget With Owner Data (Very Fast)

Posted: Tue Jan 06, 2026 6:20 pm
by ChrisR
Thanks for the improvements, images support, a nice ListIconGadgetEx :)
It would be a bonus if we could set colors on the header, as done here, of course, if it suits you

Re: Window ListIconGadget With Owner Data (Very Fast)

Posted: Tue Jan 06, 2026 9:14 pm
by Kwai chang caine
HeX0R wrote: Mon Jan 05, 2026 12:47 pm There were some quite good GridGadgets based on Canvas here in the forum, might be worth a search?
Yes i know, there is several ListIcons manually modified on the forum, a style of basic EXCEL, because this subject really interesting me, since a long time, but :

1/ I didn't know that was called a GridGadget (For me ListIcon and GridGadget were the same thing, before you told me. :oops: )

2/ If I'm not mistaken, this Gridgadgets aren't based on virtual listicons.They're slow to load thousands of rows. :|
For the moment, unless I'm mistaken or have omitted something, i haven't find a working ListIcon very quick AND manually modified :cry:

Re: Window ListIconGadget With Owner Data (Very Fast)

Posted: Tue Jan 06, 2026 11:52 pm
by mk-soft
Not fast, but works ...

Said's Canvas GridGadget
Link: viewtopic.php?f=12&t=54022

Last Update v2.4:
Link: https://github.com/mk-soft-65/MyGrid

But this is about the ListIconGadget from PureBasic and not a GridGadget. :wink:

Re: Window ListIconGadget With Owner Data (Very Fast)

Posted: Wed Jan 07, 2026 9:02 am
by Kwai chang caine
Thanks Mksoft
Yes i have see this splendid code, furthermore creating with a canvas, so starting from nothing, all by drawing... incredible :shock:
But i search something like EXCEL able to load numerous thousand of lines the most faster possible, exactely like your or RASHAD nice code 8)
Unfortunately without cells editables :| ... This important function for me
I remember me, trying to modify the RASHAD code for adding this function, but like usually without succes :oops:
But now, thanks to HEXOR i have understand i must search virtual gridgadget for have this two functions together :wink:

Re: Window ListIconGadget With Owner Data (Very Fast)

Posted: Wed Jan 07, 2026 3:52 pm
by Michael Vogel
Great and slim - cool work, thank you.


I'll keep the version without image support also because this should include everything needed most of the time.
Maybe some flags like #ListIcon_EnableImageSupport combined with some CompilerIf could be used to create an all in one solution.

Editing cells would also add additional overhead even this functionality is not used. Maybe a simple StringGadget at the top/bottom outside the original code would be enough in some situations. I added a quick method to get the right column (windows only):

Code: Select all

; AddOn
Procedure GetRowColumn(listicon,*row.Integer,*col.Integer)

	Protected p.Point
	Protected handle
	Protected hCWnd
	Protected header
	Protected hi.LVHITTESTINFO

	GetCursorPos_(@p)
	handle=GadgetID(listicon)
	ScreenToClient_(handle,p)

	hCWnd=	ChildWindowFromPoint_(handle,p\y<<32 + p\x)
	header=	SendMessage_(handle,#LVM_GETHEADER,0,0)
	hi\pt=	p
	SendMessage_(handle,#LVM_SUBITEMHITTEST,0,@hi)

	If hCWnd And hCWnd<>header
		*row\i=hi\iItem
		*col\i=hi\iSubItem
		ProcedureReturn #True
	EndIf

	ProcedureReturn #Null

EndProcedure
A call within the gadget event loop could look like this then (just for demonstration, no editing can be done here):

Code: Select all

	Case #PB_EventType_LeftClick
		Protected row,col
		If GetRowColumn(0,@row,@col)
			StatusBarText(0,0,"R:"+Str(row)+" C:"+Str(col)+" = '"+GetGadgetItemTextEx(0,row,col)+"'")
		EndIf

Re: Window ListIconGadget With Owner Data (Very Fast)

Posted: Wed Jan 07, 2026 8:11 pm
by mk-soft
Michael Vogel wrote: Wed Jan 07, 2026 3:52 pm Great and slim - cool work, thank you.


I'll keep the version without image support also because this should include everything needed most of the time.
Maybe some flags like #ListIcon_EnableImageSupport combined with some CompilerIf could be used to create an all in one solution.
Edit:
A #ListIcon_EnableImageSupport is not required. Only when an image is used, the required image list is created.
The time difference between the version with or without images is very small. Maybe a 1ms at 100000 items.

If you use the one without image support, you must clean up the AddGadgetColumn bug yourself.