WM_SetUntouchable() - issue with this new function from v.5.50

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

    • WM_SetUntouchable() - issue with this new function from v.5.50

      Hello.

      I found the issue with the function WM_SetUntouchable.

      Conditions:

      1. There is a window bottomWin, it contains the button, that creates new window newWin, which fully overlaps bottomWin.

      2. newWin contains a button that creates two new small derWin_1 and derWin_2.
      After creating of them the newWin should be untouchable until windows derWin_1 and derWin_2 will be closed.
      The windows derWin_1 and derWin_2 both should can receive PID-events:
      - one of them is the window (derWin_1) with some editable widgets like EDIT, SPINBOX etc., that should receive keys from virtual keyboard,
      - second is the virtual keyboard (derWin_2).

      I used the function WM_SetUntouchable for making the newWin untouchable.

      Issue:
      If I touch on the area of the untouchable newWin then this touch reaches the touchable bottomWin, it appears on top over all windows with focus on it.

      Question:
      Is this behaviour correct considering the newWin fully overlaps the bottomWin?

      C Source Code

      1. #include "DIALOG.h"
      2. static WM_HWIN bottomWin;
      3. static WM_HWIN newWin;
      4. static WM_HWIN derWin_1;
      5. static WM_HWIN derWin_2;
      6. static const GUI_WIDGET_CREATE_INFO _aBottom[] = {
      7. { FRAMEWIN_CreateIndirect, "Main window", 0, 0, 0, 200, 200, FRAMEWIN_CF_MOVEABLE, 0x0, 0 },
      8. { BUTTON_CreateIndirect, "New window", GUI_ID_BUTTON0, 50, 50, 80, 20, 0, 0x0, 0 },
      9. };
      10. static const GUI_WIDGET_CREATE_INFO _aNew[] = {
      11. { FRAMEWIN_CreateIndirect, "New window", 0, 0, 0, 200, 200, FRAMEWIN_CF_MOVEABLE, 0x0, 0 },
      12. { BUTTON_CreateIndirect, "Two windows", GUI_ID_BUTTON0, 40, 40, 80, 20, 0, 0x0, 0 },
      13. { BUTTON_CreateIndirect, "Close", GUI_ID_BUTTON1, 40, 80, 80, 20, 0, 0x0, 0 },
      14. };
      15. static const GUI_WIDGET_CREATE_INFO _aDer_1[] = {
      16. { FRAMEWIN_CreateIndirect, "Derived window 1", NULL, 100, 10, 150, 90, FRAMEWIN_CF_MOVEABLE, 0x0, 0 },
      17. { MULTIEDIT_CreateIndirect, NULL, GUI_ID_EDIT0, 10, 10, 80, 50, 0, 0x128, 128 },
      18. };
      19. static const GUI_WIDGET_CREATE_INFO _aDer_2[] = {
      20. { FRAMEWIN_CreateIndirect, "Small kbd", NULL, 100, 120, 150, 90, FRAMEWIN_CF_MOVEABLE, 0x0, 0 },
      21. { BUTTON_CreateIndirect, "0", GUI_ID_BUTTON0, 10, 10, 20, 20, 0, 0x0, 0 },
      22. { BUTTON_CreateIndirect, "1", GUI_ID_BUTTON1, 40, 10, 20, 20, 0, 0x0, 0 },
      23. { BUTTON_CreateIndirect, "2", GUI_ID_BUTTON2, 70, 10, 20, 20, 0, 0x0, 0 },
      24. { BUTTON_CreateIndirect, "3", GUI_ID_BUTTON3, 100, 10, 20, 20, 0, 0x0, 0 },
      25. { BUTTON_CreateIndirect, "Close", GUI_ID_BUTTON9, 10, 40, 80, 20, 0, 0x0, 0 },
      26. };
      27. static void _cbDer_2(WM_MESSAGE * pMsg) {
      28. int NCode;
      29. switch (pMsg->MsgId) {
      30. case WM_INIT_DIALOG:
      31. BUTTON_SetFocusable(WM_GetDialogItem(pMsg->hWin, GUI_ID_BUTTON0), 0);
      32. BUTTON_SetFocusable(WM_GetDialogItem(pMsg->hWin, GUI_ID_BUTTON1), 0);
      33. BUTTON_SetFocusable(WM_GetDialogItem(pMsg->hWin, GUI_ID_BUTTON2), 0);
      34. BUTTON_SetFocusable(WM_GetDialogItem(pMsg->hWin, GUI_ID_BUTTON3), 0);
      35. break;
      36. case WM_NOTIFY_PARENT:
      37. switch (pMsg->Data.v) {
      38. case WM_NOTIFICATION_RELEASED:
      39. switch (WM_GetId(pMsg->hWinSrc)) {
      40. case GUI_ID_BUTTON0 ... GUI_ID_BUTTON8:
      41. NCode = 0;
      42. BUTTON_GetText(pMsg->hWinSrc, &NCode, 2);
      43. GUI_SendKeyMsg(NCode, 1);
      44. break;
      45. case GUI_ID_BUTTON9:
      46. WM_SetUntouchable(newWin, 0);
      47. GUI_EndDialog(pMsg->hWin, 0);
      48. GUI_EndDialog(derWin_1, 0);
      49. break;
      50. }
      51. break;
      52. }
      53. break;
      54. default:
      55. WM_DefaultProc(pMsg);
      56. break;
      57. }
      58. }
      59. static void _cbNew(WM_MESSAGE * pMsg) {
      60. switch (pMsg->MsgId) {
      61. case WM_NOTIFY_PARENT:
      62. switch (pMsg->Data.v) {
      63. case WM_NOTIFICATION_RELEASED:
      64. switch (WM_GetId(pMsg->hWinSrc)) {
      65. case GUI_ID_BUTTON0:
      66. WM_SetUntouchable(pMsg->hWin, 1);
      67. derWin_2 = GUI_CreateDialogBox(_aDer_2, GUI_COUNTOF(_aDer_2), _cbDer_2, WM_HBKWIN, 0, 0);
      68. FRAMEWIN_SetClientColor(derWin_2, GUI_YELLOW);
      69. WM_DisableWindow(derWin_2);
      70. derWin_1 = GUI_CreateDialogBox(_aDer_1, GUI_COUNTOF(_aDer_1), NULL, WM_HBKWIN, 0, 0);
      71. break;
      72. case GUI_ID_BUTTON1:
      73. GUI_EndDialog(pMsg->hWin, 0);
      74. break;
      75. }
      76. break;
      77. }
      78. break;
      79. default:
      80. WM_DefaultProc(pMsg);
      81. break;
      82. }
      83. }
      84. static void _cbBottom(WM_MESSAGE * pMsg) {
      85. switch (pMsg->MsgId) {
      86. case WM_INIT_DIALOG:
      87. FRAMEWIN_SetClientColor(pMsg->hWin, GUI_GRAY);
      88. break;
      89. case WM_NOTIFY_PARENT:
      90. switch (pMsg->Data.v) {
      91. case WM_NOTIFICATION_RELEASED:
      92. switch (WM_GetId(pMsg->hWinSrc)) {
      93. case GUI_ID_BUTTON0:
      94. newWin = GUI_CreateDialogBox(_aNew, GUI_COUNTOF(_aNew), _cbNew, WM_HBKWIN, 0, 0);
      95. break;
      96. }
      97. break;
      98. }
      99. break;
      100. default:
      101. WM_DefaultProc(pMsg);
      102. break;
      103. }
      104. }
      105. void MainTask(void) {
      106. GUI_Init();
      107. WM_SetBkWindowColor(GUI_WHITE);
      108. bottomWin = GUI_CreateDialogBox(_aBottom, GUI_COUNTOF(_aBottom), _cbBottom, WM_HBKWIN, 0, 0);
      109. while (1) {
      110. GUI_Delay(100);
      111. };
      112. }
      Display All
      Best regards,
      Volodymyr.
    • Hi Volodymyr,

      yes, this behavior is correct. Calling WM_SetUntouchable() to make a window untouchable means that the PID info doesn't get send to the untouchable window, but to any window behind the untouchable window that isn't marked untouchable. It's exactly how the untouchable mode for a window should work.

      The bottomWin was never marked untouchable, so it receives the PID info.

      Best regards,

      Florian
      Please read the forum rules before posting.

      Keep in mind, this is *not* a support forum.
      Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
      Should you be entitled to support you can contact us via our support system: segger.com/ticket/

      Or you can contact us via e-mail.