我的代码示例如下:
/**********************************************
* *
* SEGGER Microcontroller GmbH & Co. KG *
* Solutions for real time microcontroller applications *
* *
***********************************************
* *
* C-file generated by: *
* *
* GUI_Builder for emWin version 5.28 *
* Compiled Jan 30 2015, 16:41:06 *
* (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 "3d_main.h"
#include "adjust.h"
#include "information.h"
#include "status.h"
#include "language.h"
#include "set_up.h"
#include "wifi.h"
#include "return.h"
#include "usart.h"
/**********************************************
*
* Defines
*
***********************************************
*/
#define ID_FRAMEWIN_2 (GUI_ID_USER + 0x15)
#define ID_ICONVIEW_0 (GUI_ID_USER + 0x16)
// 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_system[] = {
{ FRAMEWIN_CreateIndirect, "Framewin", ID_FRAMEWIN_2, 0, 0, 800, 480, 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_system(WM_MESSAGE * pMsg) {
WM_HWIN hItem;
int NCode;
int Id;
printf("This is a test_1
");
switch (pMsg->MsgId) {
case WM_INIT_DIALOG:
printf("This is a test_2
");
// Initialization of 'Framewin'
hItem = pMsg->hWin; //pMsg->hWin是对话框的句柄
FRAMEWIN_SetTitleVis(hItem, 0);
break;
case WM_NOTIFY_PARENT:
Id = WM_GetId(pMsg->hWinSrc); //pMsg->hWinSrc是ICONVIEW控件的句柄
printf("id: %d
",Id);
NCode = pMsg->Data.v;
printf("This is a test_3
");
switch(Id) {
case ID_ICONVIEW_0: // Notifications sent by 'Iconview'
printf("This is a test_4
");
switch(NCode) {
case WM_NOTIFICATION_CLICKED:
break;
case WM_NOTIFICATION_RELEASED: //这个小工具的释放,是指整个ICONVIEW的释放;
break;
case WM_NOTIFICATION_MOVED_OUT:
break;
case WM_NOTIFICATION_SCROLL_CHANGED:
break;
case WM_NOTIFICATION_SEL_CHANGED:
printf("This is a test_5
");
switch(ICONVIEW_GetSel(pMsg->hWinSrc))
{
/* 机器状态 */
case 0:
break;
/* 机器信息 */
case 1:
break;
/* 中英文切换 */
case 2:
break;
/* 设置 */
case 3:
break;
/* 屏幕校准 */
case 4:
break;
/* Wifi */
case 5:
break;
/* 返回上一层界面 */
case 6:
printf("This is a test_6
");
CreateFramewin_main();
break;
default:
printf("This is a test_7
");
break;
}
break;
}
break;
}
break;
default:
WM_DefaultProc(pMsg);
break;
}
}
/**********************************************
*
* Public code
*
***********************************************
*/
/**********************************************
*
* CreateFramewin
*/
WM_HWIN CreateFramewin_system(void) {
WM_HWIN hWin;
ICONVIEW_Handle IH;
hWin = GUI_CreateDialogBox(_aDialogCreate_system, GUI_COUNTOF(_aDialogCreate_system), _cbDialog_system, 0, 0, 0); //创建对话框
IH = ICONVIEW_CreateEx(0, 0,800, 480,hWin, WM_CF_SHOW,ICONVIEW_CF_AUTOSCROLLBAR_V, ID_ICONVIEW_0,160, 120); //创建ICONVIEW控件
ICONVIEW_SetSpace(IH,GUI_COORD_X,40); //以边界为基准;
ICONVIEW_SetSpace(IH,GUI_COORD_Y,40);
ICONVIEW_SetFrame(IH,GUI_COORD_X,40);
ICONVIEW_SetFrame(IH,GUI_COORD_Y,40);
ICONVIEW_AddBitmapItem(IH,&bm5,"Status");
ICONVIEW_AddBitmapItem(IH,&bm6,"Information");
ICONVIEW_AddBitmapItem(IH,&bm7,"Language");
ICONVIEW_AddBitmapItem(IH,&bm8,"Set_up");
ICONVIEW_AddBitmapItem(IH,&bm9,"Adjust");
ICONVIEW_AddBitmapItem(IH,&bm10,"Wifi");
ICONVIEW_AddBitmapItem(IH,&bm11,"Return");
return hWin;
}
// USER START (Optionally insert additional public code)
// USER END
/****************** End of file *******************/
注:不知为何,我用串口打印消息时,只能打印出test_1和test_2,当我点击ICONVIEW小工具上的其中任意一个图标时,始终打印不出test_3,
说明ICONVIEW始终没有发消息指对话框,这是为何呢?难道我的ICONVIEW控件的用法用错了?求大神指点指点...
一周热门 更多>