GUI_ExecDialogBox() never returns

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

    • GUI_ExecDialogBox() never returns


      On the STM32F7, using FreeRTOS, when I attempt to create blocking dialogs , with either my code or the (ST)emWin examples, GUI_ExecDialogBox() calls never return. Any hints?

      I realize that I am only a STemWin user but I have been trying to search for anyone else experiencing this and I haven't been able to find an answer. I understand if you can not help me.

      Thank you.
    • Hi,

      As stated in the manual the function GUI_ExecDialogBox() does not return until the dialog is closed by calling GUI_EndDialog(). That's why it is called a blocking function. You could add a button to the dialog and react on it. When reacting close the dialog.

      You could call GUI_CreateDialogBox(), this function returns after creating the dialog and does not block.


    • Oh.. ok. This threw me off from one of your examples:
      while (1) {
      _cbDialogUser, WM_HBKWIN, 0, 0); /* Execute the user dialog */

      I can get the dialog to launch but it none of the controls do anything.

      Very much appreciate you taking the time to answer. THe only other problem I have now is the concept of using a dialog, like numpad, to edit text in an EDIT control on another window. As soon as the dialog appears, the edit cursor and selected stop and the text reverts to normal. You can still edit it but you can not see the cursor.

      Thanks again. Really appreciate it.
    • Hi,

      Not sure which device you are using, but I guess it has a touch screen. If you run something like below, does the button react on touch input?

      C Source Code

      1. void MainTask(void) {
      2. GUI_Init();
      3. WM_SetDesktopColor(GUI_BLACK);
      4. BUTTON_CreateEx(10, 10, 80, 20, WM_HBKWIN, WM_CF_SHOW, 0, 0);
      5. while (1) {
      6. GUI_Delay(100);
      7. }
      8. }
      If it doesn't I suggest to check the touch implementation.

      Which device are you using?

      Another possibility is that the timing related functions are not implemented properly. Please check the function GUI_X_GetTime() and GUI_X_Delay(). These two functions providing a time base for emWin. GUI_X_GetTime() returns the system time in ms and it doesn't matter if these values coming from an underlying RTOS API or generated by a timer running (e.g. SysTick). In most cases these function are located in a file names GUI_X_<RTOS_NAME>.c.

      Attached are some examples. The one without an RTOS name requires to set up a timer which increments the variable OS_TimeMS every ms.


        (4.3 kB, downloaded 161 times, last: )
    • I am using the STM32F7 Discovery. Currently I have a nearly complete system with many windows and functional touch controlled buttons, silders, listwheels, etc. Development has been ongoing for a few months.

      All of the dialogs are created with CreateDialogBox(). I needed some text input so I created an ASCII keyboard window and hoped to use the scheme from the numpad example. I created another project just to test the numpad example itself but I could not get that to work. In my project I can, in fact, edit the text of an EDIT control from the ASCII kbd window that I created. But, When the window is created, the selected text and cursor disappear from the EDIT control, which does have the focus.

      I am using a number of FreeRTOS Threads in the project and I was able to successfully set emWin to work in RTOS. IN the UIThread, the touchpad is accessed and sent to emWin every 10ms. This has been working perfectly across the app. I am only using one thread for emWin though.

      When I began trying to get emWin into the project I went through the details and I am using GUI_X_OS.c.
      These are the cmsis wrapped routines in that file.

      int GUI_X_GetTime(void)
      return ((int) osKernelSysTick());// resolves to return ((int) xTaskGetTickCount()); in cmsis
      I changed it to:

      return xTaskGetTickCount() * portTICK_PERIOD_MS;

      as in the file you sent. What is the multiplication for?

      void GUI_X_Delay(int ms)
      osDelay( ms ); //resolves to vTaskDelay(ticks ? ticks : 1); in cmsis

      GUI_X_ExecIdle was empty so I changed it to:

      void GUI_X_ExecIdle(void)
      vTaskDelay(1 / portTICK_PERIOD_MS);

      For cmsis the GUI_X_Init() :
      void GUI_X_InitOS(void)
      /* Create Mutex lock */

      /* Create the Mutex used by the two threads */
      osMutex = osMutexCreate(osMutex(MUTEX));

      /* Create Semaphore lock */

      /* Create the Semaphore used by the two threads */
      osSemaphore= osSemaphoreCreate(osSemaphore(SEM), 1);

      void GUI_X_Unlock(void)

      void GUI_X_Lock(void)
      osMutexWait(osMutex , osWaitForever) ;

      /* Get Task handle */
      U32 GUI_X_GetTaskId(void)
      return ((U32) osThreadGetId());

      This is my first large RTOS project. For decades I have been doing bare metal IRQ driven real time projects so, I am probably wrong here but I think those look proper now?

      Testing the GUI_ExecDialog() creation again, I still have no response to buttons but the window is created.
      They do work when the dialog is created with GUI_CreateDialogBox(). Though I can not see the cursor in the host window, I can edit the text.

      It does seem like something in the background is not running properly.

      Thanks again for your help Sven. Very much appreciated. !!

      The post was edited 3 times, last by jona ().