Listbox with huge amount of items

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • Listbox with huge amount of items

    I am using a ListBox use with an Owner Draw callback to display a large amount of items (max 2000). I use this widget because it simplify the selection of an item and the usage of scrollbars,

    To Draw the items, the listbox must have the correct number of rows, so i have to add any item with LISTBOX_AddString(hItem,""), but this operation is too slow (takes several seconds).

    The LISTBOX can change rapidly the number of items (ex. from 500 to 10), and i have to remove the rows (ex. 490) using LISTBOX_DeleteItem(hItem,0).

    There is a way to speedup the operation with this widget or is better to change drastically the form structure??
  • Listbox with huge amount of items

    I reproduced the problem with default draw and owner draw: same results.
    The system takes time to create the rows, not to draw them; for example the instruction
    while (i--)
    takes more than 1 minute. Once created the listbox works well (scroll and selection operation); more rows has the listbox, more time takes each iteration of the loop.

    I think the only solution could be to create a "Virtual listbox" using few rows and choosing them with a stand-alone scrollbar; there is some sample about :?:

    Another simple question; it is not clear to me how the library manages the objects; for example when i set a textbox with a string, emwin copies the string in its reserved
    memory or only the pointer :?: (in other words the string must be global or can be local defined :?: )

    Best regards and happy new year.
  • Hello Andrlach,

    Unfortunately I can not reproduce 2000 calls of LISTBOX_AddString() take more than a minute, but it is true that each iteration takes a bit more time than the one processed before.

    When setting a text for the TEXT widget the string is copied to the internal emWin memory.

    Best regards,