2017-11-22 07:19 AM
Hi
I'm using STemWin with STM32F429I Discovery board. I need show a variable on the Dialog. But I Don't know how to text a variable. Is there any example in this regard?
Best Regards
Thank you
#print #stemwin #variableSolved! Go to Solution.
2017-11-22 11:24 PM
Thank you for the reply. I Solved the problem. In the main program, it is necessary to call GUI_Exec () function continuously. If this function is not called, changes can not be displayed on the screen.
this is full code
/*********************************************************************
* ** SEGGER Microcontroller GmbH & Co. KG ** Solutions for real time microcontroller applications ** ************************************************************************ ** C-file generated by: ** ** GUI_Builder for emWin version 5.22 ** Compiled Jul 4 2013, 15:16:01 ** (c) 2013 Segger Microcontroller GmbH & Co. KG ** ************************************************************************ ** Internet: www.segger.com Support:
mailto:support@segger.com
*
* ************************************************************************/// USER START (Optionally insert additional includes)
// USER END&sharpinclude 'DIALOG.h'
&sharpinclude 'main.h'/*********************************************************************** Defines************************************************************************/&sharpdefine ID_FRAMEWIN_0 (GUI_ID_USER + 0x04)&sharpdefine ID_BUTTON_0 (GUI_ID_USER + 0x05)&sharpdefine ID_EDIT_0 (GUI_ID_USER + 0x09)// 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[] = { { FRAMEWIN_CreateIndirect, 'GyroscobeDialog', ID_FRAMEWIN_0, 0, 0, 240, 320, 0, 0x64, 0 }, { BUTTON_CreateIndirect, 'Button', ID_BUTTON_0, 68, 42, 80, 20, 0, 0x0, 0 }, { EDIT_CreateIndirect, 'Edit', ID_EDIT_0, 73, 4, 80, 20, 0, 0x64, 0 }, // USER START (Optionally insert additional widgets) // USER END};/*********************************************************************
** Static code************************************************************************/unsigned int datax;char st[20];// USER START (Optionally insert additional static code)// USER END/*********************************************************************
** _cbDialog*/static void _cbDialog(WM_MESSAGE * pMsg) { WM_HWIN hItem; int NCode; int Id; // USER START (Optionally insert additional variables) // USER ENDswitch (pMsg->MsgId) {
case WM_INIT_DIALOG: // // Initialization of 'GyroscobeDialog' // hItem = pMsg->hWin; FRAMEWIN_SetText(hItem, 'Gyroscobe Deneyi'); FRAMEWIN_SetFont(hItem, GUI_FONT_16B_ASCII); FRAMEWIN_SetTextAlign(hItem, GUI_TA_HCENTER | GUI_TA_VCENTER); FRAMEWIN_SetTextColor(hItem, 0x00000000); // // Initialization of 'Edit' // hItem = WM_GetDialogItem(pMsg->hWin, ID_EDIT_0); EDIT_SetText(hItem, '123'); // USER START (Optionally insert additional code for further widget initialization) // USER END break; case WM_NOTIFY_PARENT: Id = WM_GetId(pMsg->hWinSrc); NCode = pMsg->Data.v; switch(Id) { case ID_BUTTON_0: // Notifications sent by 'Button' switch(NCode) { case WM_NOTIFICATION_CLICKED: // USER START (Optionally insert code for reacting on notification message) STM_EVAL_LEDToggle(LED4); datax++; sprintf(st,'Sayi=%ld',datax); hItem = WM_GetDialogItem(pMsg->hWin, ID_EDIT_0); EDIT_SetText(hItem, st); // USER END break; case WM_NOTIFICATION_RELEASED: // USER START (Optionally insert code for reacting on notification message) // USER END break; // USER START (Optionally insert additional code for further notification handling) // USER END } break; case ID_EDIT_0: // Notifications sent by 'Edit' switch(NCode) { case WM_NOTIFICATION_CLICKED: // USER START (Optionally insert code for reacting on notification message) // USER END break; case WM_NOTIFICATION_RELEASED: // USER START (Optionally insert code for reacting on notification message) // USER END break; case WM_NOTIFICATION_VALUE_CHANGED: // USER START (Optionally insert code for reacting on notification message) // USER END break; // USER START (Optionally insert additional code for further notification handling) // USER END } break; // USER START (Optionally insert additional code for further Ids) // USER END } break; // USER START (Optionally insert additional message handling) // USER END default: WM_DefaultProc(pMsg); break; }}/*********************************************************************
** Public code************************************************************************//*********************************************************************** CreateGyroscobeDialog*/WM_HWIN CreateGyroscobeDialog(void);WM_HWIN CreateGyroscobeDialog(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 ****************************/
2017-11-22 07:54 AM
I Don't know how to text a variable
I don't know what you mean by, 'text a variable'
But perhaps the standard 'C' library function sprintf() could help ... ?
2017-11-22 09:16 AM
Sorry. I mean, How to I write a text on the screen? I can not write anything on the screen. I use STemWin functions but I can not write anything.
void MainTask(void);void MainTask(void){ WM_SetCreateFlags(WM_CF_MEMDEV | WM_CF_CONST_OUTLINE); GUI_Init(); GUI_CURSOR_Show(); GUI_SetFont(&GUI_Font24B_ASCII); GUI_DispStringHCenterAt('GUI_Test', 120, 160); //Don't working!! while(1) { STM_EVAL_LEDToggle(LED3); GUI_Delay(100); } }2017-11-22 09:26 AM
Can you get the examples working?
What does the documentation say?
2017-11-22 09:48 AM
I can develop my application on STM32F3429I discovery. I can make a design through GUI Builder and run this design on Board. I looked at the documents, but I could not get the information I wanted. I need a simple example.
2017-11-22 09:53 AM
Mucit23 wrote:
I can make a design through GUI Builder and run this design on Board.
So look at that code to see how it writes to the screen?
2017-11-22 11:24 PM
Thank you for the reply. I Solved the problem. In the main program, it is necessary to call GUI_Exec () function continuously. If this function is not called, changes can not be displayed on the screen.
this is full code
/*********************************************************************
* ** SEGGER Microcontroller GmbH & Co. KG ** Solutions for real time microcontroller applications ** ************************************************************************ ** C-file generated by: ** ** GUI_Builder for emWin version 5.22 ** Compiled Jul 4 2013, 15:16:01 ** (c) 2013 Segger Microcontroller GmbH & Co. KG ** ************************************************************************ ** Internet: www.segger.com Support:
mailto:support@segger.com
*
* ************************************************************************/// USER START (Optionally insert additional includes)
// USER END&sharpinclude 'DIALOG.h'
&sharpinclude 'main.h'/*********************************************************************** Defines************************************************************************/&sharpdefine ID_FRAMEWIN_0 (GUI_ID_USER + 0x04)&sharpdefine ID_BUTTON_0 (GUI_ID_USER + 0x05)&sharpdefine ID_EDIT_0 (GUI_ID_USER + 0x09)// 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[] = { { FRAMEWIN_CreateIndirect, 'GyroscobeDialog', ID_FRAMEWIN_0, 0, 0, 240, 320, 0, 0x64, 0 }, { BUTTON_CreateIndirect, 'Button', ID_BUTTON_0, 68, 42, 80, 20, 0, 0x0, 0 }, { EDIT_CreateIndirect, 'Edit', ID_EDIT_0, 73, 4, 80, 20, 0, 0x64, 0 }, // USER START (Optionally insert additional widgets) // USER END};/*********************************************************************
** Static code************************************************************************/unsigned int datax;char st[20];// USER START (Optionally insert additional static code)// USER END/*********************************************************************
** _cbDialog*/static void _cbDialog(WM_MESSAGE * pMsg) { WM_HWIN hItem; int NCode; int Id; // USER START (Optionally insert additional variables) // USER ENDswitch (pMsg->MsgId) {
case WM_INIT_DIALOG: // // Initialization of 'GyroscobeDialog' // hItem = pMsg->hWin; FRAMEWIN_SetText(hItem, 'Gyroscobe Deneyi'); FRAMEWIN_SetFont(hItem, GUI_FONT_16B_ASCII); FRAMEWIN_SetTextAlign(hItem, GUI_TA_HCENTER | GUI_TA_VCENTER); FRAMEWIN_SetTextColor(hItem, 0x00000000); // // Initialization of 'Edit' // hItem = WM_GetDialogItem(pMsg->hWin, ID_EDIT_0); EDIT_SetText(hItem, '123'); // USER START (Optionally insert additional code for further widget initialization) // USER END break; case WM_NOTIFY_PARENT: Id = WM_GetId(pMsg->hWinSrc); NCode = pMsg->Data.v; switch(Id) { case ID_BUTTON_0: // Notifications sent by 'Button' switch(NCode) { case WM_NOTIFICATION_CLICKED: // USER START (Optionally insert code for reacting on notification message) STM_EVAL_LEDToggle(LED4); datax++; sprintf(st,'Sayi=%ld',datax); hItem = WM_GetDialogItem(pMsg->hWin, ID_EDIT_0); EDIT_SetText(hItem, st); // USER END break; case WM_NOTIFICATION_RELEASED: // USER START (Optionally insert code for reacting on notification message) // USER END break; // USER START (Optionally insert additional code for further notification handling) // USER END } break; case ID_EDIT_0: // Notifications sent by 'Edit' switch(NCode) { case WM_NOTIFICATION_CLICKED: // USER START (Optionally insert code for reacting on notification message) // USER END break; case WM_NOTIFICATION_RELEASED: // USER START (Optionally insert code for reacting on notification message) // USER END break; case WM_NOTIFICATION_VALUE_CHANGED: // USER START (Optionally insert code for reacting on notification message) // USER END break; // USER START (Optionally insert additional code for further notification handling) // USER END } break; // USER START (Optionally insert additional code for further Ids) // USER END } break; // USER START (Optionally insert additional message handling) // USER END default: WM_DefaultProc(pMsg); break; }}/*********************************************************************
** Public code************************************************************************//*********************************************************************** CreateGyroscobeDialog*/WM_HWIN CreateGyroscobeDialog(void);WM_HWIN CreateGyroscobeDialog(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 ****************************/