LISTVIEW add row

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

    • LISTVIEW add row

      I wonder how LISTVIEW_AddRow() manages memory.

      I can see it is working very well, whoever I have a table of data which I need to display, and this table adds one line per day.

      So when my program runs it loops on all the lines in this table and calls LISTVIEW_AddRow() for each line.

      What is the memory requirements, will my program crash after n days? (if AddRow allocates memory, it will fail some time)
      If yes, how to overcome (user can scroll up or down).
    • Hi,

      LISTVIEW_AddRow() allocate a block of memory from the GUI_MEMORY pool (defined by GUI_ALLOC_AssignMemory()). If you pass NULL to the function LISTVIEW_AddRow() it requires at least a few bytes for information about the allocated memory block.

      If you pass some strings to LISTVIEW_AddRow() it will alocated as much memory as required to save the strings.

      If you run out of memory at some point the function LISTVIEW_AddRow() will return with 1 (adding a row failed).

      You can check the return value of LISTVIEW_AddRow() and decide what to do, maybe deleting some of the old rows or writing the content to a file and delete the old rows.