WM_NOTIFICATION_RELEASED for a button wrongly called

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

  • WM_NOTIFICATION_RELEASED for a button wrongly called

    Good morning,

    I am developing a prototype application on the STM32F429 Discovery board, using the Keil uVision IDE.
    I designed a GUI with GUIBuilder, and everything works as it should, except for an annoying behavior.
    I have a button on the screen, whose clicking (touching) I intercept in the DLG callback routine :

    C Source Code

    1. ....................................
    2. /*********************************************************************
    3. *
    4. * Static code
    5. *
    6. **********************************************************************
    7. */
    8. // USER START (Optionally insert additional static code)
    9. static int guard = 0;
    10. // USER END
    11. ....................................
    12. case ID_BUTTON_0: // Notifications sent by 'Freq'
    13. switch(NCode) {
    14. case WM_NOTIFICATION_CLICKED:
    15. // USER START (Optionally insert code for reacting on notification message)
    16. if(!guard)
    17. {
    18. guard = 1;
    19. hItem = WM_GetDialogItem(pMsg->hWin, ID_MULTIEDIT_0);
    20. MULTIEDIT_AddText(hItem, "Clicked ! ");
    21. }
    22. // USER END
    23. break;
    24. case WM_NOTIFICATION_RELEASED:
    25. // USER START (Optionally insert code for reacting on notification message)
    26. guard = 0;
    27. // USER END
    28. break;
    Display All


    The problem is that the case WM_NOTIFICATION_RELEASED is executed even if I press on the button and do not lift my finger from it...
    It is called continuously, following the call to WM_NOTIFICATION_CLICKED.... this is quite annoying...
    Is there a workaround for this, or its me who haven't completely understood how the logic behind that is ?

    Thanks for any help

    Alberto
  • Adrian, thanks.

    well, I thought the debouncing would have done inside the driver... apparently that is not the case.
    Can you (or somebody else) suggest some example of a debouncing routine for the touch screen ?

    TNX

    Alberto
  • Hello Alberto,

    Unfortunately there is no general solution for debouncing. You will have to analyze the touch values from your controller in order to know how many "unpressed" events are recognized by it although the touch is continuously pressed.

    Best regards,
    Adrian