center spinbox text

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

    • Hello,

      SPINBOX widget has an embedded EDIT widget. I think the simplest way is to get a handle of the EDIT and call EDIT_SetTextAlign() something like this:

      C Source Code

      1. #include "DIALOG.h"
      2. void MainTask(void) {
      3. SPINBOX_Handle hSpinbox;
      4. EDIT_Handle hEdit;
      5. GUI_Init();
      6. WM_MULTIBUF_Enable(1);
      7. GUI_SetBkColor(GUI_LIGHTGRAY);
      8. GUI_Clear();
      9. // Create a SPINBOX widget
      10. hSpinbox = SPINBOX_CreateEx(50, 50, 80, 20, WM_HBKWIN, WM_CF_SHOW, GUI_ID_SPINBOX0, 0, 999);
      11. // Set buttons left <-> right
      12. SPINBOX_SetEdge(hSpinbox, SPINBOX_EDGE_CENTER);
      13. // Get EDIT handle
      14. hEdit = SPINBOX_GetEditHandle(hSpinbox);
      15. // Set text align to center
      16. EDIT_SetTextAlign(hEdit, GUI_TA_HCENTER | GUI_TA_VCENTER);
      17. while (1)
      18. {
      19. GUI_Exec();
      20. }
      21. }
      Display All
      Alex.

      The post was edited 1 time, last by LexaGb ().