GUI_CreateDialogBox() do nothing on screen

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

    • GUI_CreateDialogBox() do nothing on screen

      Hi to all,

      I'm using STEMWIN (a precompiled library for ST product) on STM32F103.


      the use of the lines indicated in the manual give the expected output

      C Source Code

      1. GUI_SetFont(&GUI_Font8x16);
      2. GUI_SetBkColor(GUI_BLUE);
      3. GUI_Clear();
      4. GUI_SetPenSize(10);
      5. GUI_SetColor(GUI_RED);
      6. GUI_DrawLine(80, 10, 240, 90);
      7. GUI_DrawLine(80, 90, 240, 10);
      8. GUI_SetBkColor(GUI_BLACK);
      9. GUI_SetColor(GUI_WHITE);
      10. GUI_SetTextMode(GUI_TM_NORMAL);
      11. GUI_DispStringHCenterAt("GUI_TM_NORMAL" , 160, 10);
      12. GUI_SetTextMode(GUI_TM_REV);
      13. GUI_DispStringHCenterAt("GUI_TM_REV" , 160, 26);
      14. GUI_SetTextMode(GUI_TM_TRANS);
      15. GUI_DispStringHCenterAt("GUI_TM_TRANS" , 160, 42);
      16. GUI_SetTextMode(GUI_TM_XOR);
      17. GUI_DispStringHCenterAt("GUI_TM_XOR" , 160, 58);
      18. GUI_SetTextMode(GUI_TM_TRANS | GUI_TM_REV);
      19. GUI_DispStringHCenterAt("GUI_TM_TRANS | GUI_TM_REV", 160, 74);
      Display All




      But when I use GUIUILDER and call CreateWindow(), nothing appear on sreen. CreateWindows() execute and rturn de handler, but there is no call to function read/write.
      What I must configure before call CreateWindows() ?

      some code.
      main:

      C Source Code

      1. __HAL_RCC_CRC_CLK_ENABLE();
      2. GUI_Init();
      3. WM_MULTIBUF_Enable(1);
      4. GUI_SetLayerVisEx(1, 1);
      5. GUI_SelectLayer(1);
      6. CreateWindow();


      LCD_init:

      C Source Code

      1. void LCD_X_Config(void) {
      2. GUI_DEVICE * pDevice;
      3. CONFIG_FLEXCOLOR Config = {0};
      4. GUI_PORT_API PortAPI = {0};
      5. //
      6. // Set display driver and color conversion
      7. //
      8. pDevice = GUI_DEVICE_CreateAndLink(GUIDRV_FLEXCOLOR, GUICC_565, 0, 0);//16bit color flexcolor driver
      9. //
      10. // Display driver configuration, required for Lin-driver
      11. //
      12. LCD_SetSizeEx (0, XSIZE_PHYS , YSIZE_PHYS);
      13. LCD_SetVSizeEx(0, VXSIZE_PHYS, VYSIZE_PHYS);
      14. //
      15. // Orientation
      16. //
      17. Config.Orientation = GUI_SWAP_XY;
      18. GUIDRV_FlexColor_Config(pDevice, &Config);
      19. //
      20. // Set controller and operation mode
      21. //
      22. PortAPI.pfWrite8_A0 = LcdWriteReg;
      23. PortAPI.pfWrite8_A1 = LcdWriteData;
      24. PortAPI.pfWriteM8_A1 = LcdWriteDataMultiple;
      25. PortAPI.pfRead8_A1 = LcdReadReg;
      26. PortAPI.pfReadM8_A1 = LcdReadDataMultiple;
      27. /*
      28. PortAPI.pfWrite16_A0 = LcdWriteReg;
      29. PortAPI.pfWrite16_A1 = LcdWriteData;
      30. PortAPI.pfWriteM16_A1 = LcdWriteDataMultiple;
      31. PortAPI.pfReadM16_A1 = LcdReadDataMultiple;
      32. */
      33. //GUIDRV_FLEXCOLOR_F66709 -> Driver for ili9341
      34. //GUIDRV_FLEXCOLOR_M16C0B8 -> 16bpp, no cache, 8 bitbus
      35. GUIDRV_FlexColor_SetFunc(pDevice, &PortAPI, GUIDRV_FLEXCOLOR_F66709, GUIDRV_FLEXCOLOR_M16C0B8);//ILI9341, 16bit color, 8 bit bus, no cache
      36. }
      Display All
      Output of Guibuilder:

      C Source Code

      1. /*********************************************************************
      2. * *
      3. * SEGGER Microcontroller GmbH & Co. KG *
      4. * Solutions for real time microcontroller applications *
      5. * *
      6. **********************************************************************
      7. * *
      8. * C-file generated by: *
      9. * *
      10. * GUI_Builder for emWin version 5.44 *
      11. * Compiled Nov 10 2017, 08:53:57 *
      12. * (c) 2017 Segger Microcontroller GmbH & Co. KG *
      13. * *
      14. **********************************************************************
      15. * *
      16. * Internet: www.segger.com Support: support@segger.com *
      17. * *
      18. **********************************************************************
      19. */
      20. // USER START (Optionally insert additional includes)
      21. // USER END
      22. #include "DIALOG.h"
      23. /*********************************************************************
      24. *
      25. * Defines
      26. *
      27. **********************************************************************
      28. */
      29. #define ID_WINDOW_0 (GUI_ID_USER + 0x04)
      30. #define ID_BUTTON_0 (GUI_ID_USER + 0x05)
      31. // USER START (Optionally insert additional defines)
      32. // USER END
      33. /*********************************************************************
      34. *
      35. * Static data
      36. *
      37. **********************************************************************
      38. */
      39. // USER START (Optionally insert additional static data)
      40. // USER END
      41. /*********************************************************************
      42. *
      43. * _aDialogCreate
      44. */
      45. static const GUI_WIDGET_CREATE_INFO _aDialogCreate[] = {
      46. { WINDOW_CreateIndirect, "Window", ID_WINDOW_0, 0, 0, 320, 240, 0, 0x0, 0 },
      47. { BUTTON_CreateIndirect, "Button", ID_BUTTON_0, 118, 93, 80, 20, 0, 0x0, 0 },
      48. // USER START (Optionally insert additional widgets)
      49. // USER END
      50. };
      51. /*********************************************************************
      52. *
      53. * Static code
      54. *
      55. **********************************************************************
      56. */
      57. // USER START (Optionally insert additional static code)
      58. // USER END
      59. /*********************************************************************
      60. *
      61. * _cbDialog
      62. */
      63. static void _cbDialog(WM_MESSAGE * pMsg) {
      64. WM_HWIN hItem;
      65. int NCode;
      66. int Id;
      67. // USER START (Optionally insert additional variables)
      68. // USER END
      69. switch (pMsg->MsgId) {
      70. case WM_INIT_DIALOG:
      71. //
      72. // Initialization of 'Window'
      73. //
      74. hItem = pMsg->hWin;
      75. WINDOW_SetBkColor(hItem, GUI_MAKE_COLOR(0x0000FF00));
      76. // USER START (Optionally insert additional code for further widget initialization)
      77. // USER END
      78. break;
      79. case WM_NOTIFY_PARENT:
      80. Id = WM_GetId(pMsg->hWinSrc);
      81. NCode = pMsg->Data.v;
      82. switch(Id) {
      83. case ID_BUTTON_0: // Notifications sent by 'Button'
      84. switch(NCode) {
      85. case WM_NOTIFICATION_CLICKED:
      86. // USER START (Optionally insert code for reacting on notification message)
      87. // USER END
      88. break;
      89. case WM_NOTIFICATION_RELEASED:
      90. // USER START (Optionally insert code for reacting on notification message)
      91. // USER END
      92. break;
      93. // USER START (Optionally insert additional code for further notification handling)
      94. // USER END
      95. }
      96. break;
      97. // USER START (Optionally insert additional code for further Ids)
      98. // USER END
      99. }
      100. break;
      101. // USER START (Optionally insert additional message handling)
      102. // USER END
      103. default:
      104. WM_DefaultProc(pMsg);
      105. break;
      106. }
      107. }
      108. /*********************************************************************
      109. *
      110. * Public code
      111. *
      112. **********************************************************************
      113. */
      114. /*********************************************************************
      115. *
      116. * CreateWindow
      117. */
      118. WM_HWIN CreateWindow(void);
      119. WM_HWIN CreateWindow(void) {
      120. WM_HWIN hWin;
      121. hWin = GUI_CreateDialogBox(_aDialogCreate, GUI_COUNTOF(_aDialogCreate), _cbDialog, WM_HBKWIN, 0, 0);
      122. return hWin;
      123. }
      124. // USER START (Optionally insert additional public code)
      125. // USER END
      126. /*************************** End of file ****************************/
      Display All
      Whats wrong with GUIBuilder ?


      I know that now exist app builder, but the license issued by ST cover only GIBulder
    • Hi,

      Does your MainTask() have a superloop? The superloop is necessary so that emWin is "kept alive" and interactions with widgets work. This is due to the callback mechanism of emWin.

      After GUI_Init() is called and all your calls in MainTask() are done, the application should run in a loop like this:

      C Source Code

      1. while (1) {
      2. GUI_Delay(100);
      3. }
      Simple operations such as line drawing or displaying strings do not require a superloop.

      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.
    • Hi Florian,

      thanks for your help.
      By adding a superloop with GUI_Delay everything works fine.
      In my project I don't have a superloop where to call the GUI_Delay() function, can I use GUI_Exec() instead and call it only when I need to update the screen (obviously the touch will not work in this configuration)?
    • Hi,

      Yes, you can do that. Maybe like this:

      C Source Code

      1. CreateWindow()
      2. GUI_Exec()
      3. DeleteWindow()
      4. CreateAnotherWindoW()
      5. GUI_Exec()
      But without a loop you can not do things like animations ore create timer with emWin.



      Also, do not call GUI_Exec() from a callback function of a window.

      BTW, the following three calls shouldn't be required:

      C Source Code

      1. WM_MULTIBUF_Enable(1);
      2. GUI_SetLayerVisEx(1, 1);
      3. GUI_SelectLayer(1);

      Multibuffering is not available when using the GUIDRV_FlexColor driver.
      The layer specific calls are not required if using only one layer. Anyway, since you have only one layer you had to call these function with LayerIndex == 0. ;)

      Regards,
      Sven
      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.