How to use LV_SPINBOX_STYLE_CURSOR in the lv_spinbox_set_style

Hello,

I’ve tried some styles for the LV_SPINBOX_STYLE_CURSOR in the lv_spinbox_set_style, but nothing seems to work. Can you give me directions/examples how to use this, I would like to change the appearance of the selection cursor just the way as it is shown in the documentation example (no block, just change color of the digit that is edited)

Greetings,
Gesture

Hi,

Which version do you use?

In dev-6.0 there was bug which I’ve fixed. Now it works like this:

    static lv_style_t s;
    lv_style_copy(&s, &lv_style_plain);
    s.text.color = LV_COLOR_RED;
    s.body.padding.left = 0;
    s.body.padding.right = 0;
    s.body.padding.top = 0;
    s.body.padding.bottom = 0;
    s.body.opa = LV_OPA_TRANSP;

    lv_obj_t * sp = lv_spinbox_create(lv_scr_act(), NULL);
    lv_ta_set_cursor_type(sp, LV_CURSOR_BLOCK);
    lv_spinbox_set_style(sp, LV_SPINBOX_STYLE_CURSOR, &s);

Hi,

Thanks for the example. Unfortunately the example does not change anything for the cursor. I still get the default blinking block cursor and inverted textcolor. There is no change in cursor at all…

I’m using v6.0.0 from last saterday

Please update lvgl to the latest version from dev-6.0 branch. I pushed the fix there.

Thanks,

It does work now. Keep up the good work! :+1:

Is there also a way to change the bounding box on the selected group item. It is now light orange with a huge orange border…

And the direction of the selected digit in the spinbox, can it be changed to right-to-left?

Yes, there is. Have look at this: https://littlevgl.com/sphinx/overview/indev.html#styling-the-focused-object
If you have further questions about it, please now topic to keep the forum clean.

There is no API for it right now but you can change it in the code in lv_spinbox_signal() in LV_SIGNAL_RELEASED signal.