|
客户反映这两个函数使用没有效果,实际是有效果的,注意不要设置错位置了:
效果显现如下:
======================================================
可以在模拟器上面运行的完成测试代码,直接复制到模拟器上面就可以跑:
- #include "DIALOG.h"
- /*
- ************************************************************************************************
- * 添加到多页控件第一个页面窗口的对话框
- ************************************************************************************************
- */
- /*********************************************************************
- *
- * Defines
- *
- **********************************************************************
- */
- #define ID_WINDOW_01 (GUI_ID_USER + 0x10)
- #define ID_BUTTON_01 (GUI_ID_USER + 0x11)
- // USER START (Optionally insert additional static data)
- // USER END
- /*********************************************************************
- *
- * _aDialogCreate
- */
- static const GUI_WIDGET_CREATE_INFO _aDialogCreatePage1[] = {
- { WINDOW_CreateIndirect, "Window", ID_WINDOW_01, 0, 0, 400, 200, 0, 0x0, 0 },
- { BUTTON_CreateIndirect, "Button", ID_BUTTON_01, 127, 68, 129, 43, 0, 0x0, 0 },
- };
- /*********************************************************************
- *
- * Static code
- *
- **********************************************************************
- */
- // USER START (Optionally insert additional static code)
- // USER END
- /*********************************************************************
- *
- * _cbDialog
- */
- static void _cbDialogPage1(WM_MESSAGE * pMsg) {
- WM_HWIN hItem;
- int NCode;
- int Id;
- // USER START (Optionally insert additional variables)
- // USER END
- switch (pMsg->MsgId) {
- case WM_INIT_DIALOG:
- //
- // Initialization of 'Button'
- //
- hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_01);
- BUTTON_SetFont(hItem, GUI_FONT_16B_ASCII);
- BUTTON_SetText(hItem, "Page1");
- // 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_01: // Notifications sent by 'Button'
- 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;
- // USER START (Optionally insert additional code for further Ids)
- // USER END
- }
- break;
- default:
- WM_DefaultProc(pMsg);
- break;
- }
- }
- /*********************************************************************
- *
- * CreateWindowPage1
- */
- WM_HWIN CreateWindowPage1(void) {
- WM_HWIN hWin;
- hWin = GUI_CreateDialogBox(_aDialogCreatePage1, GUI_COUNTOF(_aDialogCreatePage1), _cbDialogPage1, WM_HBKWIN, 0, 0);
- return hWin;
- }
- /*
- ************************************************************************************************
- * 添加到多页控件第二个页面窗口的对话框
- ************************************************************************************************
- */
- /*********************************************************************
- *
- * Defines
- *
- **********************************************************************
- */
- #define ID_WINDOW_02 (GUI_ID_USER + 0x20)
- #define ID_BUTTON_02 (GUI_ID_USER + 0x21)
- // USER START (Optionally insert additional static data)
- // USER END
- /*********************************************************************
- *
- * _aDialogCreate
- */
- static const GUI_WIDGET_CREATE_INFO _aDialogCreatePage2[] = {
- { WINDOW_CreateIndirect, "Window", ID_WINDOW_02, 0, 0, 400, 200, 0, 0x0, 0 },
- { BUTTON_CreateIndirect, "Button", ID_BUTTON_02, 127, 68, 129, 43, 0, 0x0, 0 },
- };
- /*********************************************************************
- *
- * Static code
- *
- **********************************************************************
- */
- // USER START (Optionally insert additional static code)
- // USER END
- /*********************************************************************
- *
- * _cbDialog
- */
- static void _cbDialogPage2(WM_MESSAGE * pMsg) {
- WM_HWIN hItem;
- int NCode;
- int Id;
- // USER START (Optionally insert additional variables)
- // USER END
- switch (pMsg->MsgId) {
- case WM_INIT_DIALOG:
- //
- // Initialization of 'Button'
- //
- hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_02);
- BUTTON_SetFont(hItem, GUI_FONT_16B_ASCII);
- BUTTON_SetText(hItem, "Page2");
- // 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_02: // Notifications sent by 'Button'
- 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;
- // USER START (Optionally insert additional code for further Ids)
- // USER END
- }
- break;
- default:
- WM_DefaultProc(pMsg);
- break;
- }
- }
- /*********************************************************************
- *
- * CreateWindowPage2
- */
- WM_HWIN CreateWindowPage2(void) {
- WM_HWIN hWin;
- hWin = GUI_CreateDialogBox(_aDialogCreatePage2, GUI_COUNTOF(_aDialogCreatePage2), _cbDialogPage2, WM_HBKWIN, 0, 0);
- return hWin;
- }
- /*
- ************************************************************************************************
- * 添加到多页控件第三个页面窗口的对话框
- ************************************************************************************************
- */
- /*********************************************************************
- *
- * Defines
- *
- **********************************************************************
- */
- #define ID_WINDOW_03 (GUI_ID_USER + 0x30)
- #define ID_BUTTON_03 (GUI_ID_USER + 0x31)
- // USER START (Optionally insert additional static data)
- // USER END
- /*********************************************************************
- *
- * _aDialogCreate
- */
- static const GUI_WIDGET_CREATE_INFO _aDialogCreatePage3[] = {
- { WINDOW_CreateIndirect, "Window", ID_WINDOW_03, 0, 0, 400, 200, 0, 0x0, 0 },
- { BUTTON_CreateIndirect, "Button", ID_BUTTON_03, 127, 68, 129, 43, 0, 0x0, 0 },
- };
- /*********************************************************************
- *
- * Static code
- *
- **********************************************************************
- */
- // USER START (Optionally insert additional static code)
- // USER END
- /*********************************************************************
- *
- * _cbDialog
- */
- static void _cbDialogPage3(WM_MESSAGE * pMsg) {
- WM_HWIN hItem;
- int NCode;
- int Id;
- // USER START (Optionally insert additional variables)
- // USER END
- switch (pMsg->MsgId) {
- case WM_INIT_DIALOG:
- //
- // Initialization of 'Button'
- //
- hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_03);
- BUTTON_SetFont(hItem, GUI_FONT_16B_ASCII);
- BUTTON_SetText(hItem, "Page3");
- // 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_03: // Notifications sent by 'Button'
- 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;
- // USER START (Optionally insert additional code for further Ids)
- // USER END
- }
- break;
- default:
- WM_DefaultProc(pMsg);
- break;
- }
- }
- /*********************************************************************
- *
- * CreateWindowPage3
- */
- WM_HWIN CreateWindowPage3(void) {
- WM_HWIN hWin;
- hWin = GUI_CreateDialogBox(_aDialogCreatePage3, GUI_COUNTOF(_aDialogCreatePage3), _cbDialogPage3, WM_HBKWIN, 0, 0);
- return hWin;
- }
- /*********************************************************************
- *
- * Defines
- *
- **********************************************************************
- */
- #define ID_FRAMEWIN_0 (GUI_ID_USER + 0x00)
- #define ID_MULTIPAGE_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[] = {
- { FRAMEWIN_CreateIndirect, "Framewin", ID_FRAMEWIN_0, 0, 0, 800, 480, 0, 0x0, 0 },
- { MULTIPAGE_CreateIndirect, "Multipage", ID_MULTIPAGE_0, 23, 25, 400, 240, 0, 0x0, 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;
- WM_HWIN hWinPage;
- int NCode;
- int Id;
- // USER START (Optionally insert additional variables)
- // USER END
- switch (pMsg->MsgId) {
- case WM_INIT_DIALOG:
- //
- // Initialization of 'Framewin'
- //
- hItem = pMsg->hWin;
- FRAMEWIN_SetFont(hItem, GUI_FONT_32B_ASCII);
- FRAMEWIN_SetText(hItem, "armfly");
- FRAMEWIN_SetTextAlign(hItem, GUI_TA_HCENTER | GUI_TA_VCENTER);
- //
- // Initialization of 'Multipage'
- //
- hItem = WM_GetDialogItem(pMsg->hWin, ID_MULTIPAGE_0);
- MULTIPAGE_SetFont(hItem, GUI_FONT_16_ASCII);
- MULTIPAGE_SetTabHeight(hItem, 40);
- hWinPage = CreateWindowPage1();
- MULTIPAGE_AddEmptyPage(hItem, hWinPage, "STM32-V4");
- MULTIPAGE_SetTabWidth(hItem, 100, 0);
- hWinPage = CreateWindowPage2();
- MULTIPAGE_AddEmptyPage(hItem, hWinPage, "STM32-V5");
- MULTIPAGE_SetTabWidth(hItem, 120, 1);
- hWinPage = CreateWindowPage3();
- MULTIPAGE_AddEmptyPage(hItem, hWinPage, "STM32-V6");
- MULTIPAGE_SetTabWidth(hItem, 150, 2);
- // 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_MULTIPAGE_0: // Notifications sent by 'Multipage'
- 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_MOVED_OUT:
- // 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(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 ****************************/
- /*********************************************************************
- *
- * MainTask
- */
- void MainTask(void)
- {
- /* 初始化 */
- GUI_Init();
- /* 窗口自动使用存储设备 */
- WM_SetCreateFlags(WM_CF_MEMDEV);
- /* 创建对话框,使用GUIBulder5.32生成的对话框创建函数 */
- CreateFramewin();
- while(1)
- {
- GUI_Delay(50);
- }
- }
复制代码 |
|