Combobox with many many items

Started by orborneroberts, 20 December 2024, 10:53:14

orborneroberts

Hello, I need a combobox with many items, (say over 1000), but if I add all the creation is very slow and even change item is a pain (better in release, but debug it's unusable). It there a workaround for this? Maybe I can load a little number of items (say 20) and when moving the list reload the correct ones. How can I do something like that? Or if are there better solution...

texus

Do you need to assign an id to each item (i.e. second parameter of addItem function)? If not then you can use "addMultipleItems" (added in TGUI 1.6) to add all items at once.

For changing an item, are you using changeItem? That function has to loop through all items to find a matching string, changeItemByIndex is much faster if you know the index of the item that needs to be changed.

I'm not sure if a combo box with so many items is a user-friendly UI design though.