ListView Swipe.

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

  • ListView Swipe.

    Dear Segger Team,

    I have tried to implement listview siwpe using the touch call back as shown below. Output generated by below logic is not smooth also it is very slow. So please suggest me some better technique to implement it.

    C Source Code

    1. static void _cbSwipe(WM_MESSAGE* pMsg) {
    2. switch (pMsg->MsgId) {
    3. case WM_TOUCH :
    4. {
    5. static int last_y;
    6. int y;
    7. const GUI_PID_STATE* pState = (const GUI_PID_STATE*)pMsg->Data.p;
    8. if (pMsg->Data.p) { /* Something happened in our area (pressed or released) */
    9. if (pState->Pressed)
    10. {
    11. hWinScrollBarV = WM_GetScrollbarV(pMsg->hWin);
    12. scrollval = SCROLLBAR_GetValue(hWinScrollBarV);
    13. //WM_SetCapture(pMsg->hWin, 1);
    14. if(last_y)
    15. {
    16. y = pState->y;
    17. if(y > last_y)
    18. {
    19. printf("Scroll Down\r\n");
    20. scrollval++;
    21. SCROLLBAR_SetValue(hWinScrollBarV, scrollval);
    22. }
    23. if(y < last_y)
    24. {
    25. printf("Scroll Up\r\n");
    26. scrollval--;
    27. SCROLLBAR_SetValue(hWinScrollBarV, scrollval);
    28. }
    29. }
    30. last_y = pState->y;
    31. }else {
    32. last_y=0;
    33. }
    34. }else {
    35. last_y=0;
    36. }
    37. LISTVIEW_Callback(pMsg);
    38. }
    39. break;
    40. default:
    41. LISTVIEW_Callback(pMsg);
    42. break;
    43. }
    44. }
    Display All



    Rgds,
    Rohit.

    The post was edited 3 times, last by mrohit2011 ().

  • Hi,

    Attached is an example on how you could scroll the LISTVIEW by touching any where into the LISTVIEW. Although, the scroll bar is hidden we still use its value to scroll up and down.

    But this way it is not possible to accelerate the LISTVIEW and let it scroll to its end (like a menu on a mobile device).

    You might also try the SWIPELIST widget, but it is more like a menu and doesn't multiple columns.

    Regards
    Sven
    Files