ComboBoxGadget limit?

Everything else that doesn't fall into one of the other PB categories.
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

ComboBoxGadget limit?

Post 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. :shock:
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
citystate
Enthusiast
Enthusiast
Posts: 638
Joined: Sun Feb 12, 2006 10:06 pm

Re: ComboBoxGadget limit?

Post 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
there is no sig, only zuul (and the following disclaimer)

WARNING: may be talking out of his hat
Neil
Enthusiast
Enthusiast
Posts: 198
Joined: Wed Feb 29, 2012 8:04 am
Location: Melbourne, AUS

Re: ComboBoxGadget limit?

Post 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.
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Re: ComboBoxGadget limit?

Post 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).
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
User avatar
charvista
Addict
Addict
Posts: 969
Joined: Tue Sep 23, 2008 11:38 pm
Location: Belgium

Re: ComboBoxGadget limit?

Post 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.
- Windows 11 Home 64-bit
- PureBasic 6.30 (x64)
- 64 Gb RAM
- 13th Gen Intel(R) Core(TM) i9-13900K 3.00 GHz
- 8K monitor with DPI @ 300%
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Re: ComboBoxGadget limit?

Post 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. :)
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
User avatar
blueznl
PureBasic Expert
PureBasic Expert
Posts: 6175
Joined: Sat May 17, 2003 11:31 am
Contact:

Re: ComboBoxGadget limit?

Post 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 :-)
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB - upgrade incoming...)
( The path to enlightenment and the PureBasic Survival Guide right here... )
User avatar
electrochrisso
Addict
Addict
Posts: 989
Joined: Mon May 14, 2007 2:13 am
Location: Darling River

Re: ComboBoxGadget limit?

Post 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.
PureBasic! Purely the best 8)
Post Reply