标签:
emWin(ucGui) Edit控件数值模式出现负数值编辑时,如果键盘按键全可以设置独立的"-","+"键,这样可以正常编辑正数和负数,但是要没有设置这两个键,编辑Edit的数值会比较麻烦,可以使用"上"键和"下"键修改符号,但是光标无法移动到后面的数值位,必须借助"左"键和"右"键来移动光标,在嵌入式里的按键比较有限制,如果不单独设立"+","+","左","右"键,这时只能通过代码来完成移位,方法是,修改符号位的同时手动移动光标:
?
/*********************************************************************
*
* cbEdit 编辑控件回调
*/
static void cbEdit0(WM_MESSAGE * pMsg) {
????switch (pMsg->MsgId) {
????case WM_KEY:
????????if(((WM_KEY_INFO *)(pMsg->Data.p))->PressedCnt != 0)
????????????break;
????????switch (((WM_KEY_INFO *)(pMsg->Data.p))->Key){
????????case GUI_KEY_ENTER:
????????????pretreatTemperature = EDIT_GetValue(widgetsItemBuf[0]);
????????????WM_SetFocus(widgetsItemBuf[1]);????
????????????break;
????????case GUI_KEY_UP:
????????case GUI_KEY_DOWN:
????????????if(((WM_KEY_INFO *)(pMsg->Data.p))->PressedCnt == 0)
????????????????if(EDIT_GetCursorCharPos(widgetsItemBuf[0]) == 0)
????????????????????EDIT_SetCursorAtChar(widgetsItemBuf[0],1);
????????????break;
????????}
????break;
????}
????EDIT_Callback(pMsg);
}
?
emWin(ucGui) Edit控件数值模式 ——符号编辑 worldsing
标签:
原文地址:http://www.cnblogs.com/worldsing/p/4178126.html