How to trim leading zeros in spinbox?

    This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

    • How to trim leading zeros in spinbox?

      Is there any way to remove the leading zero in spinbox? For example, if I set the Min and Max of a spinbox as 10 and 100, then when I input the value '24' , the spinbox displays '024'. How can I remove the leading zero? Thank you.
    • Hi,

      Try the code below. First get the EDIT handle from the SPINBOX and then modify the EDIT widget. Although it is not documented, you can pass the flag GUI_EDIT_SUPRESS_LEADING_ZEROES to the function EDIT_SetDecMode(). I will update the manual.

      C Source Code

      1. hSpinbox = SPINBOX_CreateEx(10, 10, 80, 20, WM_HBKWIN, WM_CF_SHOW, GUI_ID_SPINBOX0, 10, 100);
      2. hEdit = SPINBOX_GetEditHandle(hSpinbox);
      3. EDIT_SetDecMode(hEdit, 10, 10, 100, 0, GUI_EDIT_SUPPRESS_LEADING_ZEROES);

      Regards,
      Sven