Custom Widget - when to send WM_NOTIFICATION_MOVED_OUT to parent?

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

  • Custom Widget - when to send WM_NOTIFICATION_MOVED_OUT to parent?

    I've created a custom widget, which is basically a specialized button. It seems to be working for the most part, but I'm trying to make sure I handle the "MOVED_OUT" condition.
    What message should I be looking for in my custom widget callback to send the WM_NOTIFICATION_MOVED_OUT to the parent?

    Based on the documentation, it seems that I should be looking at the WM_TOUCH message, casting the data to a GUI_PID_STATE, and testing to see if the x,y values are greater than/less then the widget's size. This doesn't seem to be working.

    When sliding my finger off my widget (while pressed), the WM_TOUCH message is sent to the widget callback, but when I cast the data to a GUI_PID_STATE, my values are a little crazy:

    Pressed:185, Layer: 2, X value: 536903680, Y value: 685

    When I see this, I call

    C Source Code

    1. if (MyWidget.Pressed && (pState->x < WinRect.x0 || pState->x > WinRect.x1 || pState->y < WinRect.y0 || pState->y > WinRect.y1)){ WM_NotifyParent(pMsg->hWin, WM_NOTIFICATION_MOVED_OUT);}


    Sometimes this can lead to a hard fault.

    Can anybody offer some advice?