cancel
Showing results for 
Search instead for 
Did you mean: 

STemWin Button - not getting WM_NOTIFICATION_RELEASED message

hbarta2
Associate III
Posted on January 08, 2015 at 15:48

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!

#stemwin-button-wm_notification_r
1 REPLY 1
hbarta2
Associate III
Posted on January 13, 2015 at 20:34

It turns out that lower level code was not passing 'pen up' messages along.

By the time I got around to the solution, I had already migrated my code to the STM324x9I-EVAL board and got touch working by copying the BSP_Pointer_Update() function from another demo (Hello World, IIRC which doesn't even use touch...) A quick look at the code indicates it only notifies the window manager when touch events occur.

Along the way to fixing that, I learned that if  BSP_TS_GetState() is called more frequently than about every 10 ms, it gets screwy results. And that probably happens because the stack provides no way to propagate I2C errors up the stack. The call to BSP_TS_GetState() is guaranteed to produce results but they may not be meaningful. 😉

I also learned that if the code hammers the I2C touch controller (TS3510) enough times in rapid succession, a power cycle will be required to get it to respond.

<sigh>