The function order affect label apperance


To set label width seems not working when call set width first then call set long mode function to a label. What’s the difference between this?

lv_obj_set_width(label, 180);
lv_label_set_long_mode(label, LV_LABEL_LONG_BREAK);

The code above set width function seems not working ,the width of the label only contain two chinese chars,the long mode works and the line wraps.

lv_label_set_long_mode(label, LV_LABEL_LONG_BREAK);
lv_obj_set_width(label, 180);

The code above works good,the width is as set.
Is there a way to know which function should be called before others>

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

stm32l476 keil mdk ac5

Some long modes control the label’s width; its best to set the long mode before changing the width.

OK,I see ,Thanks