combogadgets very slow

Linux specific forum
collectordave
Addict
Addict
Posts: 1309
Joined: Fri Aug 28, 2015 6:10 pm
Location: Portugal

combogadgets very slow

Post by collectordave »

When using a combogadget to allow the user to select from a list when there are a lot of items the combo becomes unusable.

Tested on ubuntu 16.04.3LTS and PB5.45LTS.

Code: Select all

Global Window_0

Global Combo_0,iLoop

  Window_0 = OpenWindow(#PB_Any, 0, 0, 600, 400, "", #PB_Window_SystemMenu)
  Combo_0 = ComboBoxGadget(#PB_Any, 120, 20, 170, 20)
  
  For iLoop = 0 To 1000
    AddGadgetItem(Combo_0,-1,"Item Number " + Str(iLoop))
  Next iLoop
  
  
  Repeat
      
    Event = WaitWindowEvent()
    Select Event
      Case #PB_Event_CloseWindow
        End

    EndSelect
    
  ForEver
Just try the above. Then reduce the number to 10 and it is reasonable.

It seems that the automatic resizing is taking a very long time making combogadgets unusable on older hardware.

Can the combogadget be created with a fixed width hopefully preventing the interminable resizeing code from running?
Last edited by collectordave on Mon Nov 20, 2017 7:06 am, edited 1 time in total.
Any intelligent fool can make things bigger and more complex. It takes a touch of genius — and a lot of courage to move in the opposite direction.
freak
PureBasic Team
PureBasic Team
Posts: 5929
Joined: Fri Apr 25, 2003 5:21 pm
Location: Germany

Re: combogadgets very slow

Post by freak »

This is a Gtk issue. Its not something we can solve on the PB side.

My guess is that the Gtk ComboBox is simply not designed to handle that many elements since such a long list would not be very user-friendly anyway.
quidquid Latine dictum sit altum videtur
collectordave
Addict
Addict
Posts: 1309
Joined: Fri Aug 28, 2015 6:10 pm
Location: Portugal

Re: combogadgets very slow

Post by collectordave »

It does appear to be a GTK issue but only the upgradedd gtk for later versions of LINUX. It seems it is nothing to do with the length of the list but that linux attempts to resize the combo box each time an element is added.

The linux community say it is a pb problem.

Could go round and round.

CD
Any intelligent fool can make things bigger and more complex. It takes a touch of genius — and a lot of courage to move in the opposite direction.
User avatar
Shardik
Addict
Addict
Posts: 1989
Joined: Thu Apr 21, 2005 2:38 pm
Location: Germany

Re: combogadgets very slow

Post by Shardik »

collectordave wrote:The linux community say it is a pb problem.
Would you please post a link to that discussion?
collectordave
Addict
Addict
Posts: 1309
Joined: Fri Aug 28, 2015 6:10 pm
Location: Portugal

Re: combogadgets very slow

Post by collectordave »

Will post link when I can.

Something else I have noticed if you create the combo gadget as an editable gadget it does not resize still takes a while though.

Regards
cd
Any intelligent fool can make things bigger and more complex. It takes a touch of genius — and a lot of courage to move in the opposite direction.
Post Reply