Table not updating values (v7-dev)

Description

The table values does not update when applying a new value.

What MCU/Processor/Board and compiler are you using?

Simulator with Code Blocks, version 7-dev

What do you experience?

When updating the values, the labels do not change. If I press with the mouse, then they change. It seems that there is something missing that signals the change.

What do you expect?

THe table labels should change after applying the set_value

Code to reproduce

I execute this code every 100ms to update the values, and the only are visible when pressing with the mouse:

static void updateTableSpeeds()
{
    if (table != NULL)
    {
        char str[64];

        float turns;
        int32_t deg;
        int32_t speed;

        deg = time;
        turns = (float) deg / 360;
        speed = 100;

        sprintf(str, "%d", speed);
        lv_table_set_cell_value(table, 1, 0, str);
        lv_table_set_cell_value(table, 1, 1, str);
        lv_table_set_cell_value(table, 1, 2, str);

        sprintf(str, "%d", deg);
        lv_table_set_cell_value(table, 2, 0, str);
        lv_table_set_cell_value(table, 2, 1, str);
        lv_table_set_cell_value(table, 2, 2, str);

        sprintf(str, "%.1f", turns);
        lv_table_set_cell_value(table, 3, 0, str);
        lv_table_set_cell_value(table, 3, 1, str);
        lv_table_set_cell_value(table, 3, 2, str);
    }
}

I don’t know if it is the correct thing to do, but comparing to the previous version, I have added

  lv_obj_invalidate(table);

at the end of the function

  static void refr_size(lv_obj_t * table);

as it was in version 6.1. Now it works, but I don’t know if it is the optimal thing to do.

Alex

That looks like the correct solution. While lv_obj_set_size would normally invalidate the table as long as the size changes, refr_size can be called even if the table’s size doesn’t actually change, in which case lv_obj_invalidate needs to be called manually.

I’ve fixed this in dev-7.0.

2 Likes

Great!

Updated to last version now

Alex