Waiting for user input - modal window

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

    • Waiting for user input - modal window

      Hello,

      I'm trying to create the following application model:

      User clicks on the EDIT widget -> Modal window (screen keyboard) appears -> User input is stored -> The program reaches next line after virtual keyboard execution.

      Code:


      C Source Code

      1. void desktopCallback(WM_MESSAGE *pMsg)
      2. {
      3. int widgetId;
      4. static EDIT_Handle e;
      5. int res;
      6. switch (pMsg->MsgId) {
      7. case WM_NOTIFY_PARENT:
      8. widgetId = WM_GetId(pMsg->hWinSrc);
      9. if (pMsg->Data.v == WM_NOTIFICATION_CLICKED && widgetId == GUI_ID_EDIT0) {
      10. VKParams_t params = {0}; /* Some params passed to the virtual keyboard */
      11. res = VK_GetInput(¶ms)/*Creates dialog andexecutes it using GUI_ExecCreatedDialog() function */
      12. if (res == RES_OK) { /* Do some stuff */ }
      13. }
      14. break;
      15. case WM_SET_CALLBACK:
      16. e = EDIT_CreateEx(10, 90, 150, 40, WM_HBKWIN, WM_CF_SHOW, 0, GUI_ID_EDIT0, 20);
      17. EDIT_SetText(e, "Edit me");
      18. break;
      19. case WM_PAINT:
      20. GUI_SetBkColor(GUI_LIGHTBLUE);
      21. GUI_Clear();
      22. default:
      23. WM_DefaultProc(pMsg);
      24. }
      25. }
      Display All

      Please look at the lines 11-13. Blocking dialog is created and it returns value using GUI_EndDialog() function. Actually everything works fine, but this line in documentation makes me mad:
      "Blocking functions should never be called from within a callback function. This may cause malfunction of the application".
      And the question is how to create blocking dialog and wait until it's closed. Of course I can create dialog at the same level the Window Manager is executed but in this case how to wait until dialog is closed properly? Or maybe my thinking isn't good enough and this can be done in other way.

      Thanks for your answers!

      -------- EDIT----------

      I have an idea. I can create dialog at the same level the Window Manager is executed and when ending dialog I wll send custom message to the calling window. I think it will work fine.

      The post was edited 2 times, last by mati1485 ().