Hello,
Everything has been good so far but in chapter 2.4 I get the button with the ‘Click here!’ text inside but when I click it only the text changes, the style of the buttons remains as when not clicked.
I have copied again the lvgl config file just in case it was replaced but still the same.
Any idea what could be wrong?
Thanks
Hello Eric,
Yes, I’ve just tested the code myself and it looks like the style is not being properly applied. I’ll provide a solution on Monday.
Thank you for your patience.
Regards,
Rui
Hello Rui
Thank you very much.
just let us know when this is fixed so that we can test it again
Hello again!
I think during the code explanation, we might have removed the original styles from the code by mistake. Here’s the updated code:
Basically, we’ve added these lines to apply the border and shadow styles to the button pressed styled:
// Create a style for the button pressed state
// Use a color filter to simply modify all colors in this state and apply a dark effect
static lv_color_filter_dsc_t color_filter;
lv_color_filter_dsc_init(&color_filter, darken);
lv_style_init(&style_button_pressed);
lv_style_set_color_filter_dsc(&style_button_pressed, &color_filter);
lv_style_set_color_filter_opa(&style_button_pressed, LV_OPA_10);
lv_style_set_border_color(&style_button_pressed, lv_palette_main(LV_PALETTE_GREEN));
lv_style_set_border_opa(&style_button_pressed, LV_OPA_100);
lv_style_set_border_width(&style_button_pressed, 4);
lv_style_set_shadow_width(&style_button_pressed, 20);
lv_style_set_shadow_offset_y(&style_button_pressed, 5);
lv_style_set_shadow_opa(&style_button_pressed, LV_OPA_100);
Let me now if this new example works for you.
Regards,
Rui