SLIDER with invisible frame

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

    • Hi,

      sure, this can be done by setting a skinning callback routine to the SLIDER. You can read about skinning in the manual. But in short, a skinning callback reacts on certain commands (different for each widget) to perform partial draw operations.

      So for example, the SLIDER skinning callback receives commands for drawing the thumb, shaft, ticks and the focus rectangle. Each of these individual parts can be drawn by the user or the default callback can be called.

      In your case you just have to react on the "thumb command" and call the default callback (or instead draw your own thumb). Below is a sample that does this.

      C Source Code

      1. #include "DIALOG.h"
      2. /*********************************************************************
      3. *
      4. * Static code
      5. *
      6. **********************************************************************
      7. */
      8. /*********************************************************************
      9. *
      10. * _cbSliderSkin
      11. */
      12. static int _cbSliderSkin(const WIDGET_ITEM_DRAW_INFO * pDrawItemInfo) {
      13. switch(pDrawItemInfo->Cmd) {
      14. case WIDGET_ITEM_DRAW_THUMB:
      15. return SLIDER_DrawSkinFlex(pDrawItemInfo);
      16. }
      17. }
      18. /*********************************************************************
      19. *
      20. * Public code
      21. *
      22. **********************************************************************
      23. */
      24. /*********************************************************************
      25. *
      26. * MainTask
      27. */
      28. void MainTask(void) {
      29. WM_HWIN hSlider;
      30. GUI_Init();
      31. WM_MULTIBUF_Enable(1);
      32. WM_SetDesktopColor(GUI_WHITE);
      33. hSlider = SLIDER_CreateEx(20, 20, 200, 25, WM_HBKWIN, WM_CF_SHOW, 0, GUI_ID_SLIDER0);
      34. SLIDER_SetSkin(hSlider, _cbSliderSkin);
      35. while (1) {
      36. GUI_Delay(100);
      37. }
      38. }
      Display All

      Best regards and have a nice weekend,

      Florian