Hiding sign in spinbox widget

Description

Is it possible to not show positive/negative sign in spinbox widget?
I’ve solved by modify lvgl code, It’s my need but I don’t know if is a good solution for everyone

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

STM32F103RC / Keil

What do you want to achieve?

hide sign in spinbox

What have you tried so far?

modified original code in lv_spinbox.c

Code to reproduce

static void lv_spinbox_updatevalue(lv_obj_t* spinbox)
{
    lv_spinbox_ext_t* ext = lv_obj_get_ext_attr(spinbox);

    char buf[LV_SPINBOX_MAX_DIGIT_COUNT + 8];
    memset(buf, 0, sizeof(buf));
    char* buf_p = buf;
    int i;


    if (ext->range_min < 0) { // sign is hide if there are only positive values
       
        /*Add the sign*/
        (*buf_p) = ext->value >= 0 ? '+' : '-';
        buf_p++;

        /*padding left*/
        for (i = 0; i < ext->digit_padding_left; i++) {
            (*buf_p) = ' ';
            buf_p++;
        }
    }
    char digits[64];
...

Please fill the template to provide enough information to investigate your issue.

> ## Important: posts that do not use this template will be ignored or closed.
>
> ## Before posting
> - Get familiar with [Markdown](https://forum.lvgl.io/t/get-familiar-with-markdown/403) to format and structure your post
> - Be sure to update [lvgl](https://github.com/littlevgl/lvgl) from the latest version from the `master` branch.
> - Be sure you have checked the relevant part of the [documentation](https://docs.littlevgl.com/en/html/index.html). **We will not respond in detail to posts where you haven't read the relevant documentation.**
> - If applicable use the [Simulator](https://docs.littlevgl.com/en/html/get-started/pc-simulator.html) 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 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:
```c
/*You code here*/
```

Sorry, I’ve update my post.
Thanks

It looks like a reasonable update!
Can you send a PR?

sorry I don’t know how to do :thinking:

Take a look at this article:

Ok i’ll do . Thanks

1 Like