高中生
最后登录1970-1-1
在线时间 小时
注册时间2016-1-28
|
本帖最后由 waszhang 于 2017-2-14 10:41 编辑
我在使用F429+EMWIN5.28时,遇到问题,如下:
我开机进入应用图标界面(第一层),
点击图标进入应用(第二层),图标区有个设置按键SETting,点击进入第三层
第三层界面是设置,隐藏FRAMEWIN,添加一个返回按键和header,
在第二层和第三层来回切换时,进入退出8次,点击返回就从第三层设置界面退不回去了,但点击返回按键变色说明控件有反应,但不执行退出操作。界面上其他控件点击也有反应。
经过监控RAM,在第一次进入第二层时RAM使用大概UsedBytes =5060,进入第三层时RAM使用大概UsedBytes =7552;
退出到第二层时UsedBytes =5396;在次进入第三层UsedBytes =7532,后面每次都稳定在第二层时UsedBytes =5396;第三层UsedBytes =7532这个RAM消耗。
也监控了第三个界面退出时的情况:退出时页面客户区的所有控件都已删除。
但是第八次进入就退不出来了,这是什么问题导致的?求帮助!
另外,前七次Id = WM_GetId(pMsg->hWinSrc)为了0x877,在第八次退出时,监控发现Id = WM_GetId(pMsg->hWinSrc)返回值ID变为了0,原来是#define ID_BUTTON_2 (GUI_ID_USER + 0x77),不知道怎么回事、
部分程序如下:
页面三资源表:
static const GUI_WIDGET_CREATE_INFO _aDialogCreate[] = {
{ FRAMEWIN_CreateIndirect, "", ID_FRAMEWIN_0, 0, 0, 800, 480, 0, 0x0, 0 },
{ BUTTON_CreateIndirect, "RETURN", ID_BUTTON_2, 0, 0, 90, 60, 0, 0x0, 0 },
{ HEADER_CreateIndirect, "Light Setting", ID_HEADER_0, 90, 0, 710,60, 0, 0x0, 0},
{ SLIDER_CreateIndirect, "Light ", ID_SLIDER_0, 200, 160, 350, 60, 0, 0x0, 0 },
{ BUTTON_CreateIndirect, " ", ID_BUTTON_0, 130, 170, 50, 50, 0, 0x0, 0 },
{ BUTTON_CreateIndirect, " ", ID_BUTTON_1, 560, 170, 50, 50, 0, 0x0, 0 },
{ SLIDER_CreateIndirect, "Light Times ", ID_SLIDER_1, 200, 330, 350, 60, 0, 0x0, 0 },
{ BUTTON_CreateIndirect, " ", ID_BUTTON_3, 130, 330, 50, 50, 0, 0x0, 0 },
{ BUTTON_CreateIndirect, " ", ID_BUTTON_4, 560, 330, 50, 50, 0, 0x0, 0 },
{ TEXT_CreateIndirect, "Light", ID_TEXT_0, 130, 80, 180, 60, 0, 0x0, 0 },
{ TEXT_CreateIndirect, "Light Times ", ID_TEXT_1, 130, 265, 180, 60, 0, 0x0, 0 },
// USER START (Optionally insert additional widgets)
// USER END
};
页面三的回调函数:
static void _cbDialog(WM_MESSAGE * pMsg) {
WM_HWIN hItem;
int NCode;
int Id;
int Value;
// USER START (Optionally insert additional variables)
// USER END
switch (pMsg->MsgId) {
case WM_INIT_DIALOG:
//
// Initialization of 'Light Setting'
//
hItem = pMsg->hWin;
FRAMEWIN_SetTitleHeight(hItem, 60);
FRAMEWIN_SetTextAlign(hItem, GUI_TA_HCENTER | GUI_TA_VCENTER);
FRAMEWIN_SetFont(hItem, GUI_FONT_32B_1);
FRAMEWIN_SetTextColor(hItem, 0x00000000);
FRAMEWIN_SetClientColor(hItem,0x00E3cdaa);
FRAMEWIN_SetTitleVis(hItem, 0);
hItem = WM_GetDialogItem(pMsg->hWin, ID_HEADER_0);
HEADER_SetTextColor(hItem,GUI_WHITE);
HEADER_SetBkColor(hItem,0x00a57001);
HEADER_SetFont(hItem,GUI_FONT_32B_ASCII);//GUI_FONT_24B_ASCII
HEADER_AddItem(hItem, 710, "Light Setting", GUI_TA_HCENTER|GUI_TA_VCENTER);
HEADER_SetHeight(hItem,60);
hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_2);
BUTTON_SetBitmapEx(hItem,0,&bmreturn,1,1);
BUTTON_SetBitmapEx(hItem,1,&bmreturn,1,1);
BUTTON_SetBitmapEx(hItem,2,&bmreturn,1,1);
BUTTON_SetFocussable(hItem,1);
hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_0);
BUTTON_SetFont(hItem, GUI_FONT_24B_ASCII);
BUTTON_SetBitmapEx(hItem,0,&bmlight1,1,1);
BUTTON_SetBitmapEx(hItem,1,&bmlight1,1,1);
BUTTON_SetBitmapEx(hItem,2,&bmlight1,1,1);
hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_1);
BUTTON_SetFont(hItem, GUI_FONT_24B_ASCII);
BUTTON_SetBitmapEx(hItem,0,&bmlight2,1,1);
BUTTON_SetBitmapEx(hItem,1,&bmlight2,1,1);
BUTTON_SetBitmapEx(hItem,2,&bmlight2,1,1);
hItem = WM_GetDialogItem(pMsg->hWin, ID_SLIDER_0);
SLIDER_SetFocusColor(hItem, 0x00000000);
SLIDER_SetRange(hItem, 1, 10);
SLIDER_SetNumTicks(hItem, 10);
SLIDER_SetWidth(hItem, 25);
hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_3);
BUTTON_SetFont(hItem, GUI_FONT_24B_ASCII);
BUTTON_SetBitmapEx(hItem,0,&bmlight1,1,1);
BUTTON_SetBitmapEx(hItem,1,&bmlight1,1,1);
BUTTON_SetBitmapEx(hItem,2,&bmlight1,1,1);
hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_4);
BUTTON_SetFont(hItem, GUI_FONT_24B_ASCII);
BUTTON_SetBitmapEx(hItem,0,&bmlight2,1,1);
BUTTON_SetBitmapEx(hItem,1,&bmlight2,1,1);
BUTTON_SetBitmapEx(hItem,2,&bmlight2,1,1);
hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_0);
TEXT_SetTextAlign(hItem, GUI_TA_LEFT | GUI_TA_VCENTER); ///GUI_TA_HCENTER
TEXT_SetFont(hItem, GUI_FONT_32B_1);
TEXT_SetTextColor(hItem, 0x00a57001);
hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_1);
TEXT_SetTextAlign(hItem, GUI_TA_LEFT | GUI_TA_VCENTER); ///GUI_TA_HCENTER
TEXT_SetFont(hItem, GUI_FONT_32B_1);
TEXT_SetTextColor(hItem, 0x00a57001);
hItem = WM_GetDialogItem(pMsg->hWin, ID_SLIDER_1);
SLIDER_SetFocusColor(hItem, 0x00000000);
SLIDER_SetRange(hItem, 1, 10);
SLIDER_SetNumTicks(hItem, 10);
SLIDER_SetWidth(hItem, 25);
// USER START (Optionally insert additional code for further widget initialization)
// USER END
break;
case WM_DELETE:
hLWin = NULL;
break;
case WM_NOTIFY_PARENT:
Id = WM_GetId(pMsg->hWinSrc);
NCode = pMsg->Data.v;
switch(Id) {
case ID_HEADER_0: // Notifications sent by 'header'
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;
// USER START (Optionally insert additional code for further notification handling)
// USER END
}
break;
case ID_BUTTON_2: // 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)
GUI_EndDialog(pMsg->hWin,0);
WM_SetFocus(WM_GetParent(hLWin));
// USER END
break;
// USER START (Optionally insert additional code for further notification handling)
// USER END
}
break;
case ID_SLIDER_0: // Notifications sent by 'Light '
...............................
省略无关代码
...............................
case WM_PAINT:
GUI_SetColor(0x00c89d57);
GUI_DrawRoundedFrame(100,85,700,250,20,3);
GUI_DrawRoundedFrame(100,270,700,445,20,3);
break;
default:
WM_DefaultProc(pMsg);
break;
}
}
页面三创建:
WM_HWIN SettingLight(void) {
hLWin = GUI_CreateDialogBox(_aDialogCreate, GUI_COUNTOF(_aDialogCreate), _cbDialog, WDWin, 0, 0);
while(1)
{
GUI_Delay(10);
}
}
页面2调用页面3:
case WM_NOTIFY_PARENT:
Id = WM_GetId(pMsg->hWinSrc);
NCode = pMsg->Data.v;
switch(Id)
{
case ID_BUTTON_3: // Notifications sent by 'Config'
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)
Stat_Flag = 0;
// CreateSETTING(WDWin);
SettingLight();
// USER END
break;
case WM_NOTIFICATION_CHILD_DELETED:
break;
// USER START (Optionally insert additional code for further notification handling)
// USER END
}
break;
}
break;
}
break;
case WM_PAINT:
EDIT_SetFocussable(WM_GetDialogItem(hWin, ID_EDIT_0), 0);
if(GetMotionFlag())
{
EDIT_SetTextColor(WM_GetDialogItem(hWin, ID_EDIT_2),EDIT_CI_ENABLED, 0x00FFFF80);
}
else
{
EDIT_SetTextColor(WM_GetDialogItem(hWin, ID_EDIT_2),EDIT_CI_ENABLED,0x654503);
}
EDIT_SetText(WM_GetDialogItem(hWin, ID_EDIT_2),text_buffer);
WM_ValidateWindow(WM_GetDialogItem(hWin, ID_EDIT_2));
WM_ValidateWindow(WM_GetDialogItem(hWin, ID_EDIT_1));
memset(text_buffer,0,sizeof(text_buffer));
sprintf(text_buffer,"%d", GetWgtAdCnt());
EDIT_SetText(WM_GetDialogItem(hWin, ID_EDIT_1),text_buffer);
WM_ValidateWindow(WM_GetDialogItem(hWin, ID_EDIT_1));
break;
default:
WM_DefaultProc(pMsg);
break;
}
}
|
|