Page 1 of 1
ComboBoxGadget limit?
Posted: Sun Jun 30, 2013 8:08 am
by PB
Is there any practical limit to the number of items shown in
the drop-down list of a ComboBoxGadget? One of my apps
keeps a history of text in it, but I'm worried that a heavy
user might put around 1000 or more items in it.

Re: ComboBoxGadget limit?
Posted: Mon Jul 01, 2013 2:05 am
by citystate
not too sure of the upper maximum, but I tested it out with 100000 items and it didn't flinch
Code: Select all
OpenWindow(0,0,0,120,80,"ComboBox Test",#PB_Window_SystemMenu|#PB_Window_ScreenCentered)
ComboBoxGadget(0,5,5,110,20)
For i=1 To 100000
AddGadgetItem(0,i-1,Str(i))
Next
Repeat
Until WaitWindowEvent(20)=#PB_Event_CloseWindow
Re: ComboBoxGadget limit?
Posted: Mon Jul 01, 2013 2:37 am
by Neil
citystate wrote:not too sure of the upper maximum, but I tested it out with 100000 items and it didn't flinch
Code: Select all
OpenWindow(0,0,0,120,80,"ComboBox Test",#PB_Window_SystemMenu|#PB_Window_ScreenCentered)
ComboBoxGadget(0,5,5,110,20)
For i=1 To 100000
AddGadgetItem(0,i-1,Str(i))
Next
Repeat
Until WaitWindowEvent(20)=#PB_Event_CloseWindow
I flinched on 1000000 !! but got there in the end.
Re: ComboBoxGadget limit?
Posted: Mon Jul 01, 2013 9:09 am
by PB
Thanks for testing! Didn't even cross my mind to do that,
because I was thinking that even if it populates, it might
crash later on or something (due to memory limits).
Re: ComboBoxGadget limit?
Posted: Thu Jul 04, 2013 11:39 pm
by charvista
The standard limit is 65'565 elements.
Because, if you use one more, 65'566 (or more), and when you scroll to the end while holding the scroll block directly to the end, you will see that the last ones are not into the 65'500 but back to the begin (see example below, where I put 65566). This is asking for trouble.
However, if you scroll with the mouse wheel, or by clicking on the free space of the scroller under the scoll block, or on the arrow-down button of the scrollbar, it will work.
Code: Select all
Win=OpenWindow(#PB_Any,0,0,520,580,"ComboBox Test",#PB_Window_SystemMenu|#PB_Window_ScreenCentered)
Sgad=ComboBoxGadget(#PB_Any,5,5,510,520)
For i=1 To 65566; that's too much, the ultimate max here should be 65'565.
AddGadgetItem(Sgad,i-1,Str(i-1))
Next
Repeat
Event=WaitWindowEvent()
Select Event
Case #PB_Event_CloseWindow
ExitEventLoop=#True
Case #PB_Event_Gadget
Gadget=EventGadget()
Select Gadget
Case Sgad
Debug GetGadgetState(Sgad)
EndSelect
EndSelect
Until ExitEventLoop
Note that this limit is on Windows. I don't know what happens on Mac or Linux.
Re: ComboBoxGadget limit?
Posted: Fri Jul 05, 2013 1:14 am
by PB
Thanks for testing and confirming the limits. I doubt my users would
have that many; but it's always good to know the limitations.

Re: ComboBoxGadget limit?
Posted: Mon Jul 15, 2013 3:39 pm
by blueznl
I messed with different Windows controls as I was doing the same thing: storing everything in a control / gadget. Behaviour got unpredictable when going over 65533 (not 65536, strangely enough). Must be somewhere a hardcoded 16 bits limit. I'd suggest to keep the controls a little smaller

Re: ComboBoxGadget limit?
Posted: Tue Jul 16, 2013 10:18 am
by electrochrisso
blueznl wrote:I messed with different Windows controls as I was doing the same thing: storing everything in a control / gadget. Behaviour got unpredictable when going over 65533 (not 65536, strangely enough). Must be somewhere a hardcoded 16 bits limit. I'd suggest to keep the controls a little smaller

I think the 16 bit limit is 65535, as 0 need to be counted to make 65536.