WM_SetUntouchable

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

      Post by volodymyr ().

      This post was deleted by the author themselves ().
    • Hi,

      If I get you right you want to make sure that the initial dialog (the one with _cbDialog) don't receive input when the derived dialog is created (_cbDerivedDialog), right?

      To achieve that you can simply make the derived dialog modal:

      C Source Code

      1. static void _cbDerivedDialog(WM_MESSAGE * pMsg) {
      2. WM_HWIN hItem;
      3. int NCode;
      4. int Id;
      5. WM_KEY_INFO * pInfo = (WM_KEY_INFO *)pMsg->Data.p;
      6. switch (pMsg->MsgId) {
      7. case WM_INIT_DIALOG:
      8. setupDropdown(WM_GetDialogItem(pMsg->hWin, ID_DERIVED_DROPDOWN_0));
      9. WM_MakeModal(pMsg->hWin);
      10. break;
      11. case WM_NOTIFY_PARENT:
      12. switch (pMsg->Data.v) {
      13. case WM_NOTIFICATION_RELEASED:
      14. switch (WM_GetId(pMsg->hWinSrc)) {
      15. case ID_DERIVED_BUTTON_0:
      16. GUI_EndDialog(pMsg->hWin, 0);
      17. isUntouched = 0;
      18. break;
      19. }
      20. break;
      21. }
      22. break;
      23. default:
      24. WM_DefaultProc(pMsg);
      25. break;
      26. }
      27. }
      Display All
      Regards,
      Sven

      Post by volodymyr ().

      This post was deleted by the author themselves ().
    • Hi,

      OK, now I got it, I guess.

      Try this:

      C Source Code

      1. #include "DIALOG.h"
      2. /*********************************************************************
      3. *
      4. * Defines
      5. *
      6. **********************************************************************
      7. */
      8. #define ID_FRAMEWIN_0 (GUI_ID_USER + 0x00)
      9. #define ID_DROPDOWN_0 (GUI_ID_USER + 0x01)
      10. #define ID_BUTTON_0 (GUI_ID_USER + 0x02)
      11. #define ID_DERIVED_0 (GUI_ID_USER + 0x03)
      12. #define ID_DERIVED_DROPDOWN_0 (GUI_ID_USER + 0x04)
      13. #define ID_DERIVED_BUTTON_0 (GUI_ID_USER + 0x05)
      14. /*********************************************************************
      15. *
      16. * Static data
      17. *
      18. **********************************************************************
      19. */
      20. static U8 isUntouched = 0;
      21. static const GUI_WIDGET_CREATE_INFO _aDialogCreate[] = {
      22. { FRAMEWIN_CreateIndirect, "Main window", ID_FRAMEWIN_0, 0, 0, 200, 200, FRAMEWIN_CF_MOVEABLE, 0x0, 0 },
      23. { DROPDOWN_CreateIndirect, "Dropdown", ID_DROPDOWN_0, 10, 10, 80, 50, 0, 0x0, 0 },
      24. { BUTTON_CreateIndirect, "New window", ID_BUTTON_0, 100, 10, 80, 20, 0, 0x0, 0 },
      25. };
      26. static const GUI_WIDGET_CREATE_INFO _aDerivedDialogCreate[] = {
      27. { FRAMEWIN_CreateIndirect, "Derived window", ID_DERIVED_0, 80, 80, 150, 90, FRAMEWIN_CF_MOVEABLE, 0x0, 0 },
      28. { DROPDOWN_CreateIndirect, "Dropdown", ID_DERIVED_DROPDOWN_0, 10, 10, 80, 50, 0, 0x0, 0 },
      29. { BUTTON_CreateIndirect, "Close", ID_DERIVED_BUTTON_0, 10, 40, 80, 20, 0, 0x0, 0 },
      30. };
      31. static void setupDropdown(WM_HWIN hItem) {
      32. DROPDOWN_AddString(hItem, "Item 1");
      33. DROPDOWN_AddString(hItem, "Item 2");
      34. DROPDOWN_AddString(hItem, "Item 3");
      35. }
      36. /*********************************************************************
      37. *
      38. * Static code
      39. *
      40. **********************************************************************
      41. */
      42. /*********************************************************************
      43. *
      44. * _cbBk
      45. */
      46. static void _cbWin(WM_MESSAGE * pMsg) {
      47. switch (pMsg->MsgId) {
      48. case WM_PAINT:
      49. break;
      50. default:
      51. WM_DefaultProc(pMsg);
      52. break;
      53. }
      54. }
      55. /*********************************************************************
      56. *
      57. * _cbDerivedDialog
      58. */
      59. static void _cbDerivedDialog(WM_MESSAGE * pMsg) {
      60. static WM_HWIN hWin;
      61. WM_HWIN hItem;
      62. int NCode;
      63. int Id;
      64. WM_KEY_INFO * pInfo = (WM_KEY_INFO *)pMsg->Data.p;
      65. switch (pMsg->MsgId) {
      66. case WM_INIT_DIALOG:
      67. setupDropdown(WM_GetDialogItem(pMsg->hWin, ID_DERIVED_DROPDOWN_0));
      68. hWin = WM_CreateWindowAsChild(0, 0, LCD_GetXSize(), LCD_GetYSize(), WM_HBKWIN, WM_CF_SHOW | WM_CF_HASTRANS, _cbWin, 0);
      69. WM_BringToTop(pMsg->hWin); // Call for each window which should react on touch
      70. // WM_BringToTop(hKeyPad);
      71. break;
      72. case WM_NOTIFY_PARENT:
      73. switch (pMsg->Data.v) {
      74. case WM_NOTIFICATION_RELEASED:
      75. switch (WM_GetId(pMsg->hWinSrc)) {
      76. case ID_DERIVED_BUTTON_0:
      77. GUI_EndDialog(pMsg->hWin, 0);
      78. WM_DeleteWindow(hWin);
      79. isUntouched = 0;
      80. break;
      81. }
      82. break;
      83. }
      84. break;
      85. default:
      86. WM_DefaultProc(pMsg);
      87. break;
      88. }
      89. }
      90. /*********************************************************************
      91. *
      92. * _cbDialog
      93. */
      94. static void _cbDialog(WM_MESSAGE * pMsg) {
      95. WM_HWIN hItem;
      96. int NCode;
      97. int Id;
      98. WM_KEY_INFO * pInfo = (WM_KEY_INFO *)pMsg->Data.p;
      99. switch (pMsg->MsgId) {
      100. case WM_INIT_DIALOG:
      101. setupDropdown(WM_GetDialogItem(pMsg->hWin, ID_DROPDOWN_0));
      102. break;
      103. case WM_TOUCH:
      104. if (isUntouched) {
      105. WM_SendMessage(WM_GetParent(pMsg->hWin), pMsg);
      106. break;
      107. }
      108. case WM_NOTIFY_PARENT:
      109. switch (pMsg->Data.v) {
      110. case WM_NOTIFICATION_RELEASED:
      111. switch (WM_GetId(pMsg->hWinSrc)) {
      112. case ID_BUTTON_0:
      113. isUntouched = 1;
      114. GUI_CreateDialogBox(_aDerivedDialogCreate, GUI_COUNTOF(_aDerivedDialogCreate), _cbDerivedDialog, WM_HBKWIN, 0, 0);
      115. break;
      116. }
      117. break;
      118. }
      119. break;
      120. default:
      121. WM_DefaultProc(pMsg);
      122. break;
      123. }
      124. }
      125. /*********************************************************************
      126. *
      127. * Public code
      128. *
      129. **********************************************************************
      130. */
      131. /*********************************************************************
      132. *
      133. * MainTask
      134. */
      135. void MainTask(void) {
      136. GUI_Init();
      137. WM_SetBkWindowColor(GUI_GRAY);
      138. GUI_CreateDialogBox(_aDialogCreate, GUI_COUNTOF(_aDialogCreate), _cbDialog, WM_HBKWIN, 0, 0);
      139. while (1) {
      140. GUI_Delay(100);
      141. };
      142. }
      Display All

      In WM_INIT_DIALOG of _cbDerivedDialog() I create another window which is transparent. This window will catch the input outside _cbDerivedDialog() and do nothing with it.

      After creating this window make sure that all dialogs which should still receive input are on top (at least over the transparent window).

      Regards,
      Sven

      Post by volodymyr ().

      This post was deleted by the author themselves ().

      Post by volodymyr ().

      This post was deleted by the author themselves ().