AnsweredAssumed Answered

STemWin Button - not getting WM_NOTIFICATION_RELEASED message

Question asked by Barta.Hank on Jan 8, 2015
Latest reply on Jan 13, 2015 by Barta.Hank
I've built a page using the GUI builder which has several buttons. When the app runs, it gets WM_NOTIFICATION_CLICKED messages but no WM_NOTIFICATION_RELEASED messages (via the touch screen.,) A consequence is that the button remains in the 'pressed' state until I press another button. I can also not click the button twice in a row because it never gets the second WM_NOTIFICATION_CLICKED message.



This is on a STM32F429I-DISCO board.

The gui builder produces the following structure to initialize the screen:
[code]static const GUI_WIDGET_CREATE_INFO _aDialogCreate[] = {
  { WINDOW_CreateIndirect, "Window", ID_WINDOW_0, 0, 0, 240, 320, 0, 0x0, 0 },
  { BUTTON_CreateIndirect, "Connect", ID_BUTTON_0, 30, 14, 80, 20, 0, 0x0, 0 },
  { BUTTON_CreateIndirect, "Disconnect", ID_BUTTON_1, 130, 15, 80, 20, 0, 0x0, 0 },
  { BUTTON_CreateIndirect, "Send", ID_BUTTON_2, 30, 45, 80, 20, 0, 0x0, 0 },
  { BUTTON_CreateIndirect, "Status", ID_BUTTON_3, 130, 45, 80, 20, 0, 0x0, 0 },
  { MULTIEDIT_CreateIndirect, "Edit", ID_EDIT_0, 3, 105, 234, 180, MULTIEDIT_CF_READONLY, (40*12), 0 },
  { BUTTON_CreateIndirect, "Button", ID_BUTTON_4, 30, 75, 80, 20, 0, 0x0, 0 },
  { MULTIEDIT_CreateIndirect, "Edit", ID_EDIT_1, 3, 287, 234, 30, MULTIEDIT_CF_READONLY, 0x64, 0 },
  // USER START (Optionally insert additional widgets)
  // USER END
};

[/code] 
(OK I lied, I modified a couple EDIT widgets to MULTIEDIT because the GUI builder does not support MULTIEDIT widgets. But those work fine.)


The code that responds to the button event is:

[code]    case ID_BUTTON_0: // Notifications sent by 'Connect'
      switch(NCode) {
      case WM_NOTIFICATION_CLICKED:
        // USER START (Optionally insert code for reacting on notification message)
        UsrLog("press");
        // USER END
        break;
      case WM_NOTIFICATION_RELEASED:
        // USER START (Optionally insert code for reacting on notification message)
        UsrLog("release");
        // USER END
        break;
      // USER START (Optionally insert additional code for further notification handling)
      // USER END
      }
      break;

[/code]
I just added code to log unhandled messages and the only thing I see (for the button of interest) is WM_NOTIFICATION_MOVED_OUT when I click on another button.

I also tried using BUTTON_SetReactOnLevel(). The result was that I only get one WM_NOTIFICATION_CLICKED (though the button continues to get WM_NOTIFICATION_MOVED_OUT if another button is clicked after clicking it, even though no buttons get the WM_NOTIFICATION_CLICKED  message.)

Any suggestions on what to do to get the release messages is welcome!

Outcomes