Keeping a knob motion on a swipelist

    • Keeping a knob motion on a swipelist

      Hello to everyone,

      I'm using STemWin 5.44,

      here is just a simple swipelist with a knob attached to item 1.

      C Source Code: Main.c

      1. #include "DIALOG.h"
      2. #include "stdio.h"
      3. SWIPELIST_Handle hSwipelist;
      4. KNOB_Handle hKnob;
      5. GUI_MEMDEV_Handle hMem;
      6. void _CreateKnob(void) {
      7. hMem = GUI_MEMDEV_CreateFixed32(0, 0, 50, 50);
      8. GUI_MEMDEV_Select(hMem);
      9. GUI_SetBkColor(GUI_TRANSPARENT);
      10. GUI_Clear();
      11. GUI_PreserveTrans(1);
      12. GUI_SetColor(GUI_WHITE);
      13. GUI_SetPenSize(3);
      14. GUI_AA_DrawCircle(25, 25, 23);
      15. GUI_SetColor(GUI_GREEN);
      16. GUI_SetPenSize(2);
      17. GUI_AA_DrawLine(24, 7, 24, 14);
      18. GUI_PreserveTrans(0);
      19. GUI_MEMDEV_Select(0);
      20. hKnob = KNOB_CreateEx(0, 0, 50, 50, WM_HBKWIN, WM_CF_SHOW, GUI_ID_KNOB0);
      21. KNOB_SetDevice(hKnob, hMem);
      22. }
      23. void _CreateSwipelist(void) {
      24. int i;
      25. char str[10];
      26. hSwipelist = SWIPELIST_CreateEx(0, 0, 240, 320, WM_HBKWIN, WM_CF_SHOW, 0, GUI_ID_SWIPELIST0);
      27. SWIPELIST_AddSepItem(hSwipelist, "Swipelist", 60);
      28. for (i = 0; i < 10; i++) {
      29. sprintf(str, "Item %d", i + 1);
      30. SWIPELIST_AddItem(hSwipelist, str, 60);
      31. }
      32. SWIPELIST_ItemAttachWindow(hSwipelist, 1, hKnob, 180, 5);
      33. }
      34. void MainTask(void) {
      35. GUI_Init();
      36. WM_MULTIBUF_Enable(1);
      37. WM_SetDesktopColor(GUI_BLACK);
      38. _CreateKnob();
      39. _CreateSwipelist();
      40. while (1) {
      41. GUI_Exec();
      42. }
      43. }
      Display All
      When attached the knob lost its motion functionality.

      In this case motion passes to the swipelist avoiding the knob.

      Is there any ways to keep the motion on a knob?

      Thank you.
      Regards,

      Anthony
    • Hi,

      Can you pass WM_CF_SHOW | WM_CF_MOTION_R as the create flags for the KNOB?
      The flag for radial motion is not set automatically. Because the flag is not required if the KNOB has no swipeable parent, which means there is no other widget that can process motion input. The KNOB having no swipeable parent was considered the default case back then.

      Does this solve your issue?

      Best regards,
      Florian
      Please read the forum rules before posting.

      Keep in mind, this is *not* a support forum.
      Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
      Should you be entitled to support you can contact us via our support system: segger.com/ticket/

      Or you can contact us via e-mail.