Description
What MCU/Processor/Board and compiler are you using?
Configuration:
- NUCLEO-L452RE
- ICE Driving Board connected through SPI
- ED043WC3 ePaper display
- arm-gcc with -O1
What do you want to achieve?
Align labels with coordinate modification OR
Set the position of a label.
The Problem
After I change the text of the label it will have this angled look. See the attached picture.
This happens only if the X coordinate is not equal with 0.
What have you tried so far?
- Use Semaphore
Lv_label_set_text_fmt crash - Set alignment after changing text
https://github.com/littlevgl/lvgl/issues/208 - Delete an object with lv_obj_del and recreate it when I change the text
- Use a page as the parent
Code
static lv_style_t style200_txt;
static lv_obj_t* label1 = NULL;
void LoadScreen()
{
LV_FONT_DECLARE(bpreplay_bold_200);
/*Create a new style*/
lv_style_copy(&style200_txt, &lv_style_plain);
style200_txt.text.font = &bpreplay_bold_200;
style200_txt.text.letter_space = 2;
style200_txt.text.line_space = 1;
style200_txt.text.color = LV_COLOR_BLACK;
style200_txt.body.main_color = LV_COLOR_GRAY;
style200_txt.body.padding.bottom = 10;
style200_txt.body.padding.top = 10;
/*Create a new label*/
label1 = lv_label_create(lv_scr_act(), NULL);
lv_obj_set_style(label1, &style200_txt);
lv_label_set_long_mode(label1, LV_LABEL_LONG_CROP);
lv_obj_set_width(label1, 400);
#if(ERROR_CASE)
lv_obj_align(label1, lv_scr_act(), LV_ALIGN_CENTER, 10, 45);
#else
lv_obj_align(label1, lv_scr_act(), LV_ALIGN_CENTER, 0, 45);
#endif
lv_label_set_align(label1, LV_LABEL_ALIGN_CENTER);
}
void SetLabel1Text(const char * text)
{
lv_label_set_text(label1, text);
}