• Skip to main content
  • Skip to primary sidebar

RNTLab.com

The Ultimate Shortcut to Learn Electronics and Programming with Open Source Hardware and Software

  • Courses
  • Forum
    • Forum
    • Ask Question
  • Shop
  • Account
  • Blog
  • Login

LVGL CYD 2.4 – Styling the Buttons issue

Q&A Forum › Category: ESP32 › LVGL CYD 2.4 – Styling the Buttons issue
0 Vote Up Vote Down
Eric Herrmann asked 1 week ago

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
 

Question Tags: cyd lvgl
4 Answers
0 Vote Up Vote Down
Rui Santos Staff answered 6 days ago

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

0 Vote Up Vote Down
Eric Herrmann answered 6 days ago

Hello Rui
Thank you very much. 
just let us know when this is fixed so that we can test it again

0 Vote Up Vote Down
Rui Santos Staff answered 5 days ago

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:

  • https://gist.githubusercontent.com/RuiSantosdotme/4da240faba824c4b8ac1e24078c93fea/raw/057c5b12930c59f88eb9e27655715bfc79b1b1df/2_4_Button.ino

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

0 Vote Up Vote Down
Eric Herrmann answered 4 days ago

It works now, thanks!

Primary Sidebar

Login to Ask or Answer Questions

This Forum is private and it’s only available for members enrolled in our Courses.

Login »

Latest Course Updates

  • [eBook Updated] Learn LVGL: Build GUIs for ESP32 Projects – Version 1.5 July 7, 2025
  • [eBook Updated] Learn Raspberry Pi Pico/Pico W with MicroPython eBook – Version 1.2 May 26, 2025

You must be logged in to view this content.

Contact Support - Refunds - Privacy - Terms - MakerAdvisor.com - Member Login

Copyright © 2013-2025 · RandomNerdTutorials.com · All Rights Reserved

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.