初级会员
- 积分
- 124
- 金钱
- 124
- 注册时间
- 2019-5-12
- 在线时间
- 61 小时
|
1金钱
查了半天,不知道问题出在哪里,希望大佬们指条明路
回调函数内接收到WM_KEY处理的内容如下:
case WM_KEY:
val+=1;//接收到消息将val+1,发送至串口,但是串口内的值不会改变。
switch(((WM_KEY_INFO*)(pMsg->Data.p))->Key)
{
case GUI_KEY_UP:
hItem = WM_GetDialogItem(pMsg->hWin, ID_EDIT_0);
//WM_SetFocus(hItem);
WM_InvalidateWindow(hItem);
//val+=1;
sprintf(s,"%d",val);
EDIT_SetText(hItem, s);
EDIT_SetFont(hItem, GUI_FONT_16B_ASCII);
EDIT_SetTextAlign(hItem, GUI_TA_HCENTER | GUI_TA_VCENTER);
break;
case GUI_KEY_DOWN:
hItem = WM_GetDialogItem(pMsg->hWin, ID_EDIT_0);
//WM_SetFocus(hItem);
WM_InvalidateWindow(hItem);
//val-=1;
sprintf(s,"%d",val);
EDIT_SetText(hItem, s);
EDIT_SetFont(hItem, GUI_FONT_16B_ASCII);
EDIT_SetTextAlign(hItem, GUI_TA_HCENTER | GUI_TA_VCENTER);
break;
case GUI_KEY_DELETE:
hItem = WM_GetDialogItem(pMsg->hWin, ID_EDIT_0);
//WM_SetFocus(hItem);
WM_InvalidateWindow(hItem);//先无效,仅重绘无效部分
//val=0;
sprintf(s,"%d",val);
EDIT_SetText(hItem, s);
EDIT_SetFont(hItem, GUI_FONT_16B_ASCII);
EDIT_SetTextAlign(hItem, GUI_TA_HCENTER | GUI_TA_VCENTER);
break;
}
break;
自己定义的按键消息:
void Taskey()
{
keyval keydown;
keydown=scankey();
switch(keydown)
{
case key0_down:
WM_SetFocus(WM_GetDialogItem(WM_GetClientWindow(jubing), gongju) );
GUI_SendKeyMsg()(GUI_KEY_UP, 1); //灏咾EY0鏄犲皠涓篏UI_KEY_UP;
break;
case key1_down:
WM_SetFocus(WM_GetDialogItem(WM_GetClientWindow(jubing), gongju) );
GUI_SendKeyMsg()(GUI_KEY_DOWN, 1); //灏咾EY1鏄犲皠涓篏UI_KEY_DOWN;
break;
case key2_dowm:
WM_SetFocus(WM_GetDialogItem(WM_GetClientWindow(jubing), gongju) );
GUI_SendKeyMsg()(GUI_KEY_DELETE, 1); //灏咾EY0鏄犲皠涓篏UI_KEY_UP;
break;
default: keydown=99; break;
}
}
求大佬们指点一二
|
|