|

楼主 |
发表于 2019-5-22 10:29:24
|
显示全部楼层
这是界面1
- /*********************************************************************
- * *
- * 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"
- #include "string.h"
- #include "stdio.h"
- /*********************************************************************
- *
- * Defines
- *
- **********************************************************************
- */
- #define ID_FRAMEWIN_0 (GUI_ID_USER + 0x00)
- #define ID_EDIT_0 (GUI_ID_USER + 0x01)
- #define ID_EDIT_1 (GUI_ID_USER + 0x02)
- #define ID_TEXT_0 (GUI_ID_USER + 0x04)
- #define ID_TEXT_1 (GUI_ID_USER + 0x05)
- // 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, "Framewin", ID_FRAMEWIN_0, 1, 0, 800, 480, 0, 0x0, 0 },
- { EDIT_CreateIndirect, "Edit", ID_EDIT_0, 120, 30, 80, 20, 0, 0x64, 0 },
- { EDIT_CreateIndirect, "Edit", ID_EDIT_1, 120, 59, 80, 20, 0, 0x64, 0 },
- { TEXT_CreateIndirect, "NUM1", ID_TEXT_0, 77, 30, 34, 20, 0, 0x0, 0 },
- { TEXT_CreateIndirect, "NUM2", ID_TEXT_1, 75, 60, 32, 20, 0, 0x0, 0 },
- // USER START (Optionally insert additional widgets)
- // USER END
- };
- extern WM_HWIN hPage[4];
- /*********************************************************************
- *
- * Static code
- *
- **********************************************************************
- */
- // USER START (Optionally insert additional static code)
- // USER END
- /*********************************************************************
- *
- * _cbDialog
- */
- static void _cbDialog(WM_MESSAGE * pMsg) {
- WM_HWIN hItem;
- int NCode;
- int Id;
- char ch[10];
- int x=666;
- // USER START (Optionally insert additional variables)
- // USER END
- switch (pMsg->MsgId) {
- case WM_INIT_DIALOG://初始化消息,创建窗口/控件时有效,比如在这里设置一些控件的初始参数
- //
- // Initialization of 'Edit'
- //
- hItem = WM_GetDialogItem(pMsg->hWin, ID_EDIT_0);
- sprintf(ch,"%d",(char*)x);
- EDIT_SetText(hItem, ch);
- //
- // Initialization of 'Edit'
- //
- hItem = WM_GetDialogItem(pMsg->hWin, ID_EDIT_1);
- EDIT_SetText(hItem, "0");
- // 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_EDIT_0: // Notifications sent by 'Edit'
- switch(NCode) {
- case WM_NOTIFICATION_CLICKED://EDIT_0被选中显示键盘
- // USER START (Optionally insert code for reacting on notification message)
- // WM_HideWindow(hPage[0]);
- WM_HideWindow(hPage[0]);
- WM_ShowWindow(hPage[1]);
-
-
- // USER END
- break;
- case WM_NOTIFICATION_RELEASED:
- // USER START (Optionally insert code for reacting on notification message)
- WM_HideWindow(hPage[0]);
- WM_ShowWindow(hPage[1]);
- WM_SetFocus(hPage[1]);
-
- // 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;
- case ID_EDIT_1: // 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)
- // WM_HideWindow(hPage[0]);
- WM_ShowWindow(hPage[1]);
- // 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
- *
- **********************************************************************
- */
- /*********************************************************************
- *
- * CreateFramewin
- */
- WM_HWIN CreateFramewin(void);
- WM_HWIN CreateFramewin(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 ****************************/
- //void ButtonUse_Demo(void)
- //{
- // WM_HWIN hWin;
- // hWin=CreateFramewin();
- // while(1)
- // {
- // GUI_Delay(100);
- // }
- //}
复制代码 这是界面2
- /*********************************************************************
- * *
- * 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_FRAMEWIN_0 (GUI_ID_USER + 0x00)
- #define ID_BUTTON_0 (GUI_ID_USER + 0x01)
- #define ID_BUTTON_1 (GUI_ID_USER + 0x03)
- #define ID_BUTTON_2 (GUI_ID_USER + 0x04)
- #define ID_BUTTON_3 (GUI_ID_USER + 0x05)
- #define ID_BUTTON_4 (GUI_ID_USER + 0x06)
- #define ID_BUTTON_5 (GUI_ID_USER + 0x07)
- #define ID_BUTTON_6 (GUI_ID_USER + 0x08)
- #define ID_BUTTON_7 (GUI_ID_USER + 0x09)
- #define ID_BUTTON_8 (GUI_ID_USER + 0x0A)
- #define ID_BUTTON_9 (GUI_ID_USER + 0x0B)
- #define ID_BUTTON_10 (GUI_ID_USER + 0x0C)
- #define ID_BUTTON_11 (GUI_ID_USER + 0x0D)
- #define ID_BUTTON_12 (GUI_ID_USER + 0x0E)
- #define ID_EDIT_0 (GUI_ID_USER + 0x10)
- // 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, "Framewin", ID_FRAMEWIN_0, 45, 15, 275, 166, 0, 0x0, 0 },
- { BUTTON_CreateIndirect, "ESC", ID_BUTTON_0, 5, 110, 60, 30, 0, 0x0, 0 },
- { BUTTON_CreateIndirect, "2", ID_BUTTON_1, 75, 4, 60, 30, 0, 0x0, 0 },
- { BUTTON_CreateIndirect, "1", ID_BUTTON_2, 5, 5, 60, 30, 0, 0x0, 0 },
- { BUTTON_CreateIndirect, "4", ID_BUTTON_3, 4, 40, 60, 30, 0, 0x0, 0 },
- { BUTTON_CreateIndirect, "Back", ID_BUTTON_4, 140, 109, 60, 30, 0, 0x0, 0 },
- { BUTTON_CreateIndirect, "7", ID_BUTTON_5, 5, 75, 60, 30, 0, 0x0, 0 },
- { BUTTON_CreateIndirect, "0", ID_BUTTON_6, 75, 109, 60, 30, 0, 0x0, 0 },
- { BUTTON_CreateIndirect, "5", ID_BUTTON_7, 75, 38, 60, 30, 0, 0x0, 0 },
- { BUTTON_CreateIndirect, "9", ID_BUTTON_8, 140, 72, 60, 30, 0, 0x0, 0 },
- { BUTTON_CreateIndirect, "3", ID_BUTTON_9, 140, 3, 60, 30, 0, 0x0, 0 },
- { BUTTON_CreateIndirect, "8", ID_BUTTON_10, 75, 74, 60, 30, 0, 0x0, 0 },
- { BUTTON_CreateIndirect, "Enter", ID_BUTTON_11, 204, 42, 55, 94, 0, 0x0, 0 },
- { BUTTON_CreateIndirect, "6", ID_BUTTON_12, 140, 38, 60, 30, 0, 0x0, 0 },
- { EDIT_CreateIndirect, "Edit", ID_EDIT_0, 210, 9, 52, 20, 0, 0x64, 0 },
- // USER START (Optionally insert additional widgets)
- // USER END
- };
- /*********************************************************************
- *
- * Static code
- *
- **********************************************************************
- */
- // USER START (Optionally insert additional static code)
- extern WM_HWIN hPage[4];
- char buff[20] = { "0" };
- int j = 0;
- // USER END
- /*********************************************************************
- *
- * _cbDialog
- */
- static void _cbDialog(WM_MESSAGE * pMsg) {
- WM_HWIN hItem;
- int NCode;
- int Id;
- int i;
- // USER START (Optionally insert additional variables)
- // USER END
- switch (pMsg->MsgId) {
- case WM_INIT_DIALOG:
- //
- // Initialization of 'Edit'
- for (i = ID_BUTTON_0; i <= ID_BUTTON_12; i++)//禁止聚焦
- BUTTON_SetFocussable(WM_GetDialogItem(pMsg->hWin, i), 0);
- //
- hItem = WM_GetDialogItem(pMsg->hWin, ID_EDIT_0);
- EDIT_SetText(hItem, "0");
- // 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 'ESC'
- switch(NCode) {
- case WM_NOTIFICATION_CLICKED:
- // USER START (Optionally insert code for reacting on notification message)
- WM_HideWindow(hPage[1]);
- // 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_BUTTON_1: // Notifications sent by '2'
- switch(NCode) {
- case WM_NOTIFICATION_CLICKED:
- // USER START (Optionally insert code for reacting on notification message)
- BUTTON_GetText(pMsg->hWinSrc, &buff[j], sizeof(buff));
- j++;
- // 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_BUTTON_2: // Notifications sent by '1'
- 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;
- // USER START (Optionally insert additional code for further notification handling)
- // USER END
- }
- break;
- case ID_BUTTON_3: // Notifications sent by '4'
- 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;
- // USER START (Optionally insert additional code for further notification handling)
- // USER END
- }
- break;
- case ID_BUTTON_4: // Notifications sent by 'Back'
- switch(NCode) {
- case WM_NOTIFICATION_CLICKED:
- // USER START (Optionally insert code for reacting on notification message)
- memset(buff, 0, 10); //清空数组
- GUI_SendKeyMsg(GUI_KEY_BACKSPACE, 1);
- // 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_BUTTON_5: // Notifications sent by '7'
- 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;
- // USER START (Optionally insert additional code for further notification handling)
- // USER END
- }
- break;
- case ID_BUTTON_6: // Notifications sent by '0'
- 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;
- // USER START (Optionally insert additional code for further notification handling)
- // USER END
- }
- break;
- case ID_BUTTON_7: // Notifications sent by '5'
- 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;
- // USER START (Optionally insert additional code for further notification handling)
- // USER END
- }
- break;
- case ID_BUTTON_8: // Notifications sent by '9'
- 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;
- // USER START (Optionally insert additional code for further notification handling)
- // USER END
- }
- break;
- case ID_BUTTON_9: // Notifications sent by '3'
- 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;
- // USER START (Optionally insert additional code for further notification handling)
- // USER END
- }
- break;
- case ID_BUTTON_10: // Notifications sent by '8'
- 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;
- // USER START (Optionally insert additional code for further notification handling)
- // USER END
- }
- break;
- case ID_BUTTON_11: // Notifications sent by 'Enter'
- switch(NCode) {
- case WM_NOTIFICATION_CLICKED:
- // USER START (Optionally insert code for reacting on notification message)
- for (j = 0; buff[j] != '\0'; j++)
- GUI_SendKeyMsg(buff[j], 1);//1则表示按键被按下
- // USER END
- break;
- case WM_NOTIFICATION_RELEASED:
- // USER START (Optionally insert code for reacting on notification message)
- WM_HideWindow(hPage[1]);
- // WM_ShowWindow(hPage[0]);
- // USER END
- break;
- // USER START (Optionally insert additional code for further notification handling)
- // USER END
- }
- break;
- case ID_BUTTON_12: // Notifications sent by '6'
- 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;
- // 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
- *
- **********************************************************************
- */
- /*********************************************************************
- *
- * CreateFramewin//创建一个对话框
- */
- WM_HWIN CreateFramewin_k(void);
- WM_HWIN CreateFramewin_k(void) {
- WM_HWIN hWin;
- hWin = GUI_CreateDialogBox(_aDialogCreate, GUI_COUNTOF(_aDialogCreate), _cbDialog, WM_HBKWIN, 0, 0);
- return hWin;
- }
复制代码 下面是启动部分- #include "dialog.h"
- WM_HWIN hPage[4];
- //CreateFramewin
- void MainTask(void)
- {
- GUI_Init(); //初始化emWin/ucGUI
- hPage[0] = CreateFramewin(WM_HBKWIN); //创建窗体,父窗体是桌面背景
- hPage[1] = CreateFramewin_k(WM_HBKWIN); //创建窗体,父窗体
- WM_HideWindow(hPage[1]); //隐藏Page
-
- while(1) {GUI_Delay(20);} //调用GUI_Delay函数延时20MS(最终目的是调用GUI_Exec()函数)
- }
复制代码 麻烦硬汉大哥帮忙看看是哪的问题
|
|