Migrating from 7.5 to 8.1 - Table behaving odd

Description

In 7.5 when you clicked on a table it didnt change the row size or position. In 8.1 it does. How can I prevent this?

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

Simulator

What LVGL version are you using?

8.1

What do you want to achieve?

Prevent the table from re-sizing and moving

What have you tried so far?

Docs

Code to reproduce


void create_tabCalendar(lv_obj_t * parent)
{
    calendartable = lv_table_create(parent);
    //8.1 to fix
	//lv_obj_set_drag_parent(calendartable, true);

    lv_obj_set_style_radius(calendartable, 10, 0);
    lv_obj_set_style_clip_corner(calendartable, true, 0);
    lv_obj_set_pos(calendartable, 50, 12);

    lv_obj_set_style_pad_top(calendartable, 2, LV_PART_ITEMS);
    lv_obj_set_style_pad_bottom(calendartable, 2, LV_PART_ITEMS);
    lv_obj_set_style_pad_left(calendartable, 10, LV_PART_ITEMS);
    lv_obj_set_style_pad_right(calendartable, 10, LV_PART_ITEMS);

    lv_obj_set_style_pad_top(calendartable, 2, LV_TABLE_PART_CELL1);
    lv_obj_set_style_pad_bottom(calendartable, 2, LV_TABLE_PART_CELL1);
    lv_obj_set_style_pad_left(calendartable, 10, LV_TABLE_PART_CELL1);
    lv_obj_set_style_pad_right(calendartable, 10, LV_TABLE_PART_CELL1);

    lv_obj_set_style_text_font(calendartable, &lv_font_montserrat_18, LV_TABLE_PART_CELL1);

    lv_table_set_col_cnt(calendartable, 4);
    lv_table_set_row_cnt(calendartable, calendarRows+1);

    lv_table_set_col_width(calendartable, 0, 200);
    lv_table_set_col_width(calendartable, 1, 300);
    lv_table_set_col_width(calendartable, 2, 200);
    lv_table_set_col_width(calendartable, 3, 200);

    //Set table header
    lv_obj_set_style_pad_top(calendartable, 2, LV_TABLE_PART_CELL3);
    lv_obj_set_style_pad_bottom(calendartable, 2, LV_TABLE_PART_CELL3);
    lv_obj_set_style_pad_left(calendartable, 10, LV_TABLE_PART_CELL3);
    lv_obj_set_style_pad_right(calendartable, 10, LV_TABLE_PART_CELL3);

    lv_obj_set_style_text_font(calendartable, &lv_font_montserrat_24, LV_TABLE_PART_CELL3);

    //8.1 to fix
    //lv_table_set_cell_type(calendartable, 0, 0, LV_TABLE_PART_CELL3);
    //lv_table_set_cell_type(calendartable, 0, 1, LV_TABLE_PART_CELL3);
    //lv_table_set_cell_type(calendartable, 0, 2, LV_TABLE_PART_CELL3);
    //lv_table_set_cell_type(calendartable, 0, 3, LV_TABLE_PART_CELL3);

    lv_table_set_cell_value(calendartable, 0, 0, "Calendar");
    lv_table_set_cell_value(calendartable, 0, 1, "Summary");
    lv_table_set_cell_value(calendartable, 0, 2, "Start");
    lv_table_set_cell_value(calendartable, 0, 3, "End");

}

Screenshot and/or video

Before click:

After click:

Thanks!

There are some v7 specific parts in your code so I can’t reproduce the issue. (E.g. LV_TABLE_PART_CELL3)

ah, sorry. I made defines of them to get through some compilation issues:

#define LV_TABLE_PART_CELL0 1

#define LV_TABLE_PART_CELL1 2

#define LV_TABLE_PART_CELL2 3

#define LV_TABLE_PART_CELL3 4

#define LV_TABLE_PART_CELL4 5

It happened because you have used arbitrary numbers (1,2,3,4,5) as “selectors” in lv_obj_set_style_... functions. E.g. 5 means LV_STATE_FOCUS_KEY | LV_STATE_CHECKED.

Using


elgerg
17m
ah, sorry. I made defines of them to get through some compilation issues:

#define LV_TABLE_PART_CELL0 0
#define LV_TABLE_PART_CELL1 0
#define LV_TABLE_PART_CELL2 0
#define LV_TABLE_PART_CELL3 0
#define LV_TABLE_PART_CELL4 0

works well for me.

Ah!
I’ll need to re-work that in conjunction with the issue on:

Thanks for all of your help!!!