When to call LISTWHEEL_SetVelocity()

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

    • When to call LISTWHEEL_SetVelocity()

      Hello,

      I'm working on trying to get a time/date picker working with STeMWIN, I have a basic screen working however movement of the various wheels is something I've not quite grasped yet. Currently each list wheel has it's own callback:

      Source Code

      1. static void
      2. CbListWheel (WM_MESSAGE *pMsg)
      3. {
      4. switch (pMsg->MsgId)
      5. {
      6. //**********************************************************************
      7. // WM_PID_STATE_CHANGED
      8. case WM_PID_STATE_CHANGED:
      9. {
      10. // React on pressing data areas
      11. LISTWHEEL_SetVelocity(pMsg->hWin, LISTWHEEL_VELOCITY);
      12. break;
      13. }
      14. //**********************************************************************
      15. // Default handling.
      16. default:
      17. {
      18. LISTWHEEL_Callback(pMsg);
      19. break;
      20. }
      21. }
      22. }
      23. /******************************************************************************/
      Display All


      When I touch on the wheel it moves, however it only moves in 1 direction. I'm wondering how (if?) I control the direction of movement with listwheels? The example code looks like this:


      Source Code

      1. case WM_PID_STATE_CHANGED:
      2. //
      3. // React on pressing data areas
      4. //
      5. pState = (const WM_PID_STATE_CHANGED_INFO *)pMsg->Data.p;
      6. if ((pState->StatePrev == 0) && (pState->State == 1)) {
      7. x = pState->x;
      8. y = pState->y;
      9. if ((x >= 10) && (x <= 230)) {
      10. for (j = 0; j < 2; j++) {
      11. if ((y >= (75 + j * 40)) && (y < 75 + (j + 1) * 40)) {
      12. if (Selection != j) {
      13. Selection = j;
      14. for (i = 0; i < 3; i++) {
      15. LISTWHEEL_MoveToPos(_aWheel[i].hWin, _aSelection[Selection][i]);
      16. }
      17. WM_InvalidateWindow(pMsg->hWin);
      18. }
      19. }
      20. }
      21. }
      22. }
      23. break;
      Display All
      Which sadly I am struggling to understand - I suspect this is trying to find the list wheel selection at given screen coordinates. However this would surely just move the wheel there, rather than enable a smooth scroll to a new selection.

      All in all I'm a little confused about this widget and would like some pointing in the right direction.

      Thanks,
      Peter.