Limit of the listicon gadget.

Just starting out? Need help? Post your questions and find answers here.
User avatar
a_carignan
User
User
Posts: 98
Joined: Sat Feb 21, 2009 2:01 am
Location: Canada

Limit of the listicon gadget.

Post by a_carignan »

Hello, I would like to know the limits of listicongadget.
How many columns can it support?
How many lines can it support?
how many cells can it support?
Thank you for your collaboration. This is to find out the maximum number of names that should be created to define, the rows, the columns and the cells.
User avatar
spikey
Enthusiast
Enthusiast
Posts: 764
Joined: Wed Sep 22, 2010 1:17 pm
Location: United Kingdom

Re: Limit of the listicon gadget.

Post by spikey »

I did some tests a while back for one of my own apps to see what might happen when a database got big.
This information is Windows only - I never did these tests on the other platforms, but the test code will run unmodified on the others apart from the API calls.

Column wise - there is a limit on the number of columns that the control will support properly. At the time I didn't find any supporting documentation to describe it offically so I don't know what the precise cause is. Somewhere around 300 columns the header stops working properly and stops displaying the later column titles. You can't resize column width properly and the sync on scroll between the header/data area also gets messed up totally. This will limit the number of columns that you can viably create. (I think anyone creating this many columns needs to rethink their design though!)

Column performance seems to be slightly worse than row performance, which didn't really surprise me after the experience above.
That is to say that a control with N rows and M columns will perform slightly better than a control with M rows and N columns where N >> M.

Row wise - The major limiting factor will be response times, with initial load times the slowest. Your users will be complaining about the poor peformance of the application long before you reach any limits of the control. Performance will alter per the spec of machine and the amount of available RAM.

Code: Select all

#Width = 600
#Height = 400

; Load becomes noticable.
#Rows = 200
#Columns = 10

; Load takes over a minute.  You can improve this with SetRedraw.
; #Rows = 100000
; #Columns = 30

; Load takes nearly two minutes.
; #Rows = 100000
; #Columns = 100

; This one works fine.
; #Rows = 400
; #Columns = 2

; This one is broken. 
; The last columns won't display in the header.  Header/layout will get out of sync on h-scrolling.
; #Rows = 2
; #Columns = 400

Define.S sText
Define.I iCol, iRow, iEvent

If OpenWindow(0, 50, 50, #Width, #Height, "ListIcon Example", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
  ListIconGadget(0, 5, 5, #Width - 10, #Height - 10, "Column 1", 100, #PB_ListIcon_FullRowSelect | #PB_ListIcon_AlwaysShowSelection)
  
  ; This will improve load times (a bit).
  ; SendMessage_(GadgetID(0), #WM_SETREDRAW, #False, 0)
  
  For iCol = 2 To #Columns
    AddGadgetColumn(0, iCol, "Column " + StrU(iCol), 100) 
  Next iCol
  
  For iRow = 1 To #Rows
    sText = #Empty$
    
    For iCol = 1 To #Columns
      sText + "Item " + StrU(iRow) + "." + StrU(iCol) + Chr(10)
    Next iCol
    
    AddGadgetItem(0, -1, sText)  
  Next iRow
  
  ; Need this too if you have the one above uncommented.
  ; SendMessage_(GadgetID(0), #WM_SETREDRAW, #True, 0)
  
  Repeat
    iEvent = WaitWindowEvent()
  Until iEvent = #PB_Event_CloseWindow
  
EndIf
Last edited by spikey on Sat Feb 29, 2020 3:17 pm, edited 1 time in total.
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Re: Limit of the listicon gadget.

Post by srod »

On Windows, at least up to Win 7, the ListIcon header has a max width of 32767 pixels. If your total column widths exceed this value then expect problems! :)
I may look like a mule, but I'm not a complete ass.
User avatar
spikey
Enthusiast
Enthusiast
Posts: 764
Joined: Wed Sep 22, 2010 1:17 pm
Location: United Kingdom

Re: Limit of the listicon gadget.

Post by spikey »

srod wrote:the ListIcon header has a max width of 32767 pixels.
Ah, that'll be it then - where did you find that documented? I'd like to read the rest of the citation...
User avatar
a_carignan
User
User
Posts: 98
Joined: Sat Feb 21, 2009 2:01 am
Location: Canada

Re: Limit of the listicon gadget.

Post by a_carignan »

thanks for the information. :)
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Re: Limit of the listicon gadget.

Post by srod »

spikey wrote:
srod wrote:the ListIcon header has a max width of 32767 pixels.
Ah, that'll be it then - where did you find that documented? I'd like to read the rest of the citation...
Found that out the hard way some years ago! :) I assume it has something to do with the old 16-bit scrolling/positioning messages and the fact that some windows messages combine x/y positions in a single 32-bit value etc, but I am not 100% sure about that. You get the same problems with PB's scrollarea gadget if you resize the scrollareawidth/height beyond this same limit - at least things used to be this way, but I rarely use this gadget these days.
I may look like a mule, but I'm not a complete ass.
User avatar
spikey
Enthusiast
Enthusiast
Posts: 764
Joined: Wed Sep 22, 2010 1:17 pm
Location: United Kingdom

Re: Limit of the listicon gadget.

Post by spikey »

Sounds entirely reasonable, 2^(16-1) and using the other bit for sign...
Post Reply