Change appearance of selected options in dropbox and menu widget

Important: unclear posts may not receive useful answers.

Before posting

  • Get familiar with Markdown to format and structure your post
  • Be sure to update lvgl from the latest version from the master branch.
  • Be sure you have checked the FAQ and read the relevant part of the documentation.
  • If applicable use the Simulator to eliminate hardware related issues.

Delete this section if you read and applied the mentioned points.

Description

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

What LVGL version are you using?

What do you want to achieve?

What have you tried so far?

Code to reproduce

Add a code snippet which can run in the simulator. It should contain only the relevant code that compiles without errors when separated from your main code base.

The code block(s) should be formatted like:

/*You code here*/

Screenshot and/or video

If possible, add screenshots and/or videos about the current state.
Fairly new to LVGL; but have managed to get latest (Apr. '22) github version (8.2+) running under Arduino on the WIO Terminal. Still exploring widgets and trying to get a handle on the underlying mechanisms for styles in various widgets (e.g. lists, tables, etc.).
Have been running some of the example codes (from Examples — LVGL documentation) on this port. I do not have a touch screen, so have been working with a 5-way keypad switch. Dropbox and menu examples appear to run correctly; but selected options are not highlighted with a background blue color. They remain as black text on a white background like other options. The selected lines do have their font slightly changed - not enough for most users, but I can see it. So, things are mostly behaving as expected. My question is how to change the example code to affect background color for the selected option/button. I assume the answer is in the style system, but it’s not obvious - to me – how to change styles for the internal elements of some of these widgets.

Any pointers would be appreciated. I can include code/details; but most of it is specific to setting up my WIO LCD port and the remainder is code literally pasted from the web site.

Regards,
rtisys

Hi,

You can do it like this:

    lv_obj_set_style_bg_color(lv_dropdown_get_list(dd), lv_color_hex(0xff0000), LV_PART_SELECTED | LV_STATE_CHECKED);