|
在模拟器上试的结果复选框控件设置为禁用后不能在聚焦,但是在我的板子上复选框控件设置为禁用后还可以聚焦,板子上使用的是emwin5.22版本。什么模拟器上的结果和实际的显示结果不一样呢?,我把程序附在后面了,是不是我使用的有问题呀?
/*********************************************************************
* *
* 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: 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_CHECKBOX_0 (GUI_ID_USER + 0x01)
#define ID_CHECKBOX_1 (GUI_ID_USER + 0x02)
#define ID_CHECKBOX_2 (GUI_ID_USER + 0x03)
#define ID_CHECKBOX_3 (GUI_ID_USER + 0x04)
#define ID_CHECKBOX_4 (GUI_ID_USER + 0x05)
#define ID_CHECKBOX_5 (GUI_ID_USER + 0x06)
#define ID_BUTTON_0 (GUI_ID_USER + 0x07)
// USER START (Optionally insert additional defines)
// USER END
/*********************************************************************
*
* Static data
*
**********************************************************************
*/
WM_HWIN CreateFramewin_Test(void);
// USER START (Optionally insert additional static data)
// USER END
/*********************************************************************
*
* _aDialogCreate
*/
static const GUI_WIDGET_CREATE_INFO _aDialogCreate[] = {
{ FRAMEWIN_CreateIndirect, "Framewin", ID_FRAMEWIN_0, 62, 60, 360, 160, 0, 0x64, 0 },
{ CHECKBOX_CreateIndirect, "Checkbox", ID_CHECKBOX_0, 60, 30, 80, 20, 0, 0x0, 0 },
{ CHECKBOX_CreateIndirect, "Checkbox", ID_CHECKBOX_1, 150, 30, 80, 20, 0, 0x0, 0 },
{ CHECKBOX_CreateIndirect, "Checkbox", ID_CHECKBOX_2, 240, 30, 80, 20, 0, 0x0, 0 },
{ CHECKBOX_CreateIndirect, "Checkbox", ID_CHECKBOX_3, 60, 80, 80, 20, 0, 0x0, 0 },
{ CHECKBOX_CreateIndirect, "Checkbox", ID_CHECKBOX_4, 150, 80, 80, 20, 0, 0x0, 0 },
{ CHECKBOX_CreateIndirect, "Checkbox", ID_CHECKBOX_5, 240, 80, 80, 20, 0, 0x0, 0 },
{ BUTTON_CreateIndirect, "Button", ID_BUTTON_0, 126, 113, 80, 20, 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;
int NCode;
int Id;
// USER START (Optionally insert additional variables)
// USER END
switch (pMsg->MsgId) {
case WM_KEY:
{
WM_KEY_INFO* pData = (WM_KEY_INFO*)(pMsg->Data.p); //获得消息结构体中的按键消息
switch (pData->Key)
{
case GUI_KEY_ESCAPE: //按下ESCAPE键进入主菜单界面
WM_DeleteWindow(pMsg->hWin); //删除窗口
break;
case GUI_KEY_DOWN://对下一个控件聚焦
WM_SetFocusOnNextChild(WM_GetClientWindow(pMsg->hWin)); //由于使用了框架窗口控件,必须先要获得客户端窗口句柄,才能进行焦点切换
break; //因为控件的父窗口是客户端窗口,而框架窗口是客户端窗口的父窗口
case GUI_KEY_UP://对上一个控件聚焦
WM_SetFocusOnPrevChild(WM_GetClientWindow(pMsg->hWin));
break;
}
}
break;
case WM_INIT_DIALOG:
//
// Initialization of 'Framewin'
//
hItem = pMsg->hWin;
FRAMEWIN_SetFont(hItem, GUI_FONT_16B_1);
FRAMEWIN_SetText(hItem, "Framewin");
FRAMEWIN_SetTextAlign(hItem, GUI_TA_HCENTER | GUI_TA_VCENTER);
//
// Initialization of 'Checkbox'
//
hItem = WM_GetDialogItem(pMsg->hWin, ID_CHECKBOX_0);
CHECKBOX_SetText(hItem, "Check");
//
// Initialization of 'Checkbox'
//
hItem = WM_GetDialogItem(pMsg->hWin, ID_CHECKBOX_1);
CHECKBOX_SetText(hItem, "Check");
//
// Initialization of 'Checkbox'
//
hItem = WM_GetDialogItem(pMsg->hWin, ID_CHECKBOX_2);
CHECKBOX_SetText(hItem, "Check");
//
// Initialization of 'Checkbox'
//
hItem = WM_GetDialogItem(pMsg->hWin, ID_CHECKBOX_3);
CHECKBOX_SetText(hItem, "Check");
//
// Initialization of 'Checkbox'
//
hItem = WM_GetDialogItem(pMsg->hWin, ID_CHECKBOX_4);
CHECKBOX_SetText(hItem, "Check");
//
// Initialization of 'Checkbox'
//
hItem = WM_GetDialogItem(pMsg->hWin, ID_CHECKBOX_5);
CHECKBOX_SetText(hItem, "Check");
WM_DisableWindow(WM_GetDialogItem(pMsg->hWin, ID_CHECKBOX_3));//指定窗口设置为禁用状态
WM_DisableWindow(WM_GetDialogItem(pMsg->hWin, ID_CHECKBOX_4));//指定窗口设置为禁用状态
WM_DisableWindow(WM_GetDialogItem(pMsg->hWin, ID_CHECKBOX_5));//指定窗口设置为禁用状态
// 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_CHECKBOX_0: // Notifications sent by 'Checkbox'
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;
case ID_CHECKBOX_1: // Notifications sent by 'Checkbox'
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;
case ID_CHECKBOX_2: // Notifications sent by 'Checkbox'
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;
case ID_CHECKBOX_3: // Notifications sent by 'Checkbox'
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;
case ID_CHECKBOX_4: // Notifications sent by 'Checkbox'
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;
case ID_CHECKBOX_5: // Notifications sent by 'Checkbox'
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;
case ID_BUTTON_0: // Notifications sent by 'Button'
switch(NCode) {
case WM_NOTIFICATION_CLICKED:
// WM_DeleteWindow(pMsg->hWin); //删除窗口
GUI_EndDialog(pMsg->hWin, 0);
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;
// USER START (Optionally insert additional message handling)
// USER END
default:
WM_DefaultProc(pMsg);
break;
}
}
/*********************************************************************
*
* Public code
*
**********************************************************************
*/
/*********************************************************************
*
* CreateFramewin
*/
WM_HWIN CreateFramewin_Test(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 ****************************/
|
|