Hello
How Can I overwrite GUIBuilder window creation callback. I want to draw a window with gradient background color.
I tried the following modification on GUIBuilder output, but i did not work.
(Compiler warning is included at the bottom of code)
Display All
Thanks in advance
How Can I overwrite GUIBuilder window creation callback. I want to draw a window with gradient background color.
I tried the following modification on GUIBuilder output, but i did not work.
(Compiler warning is included at the bottom of code)
C Source Code: Gradient window
- /*********************************************************************
- * *
- * SEGGER Microcontroller GmbH & Co. KG *
- * Solutions for real time microcontroller applications *
- * *
- **********************************************************************
- * *
- * C-file generated by: *
- * *
- * GUI_Builder for emWin version 5.32 *
- * Compiled Oct 8 2015, 11:59:02 *
- * (c) 2015 Segger Microcontroller GmbH & Co. KG *
- * *
- **********************************************************************
- * *
- * Internet: www.segger.com Support: support@segger.com *
- * *
- **********************************************************************
- */
- // USER START (Optionally insert additional includes)
- // USER END
- #include "DIALOG.h"
- /*********************************************************************
- *
- * Defines
- *
- **********************************************************************
- */
- #define ID_WINDOW_0 (GUI_ID_USER + 0x00)
- // USER START (Optionally insert additional defines)
- // USER END
- /*********************************************************************
- *
- * Static data
- *
- **********************************************************************
- */
- // USER START (Optionally insert additional static data)
- static void _cbWin0(WM_MESSAGE * pMsg) {
- GUI_RECT Rect;
- switch (pMsg->MsgId) {
- case WM_PAINT:
- WM_GetClientRect(&Rect);
- GUI_DrawGradientH(Rect.x0, Rect.y0, Rect.x1, Rect.y1, GUI_RED, GUI_BLUE);
- break;
- default:
- WM_DefaultProc(pMsg);
- break;
- }
- }
- // USER END
- /*********************************************************************
- *
- * _aDialogCreate
- */
- static const GUI_WIDGET_CREATE_INFO _aDialogCreate[] = {
- { WINDOW_CreateIndirect, "Gradient", ID_WINDOW_0, 0, 0, 320, 240, 0, 0x0, _cbWin0 },
- // 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) {
- // USER START (Optionally insert additional variables)
- // USER END
- switch (pMsg->MsgId) {
- // USER START (Optionally insert additional message handling)
- // USER END
- default:
- WM_DefaultProc(pMsg);
- break;
- }
- }
- /*********************************************************************
- *
- * Public code
- *
- **********************************************************************
- */
- /*********************************************************************
- *
- * CreateGradient
- */
- WM_HWIN CreateGradient(void);
- WM_HWIN CreateGradient(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 ****************************/
- //*************************************************
- Compiler output:
- ->Warinigs (1 Item)
- initialization makes integer from pointer without a cast [-Wint-conversion]
- ->Infos (1 Item)
- (near initialization for '_aDialogCreate[0].NumExtraBytes')
- **************************************************/