What MCU/Processor/Board and compiler are you using?
stm32
What LVGL version are you using?
8.3
What do you want to achieve?
how to change the color of the cursor of the textarea?
stm32
8.3
how to change the color of the cursor of the textarea?
I second this question.
Thought I would answer it but nothing seems to work. Creating a style, setting the border properties and adding to the text area as LV_PART_CURSOR has no effect on the cursor.
This is what I did in the micropython sim
@embeddedt - any thoughts?
style = lv.style_t()
style.init()
style.set_border_color(lv.palette_main(lv.PALETTE.BLUE))
style.set_border_width(5)
style.set_border_opa(lv.OPA._80)
scr = lv.obj()
ta = lv.textarea(scr)
ta.add_style(style, lv.PART.CURSOR)
Because of the way style precedence works, you need to apply the style to lv.PART.CURSOR | lv.STATE.FOCUSED
, otherwise the default theme takes priority since that’s the selector it uses.
style = lv.style_t()
style.init()
style.set_border_color(lv.palette_main(lv.PALETTE.BLUE))
scr = lv.obj()
ta = lv.textarea(scr)
ta.add_style(style, lv.PART.CURSOR | lv.STATE.FOCUSED)
lv.scr_load(scr)
Thanks. Good to know.
So the take away here is if a style isn’t working the way you expect, check how it is being configured in the default theme.
I added style to the text area.
It worked, thank both of you very much