AnsweredAssumed Answered

stm32f746g-disco and emWin (Does not work create a window)

Question asked by msn on Apr 22, 2016
Latest reply on Jun 30, 2017 by ra hummel
I start with stm32f746g-disco 32F746GDISCOVERY. For examples in STM32CubeF7 STM32Cube_FW_F7_V1.3.0  in particular STM32Cube_FW_F7_V1.3.0\Projects\STM32746G-Discovery\Applications\STemWin\STemWin_HelloWorld.
Compiles example in Keil uVision5 (without optimization) - it's OK, HelloWorld displays.
 
Create a button:
hButton = BUTTON_Create(0, 0, 100, 50, GUI_ID_OK, WM_CF_SHOW);
BUTTON_SetText(hButton, "Test");
GUI_Exec();
It's okay.
Button.jpg
 
In GUIBuilder.exe do simple box (box + text), call the function CreateWindow - that does not work.
Distorted window background and distorted text labels.
The reason I can not find.
Window.jpg
 
If you have a board stm32f746g-disco it can flash Hex file can be a problem with the card.
Thank you.
 
Source:
Changed only BASIC_HelloWorld.c
#include "GUI.h"
#include "DIALOG.h"
WM_HWIN CreateWindow(void);
  
/*********************************************************************
*
*       Public code
*
**********************************************************************
*/
/*********************************************************************
*
*       MainTask
*/
  
void MainTask(void)
{
  static BUTTON_Handle hButton;
  static WM_HWIN hWin;
      
    /*
    // All ok
  hButton = BUTTON_Create(0, 0, 100, 50, GUI_ID_OK, WM_CF_SHOW);
  BUTTON_SetText(hButton, "Test");
    */
      
    /**/
    // Don't work
  CreateWindow();
  /**/
      
    GUI_Exec();
      
  while (1);
}
  
/*************************** End of file ****************************/

Added only WindowDLG.c
// USER START (Optionally insert additional includes)
// USER END
  
#include "DIALOG.h"
  
/*********************************************************************
*
*       Defines
*
**********************************************************************
*/
#define ID_WINDOW_0    (GUI_ID_USER + 0x00)
#define ID_TEXT_0    (GUI_ID_USER + 0x01)
  
  
// USER START (Optionally insert additional defines)
// USER END
  
/*********************************************************************
*
*       Static data
*
**********************************************************************
*/
  
// USER START (Optionally insert additional static data)
// USER END
  
/*********************************************************************
*
*       _aDialogCreate
*/
static const GUI_WIDGET_CREATE_INFO _aDialogCreate[] = {
  { WINDOW_CreateIndirect, "Window", ID_WINDOW_0, 0, 0, 480, 272, 0, 0x0, 0 },
  { TEXT_CreateIndirect, "Text", ID_TEXT_0, 100, 100, 80, 20, 0, 0x64, 0 },
  // USER START (Optionally insert additional widgets)
  // USER END
};
  
/*********************************************************************
*
*       Static code
*
**********************************************************************
*/
  
// USER START (Optionally insert additional static code)
// USER END
  
/*********************************************************************
*
*       _cbDialog
*/
static void _cbDialog(WM_MESSAGE * pMsg) {
  WM_HWIN hItem;
  // USER START (Optionally insert additional variables)
  // USER END
  
  switch (pMsg->MsgId) {
  case WM_INIT_DIALOG:
    //
    // Initialization of 'Window'
    //
    hItem = pMsg->hWin;
    WINDOW_SetBkColor(hItem, 0x00FF0000);
    //
    // Initialization of 'Text'
    //
    hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_0);
    TEXT_SetText(hItem, "Test");
    TEXT_SetTextColor(hItem, 0x00FFFFFF);
    TEXT_SetTextAlign(hItem, GUI_TA_HCENTER | GUI_TA_VCENTER);
    TEXT_SetFont(hItem, GUI_FONT_13_1);
    // USER START (Optionally insert additional code for further widget initialization)
    // USER END
    break;
  // USER START (Optionally insert additional message handling)
  // USER END
  default:
    WM_DefaultProc(pMsg);
    break;
  }
}
  
/*********************************************************************
*
*       Public code
*
**********************************************************************
*/
/*********************************************************************
*
*       CreateWindow
*/
WM_HWIN CreateWindow(void);
WM_HWIN CreateWindow(void) {
  WM_HWIN hWin;
  
  hWin = GUI_CreateDialogBox(_aDialogCreate, GUI_COUNTOF(_aDialogCreate), _cbDialog, WM_HBKWIN, 0, 0);
  return hWin;
}
  
// USER START (Optionally insert additional public code)
// USER END
  
/*************************** End of file ****************************/


The files from: IncSrc and MDK-AR.
 
Hex file: STM32746G_DISCOVERY_Button.rar - all ok
STM32746G_DISCOVERY_Window.rar - don't work

Outcomes