中级会员
积分 419
金钱 419
注册时间 2012-10-17
在线时间 20 小时
1 金钱
原子哥,您好
我在做一个界面,有24个MULTIEDIT,点击每个MULTIEDIT时都会弹出键盘,输入完字符后,点击键盘上的OK键,就把键盘隐藏。
现在遇到的问题是,当多次点击MULTIEDIT输入字符后,就会死机。
我这个是按照F7的 《EMWIN实验40 软键盘实验》改写的,但是是运行在战舰V3板子上
全部的代码在在下面,就是主函数中调用void windows(void),在这个函数里面创建MULTIEDIT ,当点击某个MULTIDEIT时就调用void keypad_Create(void) ,创建键盘,输入完成后,就隐藏键盘
请问这是什么原因?
OS_ERR err;
WM_HWIN hMulti=0; //多行文本
KEYPADStructTypeDef keypad_dev;
WM_HWIN hWin_Main;//主画面的FRAME的窗口句柄
WM_HWIN hwin_keypad; //键盘的窗口句柄
u32 MULTIEDIT_ID_Storage ; //存储被选中的EDIT的ID号
static int _DrawSkinFlex_BUTTON(const WIDGET_ITEM_DRAW_INFO * pDrawItemInfo);
static int _DrawChineseSkin_BUTTON(const WIDGET_ITEM_DRAW_INFO * pDrawItemInfo);
static u8 button_flag0,button_flag1,button_flag2,button_flag3,button_flag4,button_flag5,button_flag6,button_flag7,button_flag8,button_flag9,button_flag10,button_flag11,button_flag12;
//static u8 check0_click_flag,check0_delay_flag;
typedef struct
{
int xPos; //按钮X位置
int yPos; //按钮Y位置
int xSize; //按钮宽度
int ySize; //按钮高度
const char * acLabel; //按钮所代表的字符
void (* pfDraw)(WM_HWIN hWin); //按钮的绘制函数
const char * ButString; //按钮上显示的字符
} BUTTON_DATA;
//在按钮上绘制位图,比如回车键,删除键等
static void _DrawCentered(WM_HWIN hWin, const GUI_BITMAP * pBM)
{
int xSizeWin;
int ySizeWin;
int xSizeBMP;
int ySizeBMP;
int xPos;
int yPos;
xSizeWin = WM_GetWindowSizeX(hWin);
ySizeWin = WM_GetWindowSizeY(hWin);
xSizeBMP = pBM->XSize;
ySizeBMP = pBM->YSize;
xPos = (xSizeWin - xSizeBMP) >> 1;
yPos = (ySizeWin - ySizeBMP) >> 1;
GUI_DrawBitmap(pBM, xPos, yPos);
}
static void _DrawBkSpc (WM_HWIN hWin) { _DrawCentered(hWin, &bmBackSpace); } //绘制退格键(删除键)
static void _DrawEnter (WM_HWIN hWin) { _DrawCentered(hWin, &bmEnter); } //绘制回车键
static void _DrawShift (WM_HWIN hWin) { _DrawCentered(hWin, &bmShift); } //绘制shift键
static void _DrawRetern(WM_HWIN hWin) { _DrawCentered(hWin, &bmReturn); } //绘制返回键
//英文键盘位置
static BUTTON_DATA _aEngButtonData[] = {
{ (ENG_BUTTON_XPAC*1+ENG_BUTTON_WIDTH*0+ENG_BUTTONLINE1_XOFFSET), ENG_BUTTON_LINE1YPOS, ENG_BUTTON_WIDTH,ENG_BUTTON_HEIGHT, "Q",0,"Q" },
{ (ENG_BUTTON_XPAC*2+ENG_BUTTON_WIDTH*1+ENG_BUTTONLINE1_XOFFSET), ENG_BUTTON_LINE1YPOS, ENG_BUTTON_WIDTH,ENG_BUTTON_HEIGHT, "W",0,"W" },
{ (ENG_BUTTON_XPAC*3+ENG_BUTTON_WIDTH*2+ENG_BUTTONLINE1_XOFFSET), ENG_BUTTON_LINE1YPOS, ENG_BUTTON_WIDTH,ENG_BUTTON_HEIGHT, "E",0,"E" },
{ (ENG_BUTTON_XPAC*4+ENG_BUTTON_WIDTH*3+ENG_BUTTONLINE1_XOFFSET), ENG_BUTTON_LINE1YPOS, ENG_BUTTON_WIDTH,ENG_BUTTON_HEIGHT, "R",0,"R" },
{ (ENG_BUTTON_XPAC*5+ENG_BUTTON_WIDTH*4+ENG_BUTTONLINE1_XOFFSET), ENG_BUTTON_LINE1YPOS, ENG_BUTTON_WIDTH,ENG_BUTTON_HEIGHT, "T",0,"T" },
{ (ENG_BUTTON_XPAC*6+ENG_BUTTON_WIDTH*5+ENG_BUTTONLINE1_XOFFSET), ENG_BUTTON_LINE1YPOS, ENG_BUTTON_WIDTH,ENG_BUTTON_HEIGHT, "Y",0,"Y" },
{ (ENG_BUTTON_XPAC*7+ENG_BUTTON_WIDTH*6+ENG_BUTTONLINE1_XOFFSET), ENG_BUTTON_LINE1YPOS, ENG_BUTTON_WIDTH,ENG_BUTTON_HEIGHT, "U",0,"U" },
{ (ENG_BUTTON_XPAC*8+ENG_BUTTON_WIDTH*7+ENG_BUTTONLINE1_XOFFSET), ENG_BUTTON_LINE1YPOS, ENG_BUTTON_WIDTH,ENG_BUTTON_HEIGHT, "I",0,"I" },
{ (ENG_BUTTON_XPAC*9+ENG_BUTTON_WIDTH*8+ENG_BUTTONLINE1_XOFFSET), ENG_BUTTON_LINE1YPOS, ENG_BUTTON_WIDTH,ENG_BUTTON_HEIGHT, "O",0,"O" },
{ (ENG_BUTTON_XPAC*10+ENG_BUTTON_WIDTH*9+ENG_BUTTONLINE1_XOFFSET), ENG_BUTTON_LINE1YPOS, ENG_BUTTON_WIDTH,ENG_BUTTON_HEIGHT, "P",0,"P" },
{ (ENG_BUTTON_XPAC*1+ENG_BUTTON_WIDTH*0+ENG_BUTTONLINE2_XOFFSET), ENG_BUTTON_LINE2YPOS, ENG_BUTTON_WIDTH,ENG_BUTTON_HEIGHT, "A",0,"A" },
{ (ENG_BUTTON_XPAC*2+ENG_BUTTON_WIDTH*1+ENG_BUTTONLINE2_XOFFSET), ENG_BUTTON_LINE2YPOS, ENG_BUTTON_WIDTH,ENG_BUTTON_HEIGHT, "S",0,"S" },
{ (ENG_BUTTON_XPAC*3+ENG_BUTTON_WIDTH*2+ENG_BUTTONLINE2_XOFFSET), ENG_BUTTON_LINE2YPOS, ENG_BUTTON_WIDTH,ENG_BUTTON_HEIGHT, "D",0,"D" },
{ (ENG_BUTTON_XPAC*4+ENG_BUTTON_WIDTH*3+ENG_BUTTONLINE2_XOFFSET), ENG_BUTTON_LINE2YPOS, ENG_BUTTON_WIDTH,ENG_BUTTON_HEIGHT, "F",0,"F" },
{ (ENG_BUTTON_XPAC*5+ENG_BUTTON_WIDTH*4+ENG_BUTTONLINE2_XOFFSET), ENG_BUTTON_LINE2YPOS, ENG_BUTTON_WIDTH,ENG_BUTTON_HEIGHT, "G",0,"G" },
{ (ENG_BUTTON_XPAC*6+ENG_BUTTON_WIDTH*5+ENG_BUTTONLINE2_XOFFSET), ENG_BUTTON_LINE2YPOS, ENG_BUTTON_WIDTH,ENG_BUTTON_HEIGHT, "H",0,"H" },
{ (ENG_BUTTON_XPAC*7+ENG_BUTTON_WIDTH*6+ENG_BUTTONLINE2_XOFFSET), ENG_BUTTON_LINE2YPOS, ENG_BUTTON_WIDTH,ENG_BUTTON_HEIGHT, "J",0,"J" },
{ (ENG_BUTTON_XPAC*8+ENG_BUTTON_WIDTH*7+ENG_BUTTONLINE2_XOFFSET), ENG_BUTTON_LINE2YPOS, ENG_BUTTON_WIDTH,ENG_BUTTON_HEIGHT, "K",0,"K" },
{ (ENG_BUTTON_XPAC*9+ENG_BUTTON_WIDTH*8+ENG_BUTTONLINE2_XOFFSET), ENG_BUTTON_LINE2YPOS, ENG_BUTTON_WIDTH,ENG_BUTTON_HEIGHT, "L",0,"L" },
{ (ENG_BUTTON_XPAC*1+ENG_BUTTON_WIDTH*0+ENG_BUTTONLINE3_XOFFSET), ENG_BUTTON_LINE3YPOS, ENG_BUTTON_WIDTH+ENG_BUTTONSHIFT_XINC,ENG_BUTTON_HEIGHT, "\x19", _DrawShift }, //shift的键值为0X19 ,就是大小写切换键
{ (ENG_BUTTON_XPAC*2+ENG_BUTTON_WIDTH*1+ENG_BUTTONLINE3_XOFFSET+ENG_BUTTONSHIFT_XINC), ENG_BUTTON_LINE3YPOS, ENG_BUTTON_WIDTH,ENG_BUTTON_HEIGHT, "Z",0,"Z" },
{ (ENG_BUTTON_XPAC*3+ENG_BUTTON_WIDTH*2+ENG_BUTTONLINE3_XOFFSET+ENG_BUTTONSHIFT_XINC), ENG_BUTTON_LINE3YPOS, ENG_BUTTON_WIDTH,ENG_BUTTON_HEIGHT, "X",0,"X" },
{ (ENG_BUTTON_XPAC*4+ENG_BUTTON_WIDTH*3+ENG_BUTTONLINE3_XOFFSET+ENG_BUTTONSHIFT_XINC), ENG_BUTTON_LINE3YPOS, ENG_BUTTON_WIDTH,ENG_BUTTON_HEIGHT, "C",0,"C" },
{ (ENG_BUTTON_XPAC*5+ENG_BUTTON_WIDTH*4+ENG_BUTTONLINE3_XOFFSET+ENG_BUTTONSHIFT_XINC), ENG_BUTTON_LINE3YPOS, ENG_BUTTON_WIDTH,ENG_BUTTON_HEIGHT, "V",0,"V" },
{ (ENG_BUTTON_XPAC*6+ENG_BUTTON_WIDTH*5+ENG_BUTTONLINE3_XOFFSET+ENG_BUTTONSHIFT_XINC), ENG_BUTTON_LINE3YPOS, ENG_BUTTON_WIDTH,ENG_BUTTON_HEIGHT, "B",0,"B" },
{ (ENG_BUTTON_XPAC*7+ENG_BUTTON_WIDTH*6+ENG_BUTTONLINE3_XOFFSET+ENG_BUTTONSHIFT_XINC), ENG_BUTTON_LINE3YPOS, ENG_BUTTON_WIDTH,ENG_BUTTON_HEIGHT, "N",0,"N" },
{ (ENG_BUTTON_XPAC*8+ENG_BUTTON_WIDTH*7+ENG_BUTTONLINE3_XOFFSET+ENG_BUTTONSHIFT_XINC), ENG_BUTTON_LINE3YPOS, ENG_BUTTON_WIDTH,ENG_BUTTON_HEIGHT, "M",0,"M" },
{ (ENG_BUTTON_XPAC*9+ENG_BUTTON_WIDTH*8+ENG_BUTTONLINE3_XOFFSET+ENG_BUTTONSHIFT_XINC), ENG_BUTTON_LINE3YPOS, ENG_BUTTON_WIDTH+ENG_BUTTONENTER_XINC,ENG_BUTTON_HEIGHT, "\x08",_DrawBkSpc},
{ (ENG_BUTTON_XPAC*1+ENG_BUTTON_WIDTH*0+ENG_BUTTONLINE4_XOFFSET), ENG_BUTTON_LINE4YPOS, ENG_BUTTON_WIDTH+ENG_BUTTONFIGURE_XINC,ENG_BUTTON_HEIGHT, "\x02",0,"数"}, //切换数字键盘
{ (ENG_BUTTON_XPAC*2+ENG_BUTTON_WIDTH*1+ENG_BUTTONLINE4_XOFFSET+ENG_BUTTONFIGURE_XINC), ENG_BUTTON_LINE4YPOS, ENG_BUTTON_WIDTH+ENG_BUTTONSYMBOL_XINC,ENG_BUTTON_HEIGHT, "\x03",0,"符"}, //切换符号键盘
{ (ENG_BUTTON_XPAC*3+ENG_BUTTON_WIDTH*2+ENG_BUTTONLINE4_XOFFSET+ENG_BUTTONFIGURE_XINC+ENG_BUTTONSYMBOL_XINC), ENG_BUTTON_LINE4YPOS, ENG_BUTTON_WIDTH,ENG_BUTTON_HEIGHT, ",",0,"," },
//按钮的X位置 按钮的Y位置 按钮的宽度 按钮的高度 按钮代表的字符,按钮的绘制函数,按钮上显示的字符
{ (ENG_BUTTON_XPAC*4+ENG_BUTTON_WIDTH*3+ENG_BUTTONLINE4_XOFFSET+ENG_BUTTONFIGURE_XINC+ENG_BUTTONSYMBOL_XINC), ENG_BUTTON_LINE4YPOS, ENG_BUTTON_WIDTH+ENG_BUTTONSPACE_XINC,ENG_BUTTON_HEIGHT, " ",0,"└┘"},
{ (ENG_BUTTON_XPAC*5+ENG_BUTTON_WIDTH*4+ENG_BUTTONLINE4_XOFFSET+ENG_BUTTONFIGURE_XINC+ENG_BUTTONSYMBOL_XINC+ENG_BUTTONSPACE_XINC), ENG_BUTTON_LINE4YPOS, ENG_BUTTON_WIDTH+23,ENG_BUTTON_HEIGHT, "\x0F " ,0,"OK"},
{ (ENG_BUTTON_XPAC*6+ENG_BUTTON_WIDTH*5+ENG_BUTTONLINE4_XOFFSET+ENG_BUTTONFIGURE_XINC+ENG_BUTTONSYMBOL_XINC+ENG_BUTTONSPACE_XINC+23), ENG_BUTTON_LINE4YPOS, ENG_BUTTON_WIDTH+ENG_BUTTONCE_XINC,ENG_BUTTON_HEIGHT, "\x0B",0,"中"}, //切换到中文键盘
{ (ENG_BUTTON_XPAC*7+ENG_BUTTON_WIDTH*6+ENG_BUTTONLINE4_XOFFSET+ENG_BUTTONFIGURE_XINC+ENG_BUTTONSYMBOL_XINC+ENG_BUTTONSPACE_XINC+ENG_BUTTONCE_XINC+23), ENG_BUTTON_LINE4YPOS, ENG_BUTTON_WIDTH+ENG_BUTTONBACK_XINC,ENG_BUTTON_HEIGHT, "\x0d",_DrawEnter},
};
//数字键盘位置
static BUTTON_DATA _aNumButtonData[] = {
{ (NUM_BUTTON_XPAC*1+NUM_BUTTON_WIDTH*0+NUM_BUTTON_XOFFSET), NUM_BUTTON_LINE1YPOS,(NUM_BUTTON_WIDTH-NUM_BUTTONSING_XINC),NUM_BUTTON_HEIGHT, "+",0,"+" },
{ (NUM_BUTTON_XPAC*2+NUM_BUTTON_WIDTH*1+NUM_BUTTON_XOFFSET-NUM_BUTTONSING_XINC), NUM_BUTTON_LINE1YPOS, NUM_BUTTON_WIDTH,NUM_BUTTON_HEIGHT, "1" ,0,"1"},
{ (NUM_BUTTON_XPAC*3+NUM_BUTTON_WIDTH*2+NUM_BUTTON_XOFFSET-NUM_BUTTONSING_XINC), NUM_BUTTON_LINE1YPOS, NUM_BUTTON_WIDTH,NUM_BUTTON_HEIGHT, "2" ,0,"2"},
{ (NUM_BUTTON_XPAC*4+NUM_BUTTON_WIDTH*3+NUM_BUTTON_XOFFSET-NUM_BUTTONSING_XINC), NUM_BUTTON_LINE1YPOS, NUM_BUTTON_WIDTH,NUM_BUTTON_HEIGHT, "3" ,0,"3"},
{ (NUM_BUTTON_XPAC*5+NUM_BUTTON_WIDTH*4+NUM_BUTTON_XOFFSET-NUM_BUTTONSING_XINC), NUM_BUTTON_LINE1YPOS, (NUM_BUTTON_WIDTH-NUM_BUTTONBACKSPACE_XINC),NUM_BUTTON_HEIGHT, "\x08",_DrawBkSpc}, //删除键
{ (NUM_BUTTON_XPAC*1+NUM_BUTTON_WIDTH*0+NUM_BUTTON_XOFFSET), NUM_BUTTON_LINE2YPOS,(NUM_BUTTON_WIDTH-NUM_BUTTONSING_XINC),NUM_BUTTON_HEIGHT, "-",0,"-" },
{ (NUM_BUTTON_XPAC*2+NUM_BUTTON_WIDTH*1+NUM_BUTTON_XOFFSET-NUM_BUTTONSING_XINC), NUM_BUTTON_LINE2YPOS, NUM_BUTTON_WIDTH,NUM_BUTTON_HEIGHT, "4" ,0,"4"},
{ (NUM_BUTTON_XPAC*3+NUM_BUTTON_WIDTH*2+NUM_BUTTON_XOFFSET-NUM_BUTTONSING_XINC), NUM_BUTTON_LINE2YPOS, NUM_BUTTON_WIDTH,NUM_BUTTON_HEIGHT, "5" ,0,"5"},
{ (NUM_BUTTON_XPAC*4+NUM_BUTTON_WIDTH*3+NUM_BUTTON_XOFFSET-NUM_BUTTONSING_XINC), NUM_BUTTON_LINE2YPOS, NUM_BUTTON_WIDTH,NUM_BUTTON_HEIGHT, "6" ,0,"6"},
{ (NUM_BUTTON_XPAC*5+NUM_BUTTON_WIDTH*4+NUM_BUTTON_XOFFSET-NUM_BUTTONSING_XINC), NUM_BUTTON_LINE2YPOS, (NUM_BUTTON_WIDTH-NUM_BUTTONSPACE_XINC),NUM_BUTTON_HEIGHT, " ",0,"└┘" }, //空格键
{ (NUM_BUTTON_XPAC*1+NUM_BUTTON_WIDTH*0+NUM_BUTTON_XOFFSET), NUM_BUTTON_LINE3YPOS,(NUM_BUTTON_WIDTH-NUM_BUTTONSING_XINC),NUM_BUTTON_HEIGHT, "/",0,"/" },
{ (NUM_BUTTON_XPAC*2+NUM_BUTTON_WIDTH*1+NUM_BUTTON_XOFFSET-NUM_BUTTONSING_XINC), NUM_BUTTON_LINE3YPOS, NUM_BUTTON_WIDTH,NUM_BUTTON_HEIGHT, "7" ,0,"7"},
{ (NUM_BUTTON_XPAC*3+NUM_BUTTON_WIDTH*2+NUM_BUTTON_XOFFSET-NUM_BUTTONSING_XINC), NUM_BUTTON_LINE3YPOS, NUM_BUTTON_WIDTH,NUM_BUTTON_HEIGHT, "8" ,0,"8"},
{ (NUM_BUTTON_XPAC*4+NUM_BUTTON_WIDTH*3+NUM_BUTTON_XOFFSET-NUM_BUTTONSING_XINC), NUM_BUTTON_LINE3YPOS, NUM_BUTTON_WIDTH,NUM_BUTTON_HEIGHT, "9" ,0,"9"},
{ (NUM_BUTTON_XPAC*5+NUM_BUTTON_WIDTH*4+NUM_BUTTON_XOFFSET-NUM_BUTTONSING_XINC), NUM_BUTTON_LINE3YPOS, (NUM_BUTTON_WIDTH-NUM_BUTTONENTER_XINC),NUM_BUTTON_HEIGHT, "\x0d",_DrawEnter}, //回车键
{ (NUM_BUTTON_XPAC*1+NUM_BUTTON_WIDTH*0+NUM_BUTTON_XOFFSET), NUM_BUTTON_LINE4YPOS,(NUM_BUTTON_WIDTH-NUM_BUTTONSING_XINC),NUM_BUTTON_HEIGHT, "@",0,"@" },
{ (NUM_BUTTON_XPAC*2+NUM_BUTTON_WIDTH*1+NUM_BUTTON_XOFFSET-NUM_BUTTONSING_XINC), NUM_BUTTON_LINE4YPOS, NUM_BUTTON_WIDTH,NUM_BUTTON_HEIGHT, "," ,0,","},
{ (NUM_BUTTON_XPAC*3+NUM_BUTTON_WIDTH*2+NUM_BUTTON_XOFFSET-NUM_BUTTONSING_XINC), NUM_BUTTON_LINE4YPOS, NUM_BUTTON_WIDTH,NUM_BUTTON_HEIGHT, "0" ,0,"0"},
{ (NUM_BUTTON_XPAC*4+NUM_BUTTON_WIDTH*3+NUM_BUTTON_XOFFSET-NUM_BUTTONSING_XINC), NUM_BUTTON_LINE4YPOS, NUM_BUTTON_WIDTH,NUM_BUTTON_HEIGHT, "." ,0,"."},
{ (NUM_BUTTON_XPAC*5+NUM_BUTTON_WIDTH*4+NUM_BUTTON_XOFFSET-NUM_BUTTONSING_XINC), NUM_BUTTON_LINE4YPOS, (NUM_BUTTON_WIDTH-NUM_BUTTONRETURN_XINC),NUM_BUTTON_HEIGHT, "\x04",_DrawRetern },//返回键
};
//符号键盘参数
static BUTTON_DATA _aSinButtonData[][20] = {
{
{ (SIGN_BUTTON_XPAC*1+SING_BUTTON_WIDTH*0+SIGN_BUTTON_XOFFSET), SIGN_BUTTON_LINE1YPOS, SING_BUTTON_WIDTH,SIGN_BUTTON_HEIGHT, "~" ,0,"~"},
{ (SIGN_BUTTON_XPAC*2+SING_BUTTON_WIDTH*1+SIGN_BUTTON_XOFFSET), SIGN_BUTTON_LINE1YPOS, SING_BUTTON_WIDTH,SIGN_BUTTON_HEIGHT, "-" ,0,"-"},
{ (SIGN_BUTTON_XPAC*3+SING_BUTTON_WIDTH*2+SIGN_BUTTON_XOFFSET), SIGN_BUTTON_LINE1YPOS, SING_BUTTON_WIDTH,SIGN_BUTTON_HEIGHT, ":" ,0,":"},
{ (SIGN_BUTTON_XPAC*4+SING_BUTTON_WIDTH*3+SIGN_BUTTON_XOFFSET), SIGN_BUTTON_LINE1YPOS, SING_BUTTON_WIDTH,SIGN_BUTTON_HEIGHT, "_" ,0,"_"},
{ (SIGN_BUTTON_XPAC*5+SING_BUTTON_WIDTH*4+SIGN_BUTTON_XOFFSET), SIGN_BUTTON_LINE1YPOS, (SING_BUTTON_WIDTH-SIGN_BUTTONCONTR_XINC),SIGN_BUTTON_HEIGHT, "\x08",_DrawBkSpc}, //删除键
{ (SIGN_BUTTON_XPAC*1+SING_BUTTON_WIDTH*0+SIGN_BUTTON_XOFFSET), SIGN_BUTTON_LINE2YPOS, SING_BUTTON_WIDTH,SIGN_BUTTON_HEIGHT, "\"",0,"\"" },
{ (SIGN_BUTTON_XPAC*2+SING_BUTTON_WIDTH*1+SIGN_BUTTON_XOFFSET), SIGN_BUTTON_LINE2YPOS, SING_BUTTON_WIDTH,SIGN_BUTTON_HEIGHT, "," ,0,","},
{ (SIGN_BUTTON_XPAC*3+SING_BUTTON_WIDTH*2+SIGN_BUTTON_XOFFSET), SIGN_BUTTON_LINE2YPOS, SING_BUTTON_WIDTH,SIGN_BUTTON_HEIGHT, "<" ,0,"<"},
{ (SIGN_BUTTON_XPAC*4+SING_BUTTON_WIDTH*3+SIGN_BUTTON_XOFFSET), SIGN_BUTTON_LINE2YPOS, SING_BUTTON_WIDTH,SIGN_BUTTON_HEIGHT, ">" ,0,">"},
{ (SIGN_BUTTON_XPAC*5+SING_BUTTON_WIDTH*4+SIGN_BUTTON_XOFFSET), SIGN_BUTTON_LINE2YPOS, (SING_BUTTON_WIDTH-SIGN_BUTTONCONTR_XINC),SIGN_BUTTON_HEIGHT, "\x05",0,"∧"}, //上一页
{ (SIGN_BUTTON_XPAC*1+SING_BUTTON_WIDTH*0+SIGN_BUTTON_XOFFSET), SIGN_BUTTON_LINE3YPOS, SING_BUTTON_WIDTH,NUM_BUTTON_HEIGHT, "*",0,"*" },
{ (SIGN_BUTTON_XPAC*2+SING_BUTTON_WIDTH*1+SIGN_BUTTON_XOFFSET), SIGN_BUTTON_LINE3YPOS, SING_BUTTON_WIDTH,NUM_BUTTON_HEIGHT, "+",0,"+" },
{ (SIGN_BUTTON_XPAC*3+SING_BUTTON_WIDTH*2+SIGN_BUTTON_XOFFSET), SIGN_BUTTON_LINE3YPOS, SING_BUTTON_WIDTH,NUM_BUTTON_HEIGHT, ".",0,"." },
{ (SIGN_BUTTON_XPAC*4+SING_BUTTON_WIDTH*3+SIGN_BUTTON_XOFFSET), SIGN_BUTTON_LINE3YPOS, SING_BUTTON_WIDTH,NUM_BUTTON_HEIGHT, "#",0,"#" },
{ (SIGN_BUTTON_XPAC*5+SING_BUTTON_WIDTH*4+SIGN_BUTTON_XOFFSET), SIGN_BUTTON_LINE3YPOS, (SING_BUTTON_WIDTH-SIGN_BUTTONCONTR_XINC),SIGN_BUTTON_HEIGHT, "\x06",0,"∨"}, //下一页
{ (SIGN_BUTTON_XPAC*1+SING_BUTTON_WIDTH*0+SIGN_BUTTON_XOFFSET), SIGN_BUTTON_LINE4YPOS, SING_BUTTON_WIDTH,NUM_BUTTON_HEIGHT, "%",0,"%"},
{ (SIGN_BUTTON_XPAC*2+SING_BUTTON_WIDTH*1+SIGN_BUTTON_XOFFSET), SIGN_BUTTON_LINE4YPOS, SING_BUTTON_WIDTH,NUM_BUTTON_HEIGHT, "@",0,"@" },
{ (SIGN_BUTTON_XPAC*3+SING_BUTTON_WIDTH*2+SIGN_BUTTON_XOFFSET), SIGN_BUTTON_LINE4YPOS, SING_BUTTON_WIDTH,NUM_BUTTON_HEIGHT, "!",0,"!" },
{ (SIGN_BUTTON_XPAC*4+SING_BUTTON_WIDTH*3+SIGN_BUTTON_XOFFSET), SIGN_BUTTON_LINE4YPOS, SING_BUTTON_WIDTH,NUM_BUTTON_HEIGHT, "/",0,"/" },
{ (SIGN_BUTTON_XPAC*5+SING_BUTTON_WIDTH*4+SIGN_BUTTON_XOFFSET), SIGN_BUTTON_LINE4YPOS, (SING_BUTTON_WIDTH-SIGN_BUTTONCONTR_XINC),SIGN_BUTTON_HEIGHT, "\x04",_DrawRetern },//返回键
},
{
{ (SIGN_BUTTON_XPAC*1+SING_BUTTON_WIDTH*0+SIGN_BUTTON_XOFFSET), SIGN_BUTTON_LINE1YPOS, SING_BUTTON_WIDTH,SIGN_BUTTON_HEIGHT, "?",0,"?" },
{ (SIGN_BUTTON_XPAC*2+SING_BUTTON_WIDTH*1+SIGN_BUTTON_XOFFSET), SIGN_BUTTON_LINE1YPOS, SING_BUTTON_WIDTH,SIGN_BUTTON_HEIGHT, ";",0,";" },
{ (SIGN_BUTTON_XPAC*3+SING_BUTTON_WIDTH*2+SIGN_BUTTON_XOFFSET), SIGN_BUTTON_LINE1YPOS, SING_BUTTON_WIDTH,SIGN_BUTTON_HEIGHT, "`",0,"`" },
{ (SIGN_BUTTON_XPAC*4+SING_BUTTON_WIDTH*3+SIGN_BUTTON_XOFFSET), SIGN_BUTTON_LINE1YPOS, SING_BUTTON_WIDTH,SIGN_BUTTON_HEIGHT, "$",0,"$" },
{ (SIGN_BUTTON_XPAC*5+SING_BUTTON_WIDTH*4+SIGN_BUTTON_XOFFSET), SIGN_BUTTON_LINE1YPOS, (SING_BUTTON_WIDTH-SIGN_BUTTONCONTR_XINC),SIGN_BUTTON_HEIGHT, "\x08",_DrawBkSpc}, //删除键
{ (SIGN_BUTTON_XPAC*1+SING_BUTTON_WIDTH*0+SIGN_BUTTON_XOFFSET), SIGN_BUTTON_LINE2YPOS, SING_BUTTON_WIDTH,SIGN_BUTTON_HEIGHT, "^" ,0,"^"},
{ (SIGN_BUTTON_XPAC*2+SING_BUTTON_WIDTH*1+SIGN_BUTTON_XOFFSET), SIGN_BUTTON_LINE2YPOS, SING_BUTTON_WIDTH,SIGN_BUTTON_HEIGHT, "\\",0,"\\" },
{ (SIGN_BUTTON_XPAC*3+SING_BUTTON_WIDTH*2+SIGN_BUTTON_XOFFSET), SIGN_BUTTON_LINE2YPOS, SING_BUTTON_WIDTH,SIGN_BUTTON_HEIGHT, "(" ,0,"("},
{ (SIGN_BUTTON_XPAC*4+SING_BUTTON_WIDTH*3+SIGN_BUTTON_XOFFSET), SIGN_BUTTON_LINE2YPOS, SING_BUTTON_WIDTH,SIGN_BUTTON_HEIGHT, ")" ,0,")"},
{ (SIGN_BUTTON_XPAC*5+SING_BUTTON_WIDTH*4+SIGN_BUTTON_XOFFSET), SIGN_BUTTON_LINE2YPOS, (SING_BUTTON_WIDTH-SIGN_BUTTONCONTR_XINC),SIGN_BUTTON_HEIGHT, "\x05",0,"∧" }, //上一页
{ (SIGN_BUTTON_XPAC*1+SING_BUTTON_WIDTH*0+SIGN_BUTTON_XOFFSET), SIGN_BUTTON_LINE3YPOS, SING_BUTTON_WIDTH,NUM_BUTTON_HEIGHT, "&",0,"&" },
{ (SIGN_BUTTON_XPAC*2+SING_BUTTON_WIDTH*1+SIGN_BUTTON_XOFFSET), SIGN_BUTTON_LINE3YPOS, SING_BUTTON_WIDTH,NUM_BUTTON_HEIGHT, "=",0,"=" },
{ (SIGN_BUTTON_XPAC*3+SING_BUTTON_WIDTH*2+SIGN_BUTTON_XOFFSET), SIGN_BUTTON_LINE3YPOS, SING_BUTTON_WIDTH,NUM_BUTTON_HEIGHT, "'",0,"'" },
{ (SIGN_BUTTON_XPAC*4+SING_BUTTON_WIDTH*3+SIGN_BUTTON_XOFFSET), SIGN_BUTTON_LINE3YPOS, SING_BUTTON_WIDTH,NUM_BUTTON_HEIGHT, "|",0,"|" },
{ (SIGN_BUTTON_XPAC*5+SING_BUTTON_WIDTH*4+SIGN_BUTTON_XOFFSET), SIGN_BUTTON_LINE3YPOS, (SING_BUTTON_WIDTH-SIGN_BUTTONCONTR_XINC),SIGN_BUTTON_HEIGHT, "\x06",0,"∨"}, //下一页
{ (SIGN_BUTTON_XPAC*1+SING_BUTTON_WIDTH*0+SIGN_BUTTON_XOFFSET), SIGN_BUTTON_LINE4YPOS, SING_BUTTON_WIDTH,NUM_BUTTON_HEIGHT, "[",0,"[" },
{ (SIGN_BUTTON_XPAC*2+SING_BUTTON_WIDTH*1+SIGN_BUTTON_XOFFSET), SIGN_BUTTON_LINE4YPOS, SING_BUTTON_WIDTH,NUM_BUTTON_HEIGHT, "]",0,"]" },
{ (SIGN_BUTTON_XPAC*3+SING_BUTTON_WIDTH*2+SIGN_BUTTON_XOFFSET), SIGN_BUTTON_LINE4YPOS, SING_BUTTON_WIDTH,NUM_BUTTON_HEIGHT, "{",0,"{" },
{ (SIGN_BUTTON_XPAC*4+SING_BUTTON_WIDTH*3+SIGN_BUTTON_XOFFSET), SIGN_BUTTON_LINE4YPOS, SING_BUTTON_WIDTH,NUM_BUTTON_HEIGHT, "}",0,"}" },
{ (SIGN_BUTTON_XPAC*5+SING_BUTTON_WIDTH*4+SIGN_BUTTON_XOFFSET), SIGN_BUTTON_LINE4YPOS, (SING_BUTTON_WIDTH-SIGN_BUTTONCONTR_XINC),SIGN_BUTTON_HEIGHT, "\x04",_DrawRetern },//返回键
},
};
//中文键盘1位置 这个是拼音输入部分按键
static BUTTON_DATA _aChineseButtonData1[] = {
//中文键盘第一部分
{ (CHIN1_BUTTON_XPAC*1+CHIN1_BUTTON_WIDTH*0+CHIN1_BUTTON_XOFFSET), CHIN1_BUTTON_LINE1YPOS, CHIN1_BUTTON_WIDTH,CHIN1_BUTTON_HEIGHT, ";" ,0,";" },
{ (CHIN1_BUTTON_XPAC*2+CHIN1_BUTTON_WIDTH*1+CHIN1_BUTTON_XOFFSET), CHIN1_BUTTON_LINE1YPOS, CHIN1_BUTTON_WIDTH,CHIN1_BUTTON_HEIGHT, "2" ,0,"ABC"},
{ (CHIN1_BUTTON_XPAC*3+CHIN1_BUTTON_WIDTH*2+CHIN1_BUTTON_XOFFSET), CHIN1_BUTTON_LINE1YPOS, CHIN1_BUTTON_WIDTH,CHIN1_BUTTON_HEIGHT, "3" ,0,"DEF"},
{ (CHIN1_BUTTON_XPAC*4+CHIN1_BUTTON_WIDTH*3+CHIN1_BUTTON_XOFFSET), CHIN1_BUTTON_LINE1YPOS, (CHIN1_BUTTON_WIDTH-CHIN1_BUTTONCONTR_XINC),CHIN1_BUTTON_HEIGHT, "\x08",_DrawBkSpc}, //删除键
{ (CHIN1_BUTTON_XPAC*1+CHIN1_BUTTON_WIDTH*0+CHIN1_BUTTON_XOFFSET), CHIN1_BUTTON_LINE2YPOS, CHIN1_BUTTON_WIDTH,CHIN1_BUTTON_HEIGHT, "4" ,0,"GHI"},
{ (CHIN1_BUTTON_XPAC*2+CHIN1_BUTTON_WIDTH*1+CHIN1_BUTTON_XOFFSET), CHIN1_BUTTON_LINE2YPOS, CHIN1_BUTTON_WIDTH,CHIN1_BUTTON_HEIGHT, "5" ,0,"JKL"},
{ (CHIN1_BUTTON_XPAC*3+CHIN1_BUTTON_WIDTH*2+CHIN1_BUTTON_XOFFSET), CHIN1_BUTTON_LINE2YPOS, CHIN1_BUTTON_WIDTH,CHIN1_BUTTON_HEIGHT, "6" ,0,"MNO"},
{ (CHIN1_BUTTON_XPAC*4+CHIN1_BUTTON_WIDTH*3+CHIN1_BUTTON_XOFFSET), CHIN1_BUTTON_LINE2YPOS, (CHIN1_BUTTON_WIDTH-CHIN1_BUTTONCONTR_XINC),CHIN1_BUTTON_HEIGHT, " ",0,"└┘" }, //空格键
{ (CHIN1_BUTTON_XPAC*1+CHIN1_BUTTON_WIDTH*0+CHIN1_BUTTON_XOFFSET), CHIN1_BUTTON_LINE3YPOS, CHIN1_BUTTON_WIDTH,CHIN1_BUTTON_HEIGHT, "7",0,"PQRS" },
{ (CHIN1_BUTTON_XPAC*2+CHIN1_BUTTON_WIDTH*1+CHIN1_BUTTON_XOFFSET), CHIN1_BUTTON_LINE3YPOS, CHIN1_BUTTON_WIDTH,CHIN1_BUTTON_HEIGHT, "8",0,"TUV" },
{ (CHIN1_BUTTON_XPAC*3+CHIN1_BUTTON_WIDTH*2+CHIN1_BUTTON_XOFFSET), CHIN1_BUTTON_LINE3YPOS, CHIN1_BUTTON_WIDTH,CHIN1_BUTTON_HEIGHT, "9",0,"WXYZ"},
{ (CHIN1_BUTTON_XPAC*4+CHIN1_BUTTON_WIDTH*3+CHIN1_BUTTON_XOFFSET), CHIN1_BUTTON_LINE3YPOS, (CHIN1_BUTTON_WIDTH-CHIN1_BUTTONCONTR_XINC),CHIN1_BUTTON_HEIGHT, "\x04",_DrawRetern },//返回键
};
//中文键盘2位置 这个是汉字和拼音选择按键
static BUTTON_DATA _aChineseButtonData2[] = {
{ (CHIN2_BUTTON_XPAC*1+CHIN2_BUTTON_WIDTH*0+CHIN2_BUTTON_XOFFSET), CHIN2_BUTTON_LINE1YPOS, CHIN2_BUTTON_WIDTH,CHIN2_BUTTON_HEIGHT, "",0,"<"}, //向左(即汉字的上一页按键)
{ (CHIN2_BUTTON_XPAC*2+CHIN2_BUTTON_WIDTH*1+CHIN2_BUTTON_XOFFSET), CHIN2_BUTTON_LINE1YPOS, CHIN2_BUTTON_WIDTH,CHIN2_BUTTON_HEIGHT, "" },
{ (CHIN2_BUTTON_XPAC*3+CHIN2_BUTTON_WIDTH*2+CHIN2_BUTTON_XOFFSET), CHIN2_BUTTON_LINE1YPOS, CHIN2_BUTTON_WIDTH,CHIN2_BUTTON_HEIGHT, "" },
{ (CHIN2_BUTTON_XPAC*4+CHIN2_BUTTON_WIDTH*3+CHIN2_BUTTON_XOFFSET), CHIN2_BUTTON_LINE1YPOS, CHIN2_BUTTON_WIDTH,CHIN2_BUTTON_HEIGHT, "" },
{ (CHIN2_BUTTON_XPAC*5+CHIN2_BUTTON_WIDTH*4+CHIN2_BUTTON_XOFFSET), CHIN2_BUTTON_LINE1YPOS, CHIN2_BUTTON_WIDTH,CHIN2_BUTTON_HEIGHT, "" },
{ (CHIN2_BUTTON_XPAC*6+CHIN2_BUTTON_WIDTH*5+CHIN2_BUTTON_XOFFSET), CHIN2_BUTTON_LINE1YPOS, CHIN2_BUTTON_WIDTH,CHIN2_BUTTON_HEIGHT, "" },
{ (CHIN2_BUTTON_XPAC*7+CHIN2_BUTTON_WIDTH*6+CHIN2_BUTTON_XOFFSET), CHIN2_BUTTON_LINE1YPOS, CHIN2_BUTTON_WIDTH,CHIN2_BUTTON_HEIGHT, "" },
{ (CHIN2_BUTTON_XPAC*8+CHIN2_BUTTON_WIDTH*7+CHIN2_BUTTON_XOFFSET), CHIN2_BUTTON_LINE1YPOS, CHIN2_BUTTON_WIDTH,CHIN2_BUTTON_HEIGHT, "",0,">"}, //向右(即汉字的下一页按键)
{ (CHIN2_BUTTON_XPAC*1+CHIN2_BUTTON_WIDTH*0+CHIN2_BUTTON_XOFFSET), CHIN2_BUTTON_LINE2YPOS, (CHIN2_BUTTON_WIDTH+CHIN2_BUTTONPY_XINC),(CHIN2_BUTTON_HEIGHT+CHIN2_BUTTONPY_YINC), "\x05",0,"∧"},//上一页(汉字对应拼音的上一页按键)
{ (CHIN2_BUTTON_XPAC*1+CHIN2_BUTTON_WIDTH*0+CHIN2_BUTTON_XOFFSET), CHIN2_BUTTON_LINE3YPOS, (CHIN2_BUTTON_WIDTH+CHIN2_BUTTONPY_XINC),(CHIN2_BUTTON_HEIGHT+CHIN2_BUTTONPY_YINC), " " },
{ (CHIN2_BUTTON_XPAC*1+CHIN2_BUTTON_WIDTH*0+CHIN2_BUTTON_XOFFSET), CHIN2_BUTTON_LINE4YPOS, (CHIN2_BUTTON_WIDTH+CHIN2_BUTTONPY_XINC),(CHIN2_BUTTON_HEIGHT+CHIN2_BUTTONPY_YINC), " " },
{ (CHIN2_BUTTON_XPAC*1+CHIN2_BUTTON_WIDTH*0+CHIN2_BUTTON_XOFFSET), CHIN2_BUTTON_LINE5YPOS, (CHIN2_BUTTON_WIDTH+CHIN2_BUTTONPY_XINC),(CHIN2_BUTTON_HEIGHT+CHIN2_BUTTONPY_YINC), " " },
{ (CHIN2_BUTTON_XPAC*1+CHIN2_BUTTON_WIDTH*0+CHIN2_BUTTON_XOFFSET), CHIN2_BUTTON_LINE6YPOS, (CHIN2_BUTTON_WIDTH+CHIN2_BUTTONPY_XINC),(CHIN2_BUTTON_HEIGHT+CHIN2_BUTTONPY_YINC), "\x06",0,"∨" },//下一页(汉字对应拼音的下一页按键)
};
//大小写切换处理
void changecase(u8 change_flag,BUTTON_DATA *buttondata)
{
u16 i;
char NumToStr;
char buffer[5];
if(keypad_dev.LowerCase) //小写,按钮修改为小写
{
//更改按钮的字符
for (i = 0; i < 27; i++)
{
if(i==19) continue;
NumToStr=(char)((int)*(buttondata[i].acLabel)+0x20);
sprintf(buffer,"%c",NumToStr); //转换为字符
BUTTON_SetFont(keypad_dev.EngButton_Handle[i],&GUI_FontHZ24);
BUTTON_SetText(keypad_dev.EngButton_Handle[i],buffer); //设置更改成小写英文按钮上的文本
BUTTON_SetFocussable(keypad_dev.EngButton_Handle[i], 0); //设置按钮不能接收输入焦点
}
}
else //大写,按钮上的字符改为大写
{
//更改按钮的字符
for (i = 0; i < 27; i++) //_aEngButtonData[]中的ButString默认就是大写,所以不需要经过大小写转换,可以直接显示
{
if(i==19) continue;
BUTTON_SetFont(keypad_dev.EngButton_Handle[i],&GUI_FontHZ24);
BUTTON_SetText(keypad_dev.EngButton_Handle[i], buttondata[i].acLabel);
BUTTON_SetFocussable(keypad_dev.EngButton_Handle[i], 0);
}
}
}
//绘制英文键盘
//hWin:父窗口
void drawenglish_pad(WM_HWIN hWin)
{
u16 i;
//创建键盘按钮
BUTTON_SetDefaultSkin(_DrawSkinFlex_BUTTON); //设置BUTTON的皮肤
for (i = 0; i < GUI_COUNTOF(_aEngButtonData); i++)
{
//创建按钮
keypad_dev.EngButton_Handle[i] = BUTTON_CreateEx(_aEngButtonData[i].xPos, _aEngButtonData[i].yPos, _aEngButtonData[i].xSize, _aEngButtonData[i].ySize,
hWin, WM_CF_SHOW | WM_CF_HASTRANS, 0, ID_BUTTON + i); //英文按钮的在窗口左侧的位置,在最顶端的位置,水平尺寸,垂直尺寸,父窗口的句柄,创建后立即可见|有透明性标记,无意义,按钮的窗口ID
BUTTON_SetFont(keypad_dev.EngButton_Handle[i],&GUI_FontHZ24); //设置英文的字体,这里只要给出英文按钮的句柄,和想要设置的字体即可
BUTTON_SetText(keypad_dev.EngButton_Handle[i], _aEngButtonData[i].ButString); //设置英文按钮上的显示的字母
BUTTON_SetFocussable(keypad_dev.EngButton_Handle[i], 0); //设置按钮不能接收输入焦点
}
changecase(keypad_dev.LowerCase,_aEngButtonData);
}
//绘制数字键盘
void drawnumber_pad(WM_HWIN hWin)
{
u16 i;
for(i=0;i<GUI_COUNTOF(_aNumButtonData);i++) //创建数字键盘
{
//创建按钮
BUTTON_SetDefaultSkin(_DrawSkinFlex_BUTTON); //设置BUTTON的皮肤
keypad_dev.NumButton_Handle[i] = BUTTON_CreateEx(_aNumButtonData[i].xPos, _aNumButtonData[i].yPos, _aNumButtonData[i].xSize, _aNumButtonData[i].ySize,
hWin, WM_CF_SHOW | WM_CF_HASTRANS, 0, ID_BUTTON + i);
BUTTON_SetFont(keypad_dev.NumButton_Handle[i],&GUI_FontHZ24);
BUTTON_SetText(keypad_dev.NumButton_Handle[i], _aNumButtonData[i].ButString); //设置数字按钮上的显示的数字
BUTTON_SetFocussable(keypad_dev.NumButton_Handle[i], 0); //设置按钮不能接收输入焦点
}
}
//绘制符号键盘
void drawsign_pad(WM_HWIN hWin)
{
u16 i;
for(i=0;i<GUI_COUNTOF(_aSinButtonData[keypad_dev.signpad_flag]);i++) //创建符号键盘
{
//创建按钮
BUTTON_SetDefaultSkin(_DrawSkinFlex_BUTTON); //设置BUTTON的皮肤
keypad_dev.SignButton_Handle[i] = BUTTON_CreateEx(_aSinButtonData[keypad_dev.signpad_flag][i].xPos, _aSinButtonData[keypad_dev.signpad_flag][i].yPos,
_aSinButtonData[keypad_dev.signpad_flag][i].xSize,_aSinButtonData[keypad_dev.signpad_flag][i].ySize,
hWin, WM_CF_SHOW | WM_CF_HASTRANS, 0, ID_BUTTON + i);
BUTTON_SetFont(keypad_dev.SignButton_Handle[i],&GUI_FontHZ24);
BUTTON_SetText(keypad_dev.SignButton_Handle[i],_aSinButtonData[keypad_dev.signpad_flag][i].ButString);
BUTTON_SetFocussable(keypad_dev.SignButton_Handle[i], 0);
}
}
//绘制中文键盘1
void drawchinese1_pad(WM_HWIN hWin)
{
u16 i;
for(i=0;i<GUI_COUNTOF(_aChineseButtonData1);i++) //创建中文键盘1
{
//创建按钮
BUTTON_SetDefaultSkin(_DrawSkinFlex_BUTTON); //设置BUTTON的皮肤
keypad_dev.ChineseButton_Handle[i] = BUTTON_CreateEx(_aChineseButtonData1[i].xPos, _aChineseButtonData1[i].yPos, _aChineseButtonData1[i].xSize, _aChineseButtonData1[i].ySize,
hWin, WM_CF_SHOW | WM_CF_HASTRANS, 0, ID_BUTTON + i);
BUTTON_SetFont(keypad_dev.ChineseButton_Handle[i],&GUI_FontHZ24);
BUTTON_SetText(keypad_dev.ChineseButton_Handle[i], _aChineseButtonData1[i].ButString);
BUTTON_SetFocussable(keypad_dev.ChineseButton_Handle[i], 0);
}
}
void drawchinese2_pad(WM_HWIN hWin)
{
u16 i;
for(i=0;i<GUI_COUNTOF(_aChineseButtonData2);i++) //创建中文键盘2
{
//创建按钮
BUTTON_SetDefaultSkin(_DrawChineseSkin_BUTTON); //设置BUTTON的皮肤
keypad_dev.ChineseButton_Handle[i+12] = BUTTON_CreateEx(_aChineseButtonData2[i].xPos, _aChineseButtonData2[i].yPos, _aChineseButtonData2[i].xSize, _aChineseButtonData2[i].ySize,
hWin, WM_CF_SHOW | WM_CF_HASTRANS, 0, ID_BUTTON + i+12);
BUTTON_SetFont(keypad_dev.ChineseButton_Handle[i+12],&GUI_FontHZ24);
BUTTON_SetText(keypad_dev.ChineseButton_Handle[i+12], _aChineseButtonData2[i].ButString);
BUTTON_SetFocussable(keypad_dev.ChineseButton_Handle[i+12], 0);
}
}
//英文键盘处理函数
//buttondata:英文键盘按钮参数
//Id:按钮ID
//*pMsg:指向消息 即keypad键盘上按钮按下时传来的消息
void engkeypad_process(BUTTON_DATA *buttondata,int Id,WM_MESSAGE *pMsg) //buttondata就是英文数组_aEngButtonData[]
{ WM_HWIN hEdit;
char c;
WM_MESSAGE Msg;
u8 KeyID;
KeyID=Id-ID_BUTTON; //Id-ID_BUTTON得到的是英文按钮的ID号(也就是代表那个按钮按下了)
if (buttondata[Id - ID_BUTTON].acLabel) //如果按钮ID代表的字母不是空的
{
c = buttondata[Id - ID_BUTTON].acLabel[0]; //得到按钮所代表的字母 ,即ID号所代表的字母
if(KeyID == 19) //大小写切换,即如果ID号是19代表的就是大小写切换键
{
keypad_dev.LowerCase ^= 1; //对LowerCase进行异或操作
changecase(keypad_dev.LowerCase,buttondata);
}
else if(KeyID == 28) //切换到数字键盘
{
keypad_dev.padtype=NUMBER_KEYPAD; //数字键盘
Msg.MsgId=CHANGE_ENGLISHPADTO_NUMPAD; //消息的类型是回调函数中自定义的消息类型,即数字键盘切换到英文键盘:WM_USER+0
Msg.hWinSrc=pMsg->hWin; //将keypad的ID号给keypand上的小工具
WM_SendMessage(keypad_dev.hKeypad,&Msg);//切换到数字键盘,这里我们不直接切换,而是给按钮的父窗口(即keypad窗口)发送切换键盘的消息,然后在按钮的父窗口(keypad窗口)的回调函数_cbKeyPad()中完成分键盘的切换,也就是这里会跳到_cbKeyPad()执行。
} //参数是:软键盘(keypad)的窗口句柄和发给keypad的消息,这时系统就会调用_cbKeyPad函数处理keypad接收到的消息。 软键盘(keypad)的窗口句柄是在初始化时keypad_demo()函数里面创建keypad是付给keypad_dev.hKeypad的
else if(KeyID == 29) //切换到符号键盘
{
keypad_dev.padtype=SIGN_KEYPAD;
Msg.MsgId=CHANGE_ENGLISHPADTO_SIGNPAD1;
Msg.hWinSrc=pMsg->hWin;
WM_SendMessage(keypad_dev.hKeypad,&Msg);
}
else if(KeyID == 33) //切换到中文键盘
{
keypad_dev.padtype=CHINESE_KEYPAD;
Msg.MsgId=CHANGE_ENGLISHPADTO_CHINESEPAD;
Msg.hWinSrc=pMsg->hWin;
WM_SendMessage(keypad_dev.hKeypad,&Msg);
}
else if(KeyID == 32) //在英文键盘界面按下了OK键,就向keypad的回调函数发送消息
{ Msg.MsgId=WM_DELETE; //消息的内容是要隐藏键盘窗口
Msg.hWinSrc=pMsg->hWin;
WM_SendMessage(keypad_dev.hKeypad,&Msg);
}
else
{
if (keypad_dev.LowerCase && (c>=0X41) && (c<=0X5A)) //小写并且字符在A-Z之间
{
c += 0x20; //就把小写的字符变成大写
}
hEdit=WM_GetDialogItem(hWin_Main,MULTIEDIT_ID_Storage); //得到选中的MULTIEDIT的窗口句柄
MULTIEDIT_EnableBlink(hEdit,500,1); //开启光标,周期500ms
MULTIEDIT_SetInsertMode(hEdit,1); //开启插入模式
MULTIEDIT_SetFont(hEdit, &GUI_FontHZ16);
WM_SetFocus(hEdit); //将输入焦点设置到多行文本小工具
GUI_StoreKeyMsg(c, 1); //把消息存进键盘缓冲器,按下状态。 在创建一个multi edit(多行文本小工具)时,已将输入焦点设置到多行文本小工具,在这里就可以把输入的字体显示在multi edit上了
GUI_StoreKeyMsg(c, 0); //把消息存进键盘缓冲器,松开状态
}
}
}
//数字键盘处理函数
//buttondata:数字键盘按钮参数
//Id:按钮ID
//*pMsg:指向消息
void numkeypad_process(BUTTON_DATA *buttondata,int Id,WM_MESSAGE *pMsg)
{
char c;
WM_MESSAGE Msg;
u8 KeyID;
KeyID=Id-ID_BUTTON;
if (buttondata[Id - ID_BUTTON].acLabel)
{
c = buttondata[Id - ID_BUTTON].acLabel[0];
if(KeyID == 19) //返回英文键盘
{
keypad_dev.padtype=ENGLISH_KEYPAD; //英文键盘
Msg.MsgId=CHANGE_NUMPADTO_ENGLISHPAD;
Msg.hWinSrc=pMsg->hWin;
WM_SendMessage(keypad_dev.hKeypad,&Msg);
}
else
{
GUI_StoreKeyMsg(c, 1); //把消息存进键盘缓冲器,按下状态
GUI_StoreKeyMsg(c, 0); //把消息存进键盘缓冲器,松开状态
}
}
}
//符号键盘处理函数
//buttondata:数字键盘按钮参数
//Id:按钮ID
//*pMsg:指向消息,即keypad键盘上按钮按下时传来的消息
void signkeypad_process(BUTTON_DATA *buttondata,int Id,WM_MESSAGE *pMsg)
{
char c;
WM_MESSAGE Msg;
u8 KeyID;
KeyID=Id-ID_BUTTON;
if (buttondata[Id - ID_BUTTON].acLabel)
{
c = buttondata[Id - ID_BUTTON].acLabel[0];
if(KeyID == 19) //返回到英文键盘
{
keypad_dev.padtype=ENGLISH_KEYPAD; //英文键盘
Msg.MsgId=CHANGE_SIGNPADTO_ENGLISHPAD;
Msg.hWinSrc=pMsg->hWin;
WM_SendMessage(keypad_dev.hKeypad,&Msg);
}
else if(KeyID == 14) //下一个符号键盘
{
if(keypad_dev.signpad_flag<(keypad_dev.signpad_num-1)) //初始化符号键盘的数量=2
{
keypad_dev.signpad_flag++; //符号键盘索引加一
Msg.MsgId=CHANGE_SIGNPAD;
Msg.hWinSrc=pMsg->hWin;
WM_SendMessage(keypad_dev.hKeypad,&Msg);
}
}
else if(KeyID == 9) //上一个符号键盘
{
if(keypad_dev.signpad_flag>0)
{
keypad_dev.signpad_flag--; //符号键盘索引减1
Msg.MsgId=CHANGE_SIGNPAD;
Msg.hWinSrc=pMsg->hWin;
WM_SendMessage(keypad_dev.hKeypad,&Msg);
}
}
else
{
GUI_StoreKeyMsg(c, 1); //把消息存进键盘缓冲器,按下状态
GUI_StoreKeyMsg(c, 0); //把消息存进键盘缓冲器,松开状态
}
}
}
//中文处理函数
//buttondata:数字键盘按钮参数
//Id:按钮ID
//*pMsg:指向消息
void chinesekeypad_process(BUTTON_DATA *buttondata,int Id,WM_MESSAGE *pMsg)
{ static WM_HWIN hEdit;
char c;
WM_MESSAGE Msg;
u8 key;
u8 KeyID;
u8 TempID;
u8 i=0;
KeyID=Id-ID_BUTTON; //Id-ID_BUTTON得到的是汉字按钮的ID号(也就是代表那个按钮按下了)
if (buttondata[Id - ID_BUTTON].acLabel) //如果按钮ID代表的字母不是空的
{
c = buttondata[Id - ID_BUTTON].acLabel[0]; //得到按钮代表的数字字符
if(KeyID == 3) //删除键
{
keypad_dev.cur_index=1; //当删除输入的拼音的时候,强制让索引为第一个 初始化时当前拼音索引=0
if(keypad_dev.inputlen) //汉字输入的长度不为0
{
keypad_dev.inputlen--;
keypad_dev.inputstr[keypad_dev.inputlen]='\0'; //添加结束符 因为在使用MULTIEDIT_AddText()函数向multiedit小工具发送显示的文本时需要在文本的结尾处加上NULL字符作为结束符
}
else //没有字符串输入
{
GUI_StoreKeyMsg(c, 1); //把消息存进键盘缓冲器,按下状态
GUI_StoreKeyMsg(c, 0); //把消息存进键盘缓冲器,松开状态
}
}else if(KeyID == 11) //按下的按钮是英文键盘
{
keypad_dev.padtype=ENGLISH_KEYPAD; //英文键盘
Msg.MsgId=CHANGE_CHINESEPADTO_ENGLISHPAD;
Msg.hWinSrc=pMsg->hWin;
WM_SendMessage(keypad_dev.hKeypad,&Msg); //切换到英文键盘
}else if(KeyID == 20) //拼音上一页
{
if(keypad_dev.pypagenum>0) //如果汉字对应的拼音页数没有显示完
{
if(keypad_dev.pynowpage>0)keypad_dev.pynowpage--; //记录当前输入字母对应的拼音的页数
else keypad_dev.pynowpage=0; //没有要显示的拼音了
}
}else if(KeyID == 24) //拼音下一页
{
if(keypad_dev.pypagenum>0)
{
if(keypad_dev.pynowpage<(keypad_dev.pypagenum-1)) keypad_dev.pynowpage++; //记录当前输入字母对应的拼音的页数
else keypad_dev.pynowpage=keypad_dev.pypagenum-1;
}
}else if(KeyID == 12) //汉字上一页
{
if(keypad_dev.dispagenum>0) //如果汉字的总页数不为0,也就是还有要显示的汉字
{
if(keypad_dev.dispagecur>0) keypad_dev.dispagecur--; //记录当前选中的汉字的页数
else keypad_dev.dispagecur=0; //没有可显示的汉字了
}
}else if(KeyID == 19) //汉字下一页
{
if(keypad_dev.dispagenum>0)
{
if(keypad_dev.dispagecur<(keypad_dev.dispagenum-1)) keypad_dev.dispagecur++; //记录当前选中的汉字的显示页数
else keypad_dev.dispagecur=keypad_dev.dispagenum-1;
}
}else if((KeyID > 12) && (KeyID < 19)) //横排,该部分是显示拼音对应的汉字
{
TempID=KeyID-12;
TempID=TempID+6*keypad_dev.dispagecur; //得到当前的汉字索引, 12到19之间一共有6个所以有某个汉字ID+6*当前选中的汉字所在的页数,就是当前选中的汉字按键的ID号
if(TempID<=keypad_dev.hznum) //如果选中的汉字ID小于拼音对应的汉字数量,表示所选汉字有效
{
keypad_dev.cur_hz=keypad_dev.butname[(KeyID-12)-1]; //获得选中的汉字, KeyID在12到19之间一共有6个所以有六个汉字 keypad_dev.butname是在 keypad_hbtn_updc()函数中得到的存放的是在横向六个按钮中的汉字 ?
if(keypad_dev.cur_hz != NULL)
{
hEdit=WM_GetDialogItem(hWin_Main,MULTIEDIT_ID_Storage); //得到选中的EDIT的窗口句柄
MULTIEDIT_EnableBlink(hEdit,500,1); //开启光标,周期500ms
MULTIEDIT_SetInsertMode(hEdit,1); //开启插入模式
MULTIEDIT_SetFont(hEdit, &GUI_FontHZ16);
WM_SetFocus(hEdit); //将输入焦点设置到多行文本小工具
MULTIEDIT_AddText(hEdit,(const char*)keypad_dev.cur_hz); //在多行文本中显示选中的汉字 ,在创建一个multi edit(多行文本小工具)时,已将输入焦点设置到多行文本小工具,在这里就可以把输入的字体显示在multi edit上了,
} //初始化时把multi edit的窗口句柄付给了hMulti
keypad_dev.result_num=0; //拼音匹配的数量设置为0
keypad_dev.dispagecur=0; //记录选中汉字的页数为0
keypad_dev.dispagenum=0; //拼音匹配的汉字总的页数
keypad_dev.cur_index=0; //当前拼音的索引
keypad_dev.pynowpage=0; //当前输入字母对应的拼音的页数
keypad_dev.pypagenum=0; //输入的字母对应拼音的总页数
keypad_dev.inputlen=0; //记录汉字输入的长度
for(i=0;i<7;i++) keypad_dev.inputstr[i]=0; //输入清零
}
}else if((KeyID > 20) && (KeyID <24)) //竖排,该部分显示输入的拼音
{
TempID=KeyID-20;
TempID=TempID+3*keypad_dev.pynowpage; //得到当前的拼音索引 20到23之间一共有3个拼音,所以有某个拼音ID+3*当前选中的拼音所在的页数,就是当前选中的拼音按键的ID号
if(TempID<=keypad_dev.result_num) //如果拼音的索引等于小于拼音的匹配数,表示所选拼音有效
{
keypad_dev.cur_index=TempID; //按下的拼音ID付给当前拼音索引
keypad_dev.dispagecur=0; //记录选中汉字的页数为0
keypad_dev.dispagenum=0; //拼音匹配的汉字总的页数
}
}
else
{
if((c == ';')||(c == ' ')) //如果在中文输入里面按下的是;或者是└┘(空格)键
{
GUI_StoreKeyMsg(c, 1); //把消息存进键盘缓冲器,按下状态
GUI_StoreKeyMsg(c, 0); //把消息存进键盘缓冲器,松开状态
}else
{
keypad_dev.inputstr[keypad_dev.inputlen]=c+'\0'; //输入字符 把数字字符放到输入字符串中,最后添加结束符 (因为在使用MULTIEDIT_AddText()函数向multiedit小工具发送显示的文本时需要在文本的结尾处加上NULL字符作为结束符)
if(keypad_dev.inputlen<6)keypad_dev.inputlen++; //最多可以输入6个数字字符,输入字符的数量加1
}
}
if((keypad_dev.inputstr[0])!=NULL) // '\0'就是NULL 第一个字符不是NULL表示有数字字符输入了
{
key=t9.getpymb(keypad_dev.inputstr); //得到匹配的结果数
if(key) //有部分匹配/完全匹配的结果
{
keypad_dev.result_num=key&0X7F; //总匹配结果
if((keypad_dev.sta&0X80)==0)
{
keypad_dev.sta|=0X80;
keypad_dev.cur_index=1; //默认第一个索引
}
if(key&0x80) //部分匹配 key的第7位=1,表示部分匹配 key第7位=0表示完全匹配
{
keypad_dev.inputlen = key&0x7f; //有效匹配位数
keypad_dev.inputstr[keypad_dev.inputlen]='\0'; //不匹配的位数去掉 假设输入的数字字符串是"2645"在pymb.h中的数组py_index3[]中的第一个元素没有这个字符串的最后一位,这里就会把最后一位去掉变成"264\0"
if(keypad_dev.inputlen>1)keypad_dev.result_num=t9.getpymb(keypad_dev.inputstr);//重新获取完全匹配字符数 ,因为把不匹配的数字字符去掉了,所以现在得到的一定是完全匹配的字符数
}
}else //完全不匹配
{
keypad_dev.inputlen--;
keypad_dev.inputstr[keypad_dev.inputlen]='\0';
}
}else //没有数字字符输入
{
keypad_dev.sta&=0x7f;
keypad_dev.cur_index=0; //清零
keypad_dev.result_num=0;
keypad_dev.dispagecur=0;
keypad_dev.dispagenum=0;
keypad_dev.pynowpage=0;
keypad_dev.pypagenum=0;
}
if(keypad_dev.result_num&0x80) keypad_dev.result_num=1; //如果是部分匹配,拼音匹配的数目是1
Msg.MsgId=CHANGE_CHINESE_PY;
Msg.hWinSrc=pMsg->hWin;
WM_SendMessage(keypad_dev.hKeypad,&Msg);//参数是:软键盘(keypad)的窗口句柄和发给keypad的消息,这时系统就会调用_cbKeyPad函数处理keypad接收到的消息。 软键盘(keypad)的窗口句柄是在初始化时keypad_demo()函数里面创建keypad是付给keypad_dev.hKeypad的
}
}
//设置BUTTON要使用的皮肤
static int _DrawSkinFlex_BUTTON(const WIDGET_ITEM_DRAW_INFO * pDrawItemInfo)
{
static GUI_MEMDEV_Handle ahMemEdges[4];
GUI_MEMDEV_Handle hMem;
WM_HWIN hWin;
unsigned i;
int xPos;
int yPos;
int xSize;
int ySize;
int x;
int y;
int Id;
int IsPressed;
int butheigh;
void (* pfDraw)(WM_HWIN hWin);
x = 0;
y = 0;
switch (pDrawItemInfo->Cmd)
{
case WIDGET_ITEM_CREATE:
if (ahMemEdges[0] == 0)
{
//创建一个小的帮助窗口,但是不可见
hWin = WM_CreateWindowAsChild(0, 0, 16, 16, WM_HBKWIN, WM_CF_SHOW | WM_CF_STAYONTOP, NULL, 0);
WM_SelectWindow(hWin);
//为button的每个边缘创建存储设备
for (i = 0; i < GUI_COUNTOF(ahMemEdges); i++)
{
switch (i)
{
case 0:
x = 0;
y = 0;
break;
case 1:
x = -16;
y = 0;
break;
case 2:
x = -16;
y = -16;
break;
case 3:
x = 0;
y = -16;
break;
}
//创建放大设备
hMem = GUI_MEMDEV_CreateFixed(0, 0, 16, 16, GUI_MEMDEV_NOTRANS, GUI_MEMDEV_APILIST_32, GUI_COLOR_CONV_8888);
GUI_MEMDEV_Select(hMem);
GUI_SetBkColor(GUI_TRANSPARENT);
GUI_Clear();
GUI_SetColor(COLOR_BORDER);
GUI_DrawRoundedFrame(x, y, x + 31, y + 31, 16, 4); //绘制换肤后的按钮四角的圆弧
//收缩到指定的大小
ahMemEdges[i] = GUI_MEMDEV_CreateFixed(0, 0, 4, 4, GUI_MEMDEV_NOTRANS, GUI_MEMDEV_APILIST_32, GUI_COLOR_CONV_8888);
GUI_MEMDEV_Select(ahMemEdges[i]);
GUI_SetBkColor(GUI_TRANSPARENT);
GUI_Clear();
GUI_MEMDEV_RotateHQ(hMem, ahMemEdges[i], -6, -6, 0, 250);
GUI_MEMDEV_Delete(hMem);
GUI_MEMDEV_Select(0);
}
WM_DeleteWindow(hWin);
}
break;
case WIDGET_ITEM_DRAW_TEXT:
//在按钮上显示自定义或者默认的颜色或者文本
hWin = pDrawItemInfo->hWin;
Id = WM_GetId(hWin);
i = Id - ID_BUTTON;
if(keypad_dev.padtype==ENGLISH_KEYPAD) pfDraw = _aEngButtonData[i].pfDraw;
else if(keypad_dev.padtype==NUMBER_KEYPAD) pfDraw = _aNumButtonData[i].pfDraw;
else if(keypad_dev.padtype==SIGN_KEYPAD) pfDraw = _aSinButtonData[keypad_dev.signpad_flag][i].pfDraw;
else if(keypad_dev.padtype==CHINESE_KEYPAD) pfDraw = _aChineseButtonData1[i].pfDraw;
if (pfDraw) pfDraw(hWin);
else BUTTON_DrawSkinFlex(pDrawItemInfo);
break;
case WIDGET_ITEM_DRAW_BACKGROUND:
//绘制按钮的背景
IsPressed = BUTTON_IsPressed(pDrawItemInfo->hWin); //判断是否按钮是否被按下
xPos = WM_GetWindowOrgX(pDrawItemInfo->hWin); //获取按钮小工具的X方向原点位置
yPos = WM_GetWindowOrgY(pDrawItemInfo->hWin); //获取按钮小工具的Y方向原点位置
xSize = WM_GetWindowSizeX(pDrawItemInfo->hWin); //获取按钮小工具的X大小
ySize = WM_GetWindowSizeY(pDrawItemInfo->hWin); //获取按钮小工具的Y大小
if (IsPressed) //如果按钮被按下
{
GUI_DrawGradientRoundedV(0, 0, xSize - 1, ySize - 1, 4, BUTTON_COLOR2, BUTTON_COLOR3);//绘制垂直颜色梯度填充的圆角矩形
}
else
{
GUI_DrawGradientRoundedV(0, 0, xSize - 1, ySize - 1, 4, BUTTON_COLOR0, BUTTON_COLOR1);//绘制垂直颜色梯度填充的圆角矩形
}
GUI_SetColor(COLOR_BORDER);
//绘制按钮的四条边界
GUI_DrawHLine( 0, 4, xSize - 5);
GUI_DrawHLine(ySize - 1, 4, xSize - 5);
GUI_DrawVLine( 0, 4, ySize - 5);
GUI_DrawVLine(xSize - 1, 4, ySize - 5);
//将给定存储设备的内容写入当前选定存储设备的制定位置
if(keypad_dev.padtype==CHINESE_KEYPAD) butheigh = 77;
else butheigh = 68;
GUI_MEMDEV_WriteAt(ahMemEdges[0], xPos + 0, yPos + 0); //按钮左上角圆弧
GUI_MEMDEV_WriteAt(ahMemEdges[1], xPos + xSize - 4, yPos + 0); //按钮右上角圆弧
GUI_MEMDEV_WriteAt(ahMemEdges[2], xPos + xSize - 4, yPos + butheigh); //按钮右下角圆弧
GUI_MEMDEV_WriteAt(ahMemEdges[3], xPos + 0, yPos + butheigh); //按钮左下角圆弧
break;
default:
return BUTTON_DrawSkinFlex(pDrawItemInfo);//其他命令就使用默认的皮肤
}
return 0;
}
//设置中文键盘要使用的皮肤
static int _DrawChineseSkin_BUTTON(const WIDGET_ITEM_DRAW_INFO * pDrawItemInfo)
{
WM_HWIN hWin;
unsigned i;
int xSize;
int ySize;
int Id;
int IsPressed;
void (* pfDraw)(WM_HWIN hWin);
switch (pDrawItemInfo->Cmd)
{
case WIDGET_ITEM_DRAW_TEXT:
//在按钮上显示自定义或者默认的颜色或者文本
hWin = pDrawItemInfo->hWin;
Id = WM_GetId(hWin);
i = Id - ID_BUTTON;
pfDraw = _aChineseButtonData1[i].pfDraw;
if (pfDraw) pfDraw(hWin);
else BUTTON_DrawSkinFlex(pDrawItemInfo);
break;
case WIDGET_ITEM_DRAW_BACKGROUND:
//绘制按钮的背景
IsPressed = BUTTON_IsPressed(pDrawItemInfo->hWin); //判断是否按钮是否被按下
xSize = WM_GetWindowSizeX(pDrawItemInfo->hWin); //获取按钮小工具的X大小
ySize = WM_GetWindowSizeY(pDrawItemInfo->hWin); //获取按钮小工具的Y大小
if (IsPressed) //如果按钮被按下
{
GUI_DrawGradientV(0,0,xSize-1,ySize-1,BUTTON_COLOR2,BUTTON_COLOR3);
}
else
{
GUI_DrawGradientV(0,0,xSize-1,ySize-1,GUI_WHITE,GUI_WHITE);
}
GUI_SetColor(COLOR_BORDER);
//绘制按钮的四条边界
GUI_DrawHLine( 0, 0, xSize - 1);
GUI_DrawHLine(ySize - 1, 0, xSize - 1);
GUI_DrawVLine( 0, 0, ySize - 1);
GUI_DrawVLine(xSize - 1, 0, ySize - 1);
break;
default:
return BUTTON_DrawSkinFlex(pDrawItemInfo);//其他命令就使用默认的皮肤
}
return 0;
}
//更新横向的6个显示汉字的按钮 参数就是拼音对应汉字字符串的首地址
void keypad_hbtn_updc(u8* str)
{
vu8 i=0;
if((keypad_dev.dispagecur>=keypad_dev.dispagenum)&&keypad_dev.dispagenum)return; //当前页等于或者大于总页数
for(i=0;i<6;i++) keypad_dev.butname[i]=NULL; //先把按钮的名字清空
i=0;
for(i=0;i<6;i++)
{
if((i+6*(keypad_dev.dispagecur))>(keypad_dev.hznum-1)) //超出相应拼音的汉字字数 每页可以显示6个汉字,如果这一行显示不完6个,就在没有显示的地方什么也不显示
{
keypad_dev.disbuf[i][0]=' ';
keypad_dev.disbuf[i][1]=' ';
keypad_dev.disbuf[i][2]='\0';
keypad_dev.butname[i]=keypad_dev.disbuf[i];
}else //提取汉字
{
keypad_dev.disbuf[i][0]=*str++; //将pymb.h中的py_index3[]数组中某元素的第三项汉字字符串对应的值赋给横向按钮缓存
keypad_dev.disbuf[i][1]=*str++;
keypad_dev.disbuf[i][2]='\0';
keypad_dev.butname[i]=keypad_dev.disbuf[i]; //keypad_dev.butname[]存放的是在横向六个按钮中的汉字
}
}
}
//绘制横向的6个按钮
void keypad_draw_hbtn(WM_HWIN *handle)
{
u8 i;
for(i=0;i<6;i++)
{
BUTTON_SetFont(handle[13+i],&GUI_FontHZ24); //因为中文键盘BUTTON_DATA _aChineseButtonData[]是从13开始存放汉字的,这里就是从第13个按钮句柄开始设置字体
BUTTON_SetText(handle[13+i],(char*)keypad_dev.butname[i]); //在横排六个空格中显示拼音对应的汉字
}
}
//keypad窗口调用的回调函数
static void _cbKeyPad(WM_MESSAGE * pMsg)
{
WM_HWIN hWin;
int Id;
int NCode;
int xSize;
int ySize;
u16 slen;
unsigned i;
hWin = pMsg->hWin; //得到keypad的窗口句柄
switch (pMsg->MsgId) //keypad上的消息类型
{
case WM_CREATE: //此消息在窗口创建后立即发送,使窗口可以初始化并创建任何子窗口
drawenglish_pad(hWin); //创建英文键盘
break;
case WM_PAINT: //窗口变为无效时重绘背景窗口
//绘制背景
xSize = WM_GetWindowSizeX(hWin);
ySize = WM_GetWindowSizeY(hWin);
GUI_SetColor(COLOR_BORDER);
GUI_DrawRect(0, 0, xSize - 1, ySize - 1);
GUI_DrawGradientV(1, 1, xSize - 2, ySize - 2, COLOR_KEYPAD0, COLOR_KEYPAD1); //绘制用垂直颜色梯度填充的矩形
break;
case WM_NOTIFY_PARENT: //告诉父窗口,子窗口发生了改变
//向当前焦点窗口发送按键消息
Id = WM_GetId(pMsg->hWinSrc); //得到keypad窗口上的小工具窗口ID号,也就是得到按下的那个按钮的ID
NCode = pMsg->Data.v; //得到按钮的状态
switch (NCode)
{
case WM_NOTIFICATION_RELEASED: //按钮被释放
if(keypad_dev.padtype==ENGLISH_KEYPAD) //如果当前是英文键盘
{
engkeypad_process(_aEngButtonData,Id,pMsg); //处理英文键盘
}
else if(keypad_dev.padtype==NUMBER_KEYPAD) //如果当前是数字键盘
{
numkeypad_process(_aNumButtonData,Id,pMsg); //处理数字键盘
}
else if(keypad_dev.padtype==SIGN_KEYPAD) //如果当前是符号键盘
{
signkeypad_process(_aSinButtonData[keypad_dev.signpad_flag],Id,pMsg); //初始化符号键盘索引=0
}
else if(keypad_dev.padtype==CHINESE_KEYPAD) //如果当前是中文键盘
{
chinesekeypad_process(_aChineseButtonData1,Id,pMsg);
}
break;
}
break;
case CHANGE_ENGLISHPADTO_NUMPAD: //从英文键盘切换到数字键盘
for(i=0;i<GUI_COUNTOF(_aEngButtonData);i++) WM_DeleteWindow(keypad_dev.EngButton_Handle[i]); //删除英文键盘
for(i=0;i<GUI_COUNTOF(_aEngButtonData);i++) keypad_dev.EngButton_Handle[i]=0; //所有英文字符按钮上的窗口句柄为0
drawnumber_pad(hWin); //创建数字键盘
break;
case CHANGE_NUMPADTO_ENGLISHPAD: //从数字键盘切换到英文键盘
for(i=0;i<GUI_COUNTOF(_aNumButtonData);i++) WM_DeleteWindow(keypad_dev.NumButton_Handle[i]);
for(i=0;i<GUI_COUNTOF(_aEngButtonData);i++) keypad_dev.NumButton_Handle[i]=0;
drawenglish_pad(hWin);
break;
case CHANGE_ENGLISHPADTO_SIGNPAD1: //从英文键盘切换到符号键盘
for(i=0;i<GUI_COUNTOF(_aEngButtonData);i++) WM_DeleteWindow(keypad_dev.EngButton_Handle[i]);
for(i=0;i<GUI_COUNTOF(_aEngButtonData);i++) keypad_dev.SignButton_Handle[i]=0;
drawsign_pad(hWin);
break;
case CHANGE_SIGNPADTO_ENGLISHPAD: //从符号键盘切换到英文键盘
for(i=0;i<GUI_COUNTOF(_aSinButtonData[keypad_dev.signpad_flag]);i++) WM_DeleteWindow(keypad_dev.SignButton_Handle[i]);
for(i=0;i<GUI_COUNTOF(_aSinButtonData[keypad_dev.signpad_flag]);i++) keypad_dev.SignButton_Handle[i]=0;
drawenglish_pad(hWin);
break;
case CHANGE_SIGNPAD: //切换符号键盘
for(i=0;i<GUI_COUNTOF(_aSinButtonData[keypad_dev.signpad_flag]);i++) WM_DeleteWindow(keypad_dev.SignButton_Handle[i]);
for(i=0;i<GUI_COUNTOF(_aSinButtonData[keypad_dev.signpad_flag]);i++) keypad_dev.SignButton_Handle[i]=0;
drawsign_pad(hWin);
break;
case CHANGE_ENGLISHPADTO_CHINESEPAD: //从英文键盘切换到中文键盘
for(i=0;i<GUI_COUNTOF(_aEngButtonData);i++) WM_DeleteWindow(keypad_dev.EngButton_Handle[i]);
for(i=0;i<GUI_COUNTOF(_aEngButtonData);i++) keypad_dev.EngButton_Handle[i]=0;
drawchinese1_pad(hWin);
drawchinese2_pad(hWin);
break;
case CHANGE_CHINESEPADTO_ENGLISHPAD: //从中文键盘切换到英文键盘
for(i=0;i<25;i++) WM_DeleteWindow(keypad_dev.ChineseButton_Handle[i]);
for(i=0;i<25;i++) keypad_dev.ChineseButton_Handle[i]=0;
memset(keypad_dev.inputstr,0,7); //清零
keypad_dev.cur_index=0;
keypad_dev.inputlen=0;
keypad_dev.result_num=0;
keypad_dev.pypagenum=0;
keypad_dev.pynowpage=0;
keypad_dev.dispagecur=0;
keypad_dev.dispagenum=0;
keypad_dev.sta=0;
drawenglish_pad(hWin);
break;
case WM_DELETE: //在英文键盘界面按下了OK键,就隐藏英文键盘界面
WM_HideWindow( hwin_keypad ); //隐藏英文键盘
for(i=0;i<GUI_COUNTOF(_aEngButtonData);i++) keypad_dev.EngButton_Handle[i]=0;
GUI_Delay(1);
break;
case CHANGE_CHINESE_PY: //显示九宫格输入的拼音选项
if(keypad_dev.cur_index>0) //keypad_dev.curindex>0说明有拼音选中
{
keypad_dev.disstr=t9.pymb[keypad_dev.cur_index-1]->pymb; //获得当前码表 ,就是得到选中拼音对应的汉字在(pymb.h中的py_index3[]数组中某元素的第三项汉字字符串) keypad_dev.cur_index是当前在竖排3个拼音选项中选中的拼音索引
slen=strlen((const char*)keypad_dev.disstr); //得到当前选中的拼音对应的汉字字符串的长度
keypad_dev.hznum=slen/2; //得到拼音对应的汉字数量 因为是中文,每个字视为2个字符。
}else //没有拼音选中
{
keypad_dev.disstr=NULL;
slen=0;
keypad_dev.hznum=0;
}
keypad_dev.dispagenum=keypad_dev.hznum/6+(keypad_dev.hznum%6?1:0); //得到汉字字符串的总页数 ,因为每一页横排可以显示6个。所以选中的拼音对应的汉字数量除以6+除6的于数,就是求pymb.h中的py_index3[]的第三个元素包含的汉字可以在屏幕上显示的页数
keypad_dev.pypagenum=keypad_dev.result_num/3+(keypad_dev.result_num%3?1:0); //得到拼音页数 ,同理竖排拼音一页可以显示3个,这里是求拼音可以显示的页数
if(keypad_dev.inputstr[0]!=NULL) //有拼音输入了
{
for(i=0;i<3;i++)
{
BUTTON_SetFont(keypad_dev.ChineseButton_Handle[21+i],&GUI_FontHZ24);//输入的竖排拼音中的3个选项_aChineseButtonData2[]中的ID号是从21开始的
if((i+3*(keypad_dev.pynowpage))>(keypad_dev.result_num-1)) // 假设选中的数字字符是“264”,那么现在拼音匹配的数目keypad_dev.result_num是3。 如果当前数字字符对应的拼音页数大于拼音匹配的数目-1
{
BUTTON_SetText(keypad_dev.ChineseButton_Handle[21+i]," ");//说明竖排没有可以显示的拼音了,就什么也不显示
}else
{
BUTTON_SetText(keypad_dev.ChineseButton_Handle[21+i],(const char*)t9.pymb[i+3*(keypad_dev.pynowpage)]->py);//在竖排3个地方显示拼音
}
}
keypad_hbtn_updc(keypad_dev.disstr+(keypad_dev.dispagecur*6*2));//更新横向按钮名字 就是把汉字对应的编码放在keypad_dev.butname[]里 参数:横向显示的字符串指针(在pymb.h中的py_index3[]的第三个元素)+当前汉字显示的页数*6(因为每页有6个汉字)*2(因为汉字占两个字符) ,参数就是拼音对应汉字字符串的首地址
keypad_draw_hbtn(keypad_dev.ChineseButton_Handle); //绘制横向按钮
}else //没有输入任何拼音 就在竖排和横排中什么也不显示
{
for(i=0;i<3;i++)
{
BUTTON_SetFont(keypad_dev.ChineseButton_Handle[21+i],&GUI_FontHZ24);
BUTTON_SetText(keypad_dev.ChineseButton_Handle[21+i]," ");
}
for(i=0;i<6;i++)
{
keypad_dev.disbuf[i][0]=' ';
keypad_dev.disbuf[i][1]=' ';
keypad_dev.disbuf[i][2]='\0';
keypad_dev.butname[i]=keypad_dev.disbuf[i];
}
keypad_draw_hbtn(keypad_dev.ChineseButton_Handle); //绘制横向按钮
}
break;
}
}
//子窗口的背景窗口回调函数
static void _cbBk(WM_MESSAGE * pMsg)
{
switch (pMsg->MsgId)
{
case WM_PAINT:
GUI_DrawGradientV(0, 0,lcddev.width,lcddev.height, COLOR_BACK0, COLOR_BACK1);
break;
}
}
void keypad_Create(void)
{
WM_HWIN hFrame;
//WM_SetCallback(WM_HBKWIN, _cbBk); //是指keypad这个子窗口的背景窗口回调函数
//初始化软键盘结构体的参数
keypad_dev.xpos=320; //初始化软键盘X坐标=320
keypad_dev.ypos=(lcddev.height*3)/10; //初始化软键盘Y坐标是屏幕的3/10 也就是软键盘在屏幕的下方3/10处显示
keypad_dev.width=lcddev.width-((lcddev.width *4)/10); //初始化软键盘的宽度=屏幕的宽度6/10
keypad_dev.height=lcddev.height-((lcddev.height*3)/10); //初始化软键盘的高度是屏幕的7/10
keypad_dev.padtype=ENGLISH_KEYPAD; //初始化默认为英文键盘
keypad_dev.signpad_flag=0; //初始化符号键盘索引=0
keypad_dev.signpad_num=2; //初始化符号键盘的数量=2
keypad_dev.inputlen=0; //初始化输入长度=0
keypad_dev.pynowpage=0; //初始化当前选中的拼音页=0
keypad_dev.cur_index=0; //初始化当前拼音索引=0
keypad_dev.sta=0; //初始化记录输入法是中文输入法
//设置keypad所使用的按钮的皮肤
BUTTON_SetDefaultSkin(_DrawSkinFlex_BUTTON); //设置BUTTON的皮肤
//创建keypad 创建一个子窗口:子窗口的X位置=0,Y位置在屏的3/10处,子窗口的宽度=屏的宽度,高度=屏的7/10,窗口的父窗口句柄是背景窗口,创建后立即展示、确保子窗口停留在所有不用此标记创建的同属窗口的顶部,窗口的回调函数是_cbKeyPad,要分配的额外字节数是0
keypad_dev.hKeypad = WM_CreateWindowAsChild(keypad_dev.xpos,keypad_dev.ypos,keypad_dev.width,keypad_dev.height, WM_HBKWIN, WM_CF_SHOW | WM_CF_STAYONTOP, _cbKeyPad, 0); //创建的子窗口的句柄作为软键盘keypad的窗口句柄
hwin_keypad = keypad_dev.hKeypad;
while(1)
{
GUI_Delay(100);
}
}
static const GUI_WIDGET_CREATE_INFO _aDialogCreate[] = {
{ FRAMEWIN_CreateIndirect, "Framewin", ID_FRAMEWIN_0, 0, 0, 800, 480, 0, 0x64, 0 },
{ CHECKBOX_CreateIndirect, "Checkbox", ID_CHECKBOX_0, 0, 0, 35, 37, 0, 0x0, 0 },
{ CHECKBOX_CreateIndirect, "Checkbox", ID_CHECKBOX_1, 0, 37, 35, 37, 0, 0x0, 0 },
{ CHECKBOX_CreateIndirect, "Checkbox", ID_CHECKBOX_2, 0, 74, 35, 37, 0, 0x0, 0 },
{ CHECKBOX_CreateIndirect, "Checkbox", ID_CHECKBOX_3, 0, 111, 35, 37, 0, 0x0, 0 },
{ CHECKBOX_CreateIndirect, "Checkbox", ID_CHECKBOX_4, 0, 148, 35, 37, 0, 0x0, 0 },
{ CHECKBOX_CreateIndirect, "Checkbox", ID_CHECKBOX_5, 0, 185, 35, 37, 0, 0x0, 0 },
{ CHECKBOX_CreateIndirect, "Checkbox", ID_CHECKBOX_6, 0, 222, 35, 37, 0, 0x0, 0 },
{ CHECKBOX_CreateIndirect, "Checkbox", ID_CHECKBOX_7, 0, 259, 35, 37, 0, 0x0, 0 },
{ CHECKBOX_CreateIndirect, "Checkbox", ID_CHECKBOX_8, 0, 296, 35, 37, 0, 0x0, 0 },
{ CHECKBOX_CreateIndirect, "Checkbox", ID_CHECKBOX_9, 0, 333, 35, 37, 0, 0x0, 0 },
{ CHECKBOX_CreateIndirect, "Checkbox", ID_CHECKBOX_10, 0, 370, 35, 37, 0, 0x0, 0 },
{ CHECKBOX_CreateIndirect, "Checkbox", ID_CHECKBOX_11, 0, 407, 35, 37, 0, 0x0, 0 },
{ CHECKBOX_CreateIndirect, "Checkbox", ID_CHECKBOX_12, 160, 0, 35, 37, 0, 0x0, 0 },
{ CHECKBOX_CreateIndirect, "Checkbox", ID_CHECKBOX_13, 160, 37, 35, 37, 0, 0x0, 0 },
{ CHECKBOX_CreateIndirect, "Checkbox", ID_CHECKBOX_14, 160, 74, 35, 37, 0, 0x0, 0 },
{ CHECKBOX_CreateIndirect, "Checkbox", ID_CHECKBOX_15, 160, 111, 35, 37, 0, 0x0, 0 },
{ CHECKBOX_CreateIndirect, "Checkbox", ID_CHECKBOX_16, 160, 148, 35, 37, 0, 0x0, 0 },
{ CHECKBOX_CreateIndirect, "Checkbox", ID_CHECKBOX_17, 160, 185, 35, 37, 0, 0x0, 0 },
{ CHECKBOX_CreateIndirect, "Checkbox", ID_CHECKBOX_18, 160, 222, 35, 37, 0, 0x0, 0 },
{ CHECKBOX_CreateIndirect, "Checkbox", ID_CHECKBOX_19, 160, 259, 35, 37, 0, 0x0, 0 },
{ CHECKBOX_CreateIndirect, "Checkbox", ID_CHECKBOX_20, 160, 296, 35, 37, 0, 0x0, 0 },
{ CHECKBOX_CreateIndirect, "Checkbox", ID_CHECKBOX_21, 160, 333, 35, 37, 0, 0x0, 0 },
{ CHECKBOX_CreateIndirect, "Checkbox", ID_CHECKBOX_22, 160, 370, 35, 37, 0, 0x0, 0 },
{ CHECKBOX_CreateIndirect, "Checkbox", ID_CHECKBOX_23, 160, 407, 35, 37, 0, 0x0, 0 },
{ MULTIEDIT_CreateIndirect, "Multiedit", ID_MULTIEDIT_0, 36, 0, 115, 37, 0, 0x64, 0 },
{ MULTIEDIT_CreateIndirect, "Multiedit", ID_MULTIEDIT_1, 36, 37, 115, 37, 0, 0x64, 0 },
{ MULTIEDIT_CreateIndirect, "Multiedit", ID_MULTIEDIT_2, 36, 74, 115, 37, 0, 0x64, 0 },
{ MULTIEDIT_CreateIndirect, "Multiedit", ID_MULTIEDIT_3, 36, 111, 115, 37, 0, 0x64, 0 },
{ MULTIEDIT_CreateIndirect, "Multiedit", ID_MULTIEDIT_4, 36, 148, 115, 37, 0, 0x64, 0 },
{ MULTIEDIT_CreateIndirect, "Multiedit", ID_MULTIEDIT_5, 36, 185, 115, 37, 0, 0x64, 0 },
{ MULTIEDIT_CreateIndirect, "Multiedit", ID_MULTIEDIT_6, 36, 222, 115, 37, 0, 0x64, 0 },
{ MULTIEDIT_CreateIndirect, "Multiedit", ID_MULTIEDIT_7, 36, 259, 115, 37, 0, 0x64, 0 },
{ MULTIEDIT_CreateIndirect, "Multiedit", ID_MULTIEDIT_8, 36, 296, 115, 37, 0, 0x64, 0 },
{ MULTIEDIT_CreateIndirect, "Multiedit", ID_MULTIEDIT_9, 36, 333, 115, 37, 0, 0x64, 0 },
{ MULTIEDIT_CreateIndirect, "Multiedit", ID_MULTIEDIT_10,36, 370, 115, 37, 0, 0x64, 0 },
{ MULTIEDIT_CreateIndirect, "Multiedit", ID_MULTIEDIT_11, 36, 407, 115, 37, 0, 0x64, 0 },
{ MULTIEDIT_CreateIndirect, "Multiedit", ID_MULTIEDIT_12, 196, 0, 115, 37, 0, 0x64, 0 },
{ MULTIEDIT_CreateIndirect, "Multiedit", ID_MULTIEDIT_13, 196, 37, 115, 37, 0, 0x64, 0 },
{ MULTIEDIT_CreateIndirect, "Multiedit", ID_MULTIEDIT_14, 196, 74, 115, 37, 0, 0x64, 0 },
{ MULTIEDIT_CreateIndirect, "Multiedit", ID_MULTIEDIT_15, 196, 111, 115, 37, 0, 0x64, 0 },
{ MULTIEDIT_CreateIndirect, "Multiedit", ID_MULTIEDIT_16, 196, 148, 115, 37, 0, 0x64, 0 },
{ MULTIEDIT_CreateIndirect, "Multiedit", ID_MULTIEDIT_17, 196, 185, 115, 37, 0, 0x64, 0 },
{ MULTIEDIT_CreateIndirect, "Multiedit", ID_MULTIEDIT_18, 196, 222, 115, 37, 0, 0x64, 0 },
{ MULTIEDIT_CreateIndirect, "Multiedit", ID_MULTIEDIT_19, 196, 259, 115, 37, 0, 0x64, 0 },
{ MULTIEDIT_CreateIndirect, "Multiedit", ID_MULTIEDIT_20, 196, 296, 115, 37, 0, 0x64, 0 },
{ MULTIEDIT_CreateIndirect, "Multiedit", ID_MULTIEDIT_21, 196, 333, 115, 37, 0, 0x64, 0 },
{ MULTIEDIT_CreateIndirect, "Multiedit", ID_MULTIEDIT_22, 196, 370, 115, 37, 0, 0x64, 0 },
{ MULTIEDIT_CreateIndirect, "Multiedit", ID_MULTIEDIT_23, 196, 407, 115, 37, 0, 0x64, 0 },
{ BUTTON_CreateIndirect, "Button1", ID_BUTTON_0, 318, 40, 118, 80, 0, 0x0, 0 },
{ BUTTON_CreateIndirect, "Button2", ID_BUTTON_1, 436, 40, 118, 80, 0, 0x0, 0 },
{ BUTTON_CreateIndirect, "Button3", ID_BUTTON_2, 554, 40, 118, 80, 0, 0x0, 0 },
{ BUTTON_CreateIndirect, "Button4", ID_BUTTON_3, 672, 40, 118, 80, 0, 0x0, 0 },
{ BUTTON_CreateIndirect, "Button5", ID_BUTTON_4, 318, 160, 118, 80, 0, 0x0, 0 },
{ BUTTON_CreateIndirect, "Button6", ID_BUTTON_5, 436, 160, 118, 80, 0, 0x0, 0 },
{ BUTTON_CreateIndirect, "Button7", ID_BUTTON_6, 554, 160, 118, 80, 0, 0x0, 0 },
{ BUTTON_CreateIndirect, "Button8", ID_BUTTON_7, 672, 160, 118, 80, 0, 0x0, 0 },
{ BUTTON_CreateIndirect, "Button9", ID_BUTTON_8, 318, 280, 118, 80, 0, 0x0, 0 },
{ BUTTON_CreateIndirect, "Button10", ID_BUTTON_9, 436, 280, 118, 80, 0, 0x0, 0 },
{ BUTTON_CreateIndirect, "Button11", ID_BUTTON_10, 554, 280, 118, 80, 0, 0x0, 0 },
{ BUTTON_CreateIndirect, "Button12", ID_BUTTON_11, 672, 280, 118, 80, 0, 0x0, 0 },
{ BUTTON_CreateIndirect, "SEND", ID_BUTTON_12, 488, 370, 140, 70, 0, 0x0, 0 },
{ TEXT_CreateIndirect, "Text1", ID_TEXT_0, 318, 15, 118, 20, 0, 0x0, 0 },
{ TEXT_CreateIndirect, "Text2", ID_TEXT_1, 436, 15, 118, 20, 0, 0x0, 0 },
{ TEXT_CreateIndirect, "Text3", ID_TEXT_2, 554, 15, 118, 20, 0, 0x0, 0 },
{ TEXT_CreateIndirect, "Text4", ID_TEXT_3, 672, 15, 118, 20, 0, 0x0, 0 },
{ TEXT_CreateIndirect, "Text5", ID_TEXT_4, 318, 135, 118,20, 0, 0x0, 0 },
{ TEXT_CreateIndirect, "Text6", ID_TEXT_5, 436, 135, 118, 20, 0, 0x0, 0 },
{ TEXT_CreateIndirect, "Text7", ID_TEXT_6, 554, 135, 118, 20, 0, 0x0, 0 },
{ TEXT_CreateIndirect, "Text8", ID_TEXT_7, 672, 135, 118, 20, 0, 0x0, 0 },
{ TEXT_CreateIndirect, "Text9", ID_TEXT_8, 318, 255, 118, 20, 0, 0x0, 0 },
{ TEXT_CreateIndirect, "Text10", ID_TEXT_9, 436, 255, 118, 20, 0, 0x0, 0 },
{ TEXT_CreateIndirect, "Text11", ID_TEXT_10, 554, 255, 118, 20, 0, 0x0, 0 },
{ TEXT_CreateIndirect, "Text12", ID_TEXT_11, 672, 255, 118, 20, 0, 0x0, 0 },
// USER START (Optionally insert additional widgets)
// 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_PAINT:
GUI_SetBkColor(GUI_BLUE);
GUI_Clear();
break;
case WM_INIT_DIALOG:
//
// Initialization of 'Framewin'
//
hItem = pMsg->hWin;
FRAMEWIN_SetBarColor( hItem,1,GUI_BLUE);
FRAMEWIN_SetText(hItem, "数字舞台系统 视频推送界面");
FRAMEWIN_SetFont(hItem, GUI_FONTHZ24);
FRAMEWIN_SetTextColor(hItem, GUI_MAGENTA);
FRAMEWIN_SetTextAlign(hItem, GUI_TA_HCENTER | GUI_TA_VCENTER);
FRAMEWIN_SetTitleHeight(hItem, 30);
hItem = WM_GetDialogItem(pMsg->hWin, ID_CHECKBOX_0);
CHECKBOX_SetText(hItem, "HDMI 1");
CHECKBOX_SetFont(hItem, GUI_FONT_13_1);
CHECKBOX_SetTextColor(hItem, 0x00000000);
hItem = WM_GetDialogItem(pMsg->hWin, ID_CHECKBOX_1);
hItem = WM_GetDialogItem(pMsg->hWin, ID_CHECKBOX_2);
hItem = WM_GetDialogItem(pMsg->hWin, ID_CHECKBOX_3);
hItem = WM_GetDialogItem(pMsg->hWin, ID_CHECKBOX_4);
hItem = WM_GetDialogItem(pMsg->hWin, ID_CHECKBOX_5);
hItem = WM_GetDialogItem(pMsg->hWin, ID_CHECKBOX_6);
hItem = WM_GetDialogItem(pMsg->hWin, ID_CHECKBOX_7);
hItem = WM_GetDialogItem(pMsg->hWin, ID_CHECKBOX_8);
hItem = WM_GetDialogItem(pMsg->hWin, ID_CHECKBOX_9);
hItem = WM_GetDialogItem(pMsg->hWin, ID_CHECKBOX_10);
hItem = WM_GetDialogItem(pMsg->hWin, ID_CHECKBOX_11);
hItem = WM_GetDialogItem(pMsg->hWin, ID_CHECKBOX_12);
hItem = WM_GetDialogItem(pMsg->hWin, ID_CHECKBOX_13);
hItem = WM_GetDialogItem(pMsg->hWin, ID_CHECKBOX_14);
hItem = WM_GetDialogItem(pMsg->hWin, ID_CHECKBOX_15);
hItem = WM_GetDialogItem(pMsg->hWin, ID_CHECKBOX_16);
hItem = WM_GetDialogItem(pMsg->hWin, ID_CHECKBOX_17);
hItem = WM_GetDialogItem(pMsg->hWin, ID_CHECKBOX_18);
hItem = WM_GetDialogItem(pMsg->hWin, ID_CHECKBOX_19);
hItem = WM_GetDialogItem(pMsg->hWin, ID_CHECKBOX_20);
hItem = WM_GetDialogItem(pMsg->hWin, ID_CHECKBOX_21);
hItem = WM_GetDialogItem(pMsg->hWin, ID_CHECKBOX_22);
hItem = WM_GetDialogItem(pMsg->hWin, ID_CHECKBOX_23);
hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_0);
BUTTON_SetText(hItem, "窗口标示:1");
BUTTON_SetFont(hItem, GUI_FONTHZ16);
BUTTON_SetBkColor(hItem,BUTTON_CI_UNPRESSED,GUI_LIGHTGRAY );
hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_1);
BUTTON_SetText(hItem, "窗口标示:2");
BUTTON_SetFont(hItem, GUI_FONTHZ16);
BUTTON_SetBkColor(hItem,BUTTON_CI_UNPRESSED,GUI_LIGHTGRAY );
hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_2);
BUTTON_SetText(hItem, "窗口标示:3");
BUTTON_SetFont(hItem, GUI_FONTHZ16);
BUTTON_SetBkColor(hItem,BUTTON_CI_UNPRESSED,GUI_LIGHTGRAY );
hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_3);
BUTTON_SetText(hItem, "窗口标示:4");
BUTTON_SetFont(hItem, GUI_FONTHZ16);
BUTTON_SetBkColor(hItem,BUTTON_CI_UNPRESSED,GUI_LIGHTGRAY );
hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_4);
BUTTON_SetText(hItem, "窗口标示:5");
BUTTON_SetFont(hItem, GUI_FONTHZ16);
BUTTON_SetBkColor(hItem,BUTTON_CI_UNPRESSED,GUI_LIGHTGRAY );
hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_5);
BUTTON_SetText(hItem, "窗口标示:6");
BUTTON_SetFont(hItem, GUI_FONTHZ16);
BUTTON_SetBkColor(hItem,BUTTON_CI_UNPRESSED,GUI_LIGHTGRAY );
hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_6);
BUTTON_SetText(hItem, "窗口标示:7");
BUTTON_SetFont(hItem, GUI_FONTHZ16);
BUTTON_SetBkColor(hItem,BUTTON_CI_UNPRESSED,GUI_LIGHTGRAY );
hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_7);
BUTTON_SetText(hItem, "窗口标示:8");
BUTTON_SetFont(hItem, GUI_FONTHZ16);
BUTTON_SetBkColor(hItem,BUTTON_CI_UNPRESSED,GUI_LIGHTGRAY );
hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_8);
BUTTON_SetText(hItem, "窗口标示:9");
BUTTON_SetFont(hItem, GUI_FONTHZ16);
BUTTON_SetBkColor(hItem,BUTTON_CI_UNPRESSED,GUI_LIGHTGRAY );
hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_9);
BUTTON_SetText(hItem, "窗口标示:10");
BUTTON_SetFont(hItem, GUI_FONTHZ16);
BUTTON_SetBkColor(hItem,BUTTON_CI_UNPRESSED,GUI_LIGHTGRAY );
hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_10);
BUTTON_SetText(hItem, "窗口标示:11");
BUTTON_SetFont(hItem, GUI_FONTHZ16);
BUTTON_SetBkColor(hItem,BUTTON_CI_UNPRESSED,GUI_LIGHTGRAY );
hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_11);
BUTTON_SetText(hItem, "窗口标示:12");
BUTTON_SetFont(hItem, GUI_FONTHZ16);
BUTTON_SetBkColor(hItem,BUTTON_CI_UNPRESSED,GUI_LIGHTGRAY );
hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_12);
BUTTON_SetText(hItem, "发送");
BUTTON_SetFont(hItem, GUI_FONTHZ16);
BUTTON_SetBkColor(hItem,BUTTON_CI_UNPRESSED,GUI_YELLOW );
hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_0);
TEXT_SetTextAlign(hItem, GUI_TA_LEFT | GUI_TA_VCENTER);
TEXT_SetFont(hItem, GUI_FONTHZ12);
hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_1);
TEXT_SetFont(hItem, GUI_FONTHZ12);
hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_2);
TEXT_SetFont(hItem, GUI_FONTHZ12);
hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_3);
TEXT_SetFont(hItem, GUI_FONTHZ12);
hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_4);
TEXT_SetFont(hItem, GUI_FONTHZ12);
hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_5);
TEXT_SetFont(hItem, GUI_FONTHZ12);
hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_6);
TEXT_SetFont(hItem, GUI_FONTHZ12);
hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_7);
TEXT_SetFont(hItem, GUI_FONTHZ12);
hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_8);
TEXT_SetFont(hItem, GUI_FONTHZ12);
hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_9);
TEXT_SetFont(hItem, GUI_FONTHZ12);
hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_10);
TEXT_SetFont(hItem, GUI_FONTHZ12);
hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_11);
TEXT_SetFont(hItem, GUI_FONTHZ12);
hItem = WM_GetDialogItem(pMsg->hWin, ID_MULTIEDIT_0);
MULTIEDIT_SetFont(hItem,GUI_FONTHZ16);
MULTIEDIT_SetWrapWord(hItem);
MULTIEDIT_SetText(hItem, "HDMI 1");
hItem = WM_GetDialogItem(pMsg->hWin, ID_MULTIEDIT_1);
MULTIEDIT_SetFont(hItem,GUI_FONTHZ16);
MULTIEDIT_SetWrapWord(hItem);
MULTIEDIT_SetText(hItem, "HDMI 2");
MULTIEDIT_SetTextColor(hItem, MULTIEDIT_CI_EDIT, 0x00000000);
hItem = WM_GetDialogItem(pMsg->hWin, ID_MULTIEDIT_2);
MULTIEDIT_SetFont(hItem,GUI_FONTHZ16);
MULTIEDIT_SetWrapWord(hItem);
MULTIEDIT_SetText(hItem, "SDI 1");
hItem = WM_GetDialogItem(pMsg->hWin, ID_MULTIEDIT_3);
MULTIEDIT_SetFont(hItem,GUI_FONTHZ16);
MULTIEDIT_SetWrapWord(hItem);
MULTIEDIT_SetText(hItem, "SDI 2");
hItem = WM_GetDialogItem(pMsg->hWin, ID_MULTIEDIT_4);
MULTIEDIT_SetFont(hItem,GUI_FONTHZ16);
MULTIEDIT_SetWrapWord(hItem);
MULTIEDIT_SetText(hItem, "DECODERII 1.1.1-1.1.4");
MULTIEDIT_SetTextColor(hItem, MULTIEDIT_CI_EDIT, GUI_BLUE );
hItem = WM_GetDialogItem(pMsg->hWin, ID_MULTIEDIT_5);
MULTIEDIT_SetFont(hItem,GUI_FONTHZ16);
MULTIEDIT_SetWrapWord(hItem);
MULTIEDIT_SetText(hItem, "DECODERII 1.1.1");
hItem = WM_GetDialogItem(pMsg->hWin, ID_MULTIEDIT_6);
MULTIEDIT_SetFont(hItem,GUI_FONTHZ16);
MULTIEDIT_SetWrapWord(hItem);
MULTIEDIT_SetText(hItem, "DECODERII 1.1.2");
hItem = WM_GetDialogItem(pMsg->hWin, ID_MULTIEDIT_7);
MULTIEDIT_SetFont(hItem,GUI_FONTHZ16);
MULTIEDIT_SetWrapWord(hItem);
MULTIEDIT_SetText(hItem, "DECODERII 1.1.3");
hItem = WM_GetDialogItem(pMsg->hWin, ID_MULTIEDIT_8);
MULTIEDIT_SetFont(hItem,GUI_FONTHZ16);
MULTIEDIT_SetWrapWord(hItem);
MULTIEDIT_SetText(hItem, "DECODERII 1.1.4");
hItem = WM_GetDialogItem(pMsg->hWin, ID_MULTIEDIT_9);
MULTIEDIT_SetFont(hItem,GUI_FONTHZ16);
MULTIEDIT_SetWrapWord(hItem);
MULTIEDIT_SetText(hItem, "DECODERII 1.2.1-1.2.4");
MULTIEDIT_SetTextColor(hItem, MULTIEDIT_CI_EDIT, GUI_BLUE);
hItem = WM_GetDialogItem(pMsg->hWin, ID_MULTIEDIT_10);
MULTIEDIT_SetFont(hItem,GUI_FONTHZ16);
MULTIEDIT_SetWrapWord(hItem);
MULTIEDIT_SetText(hItem, "DECODERII 1.2.1");
hItem = WM_GetDialogItem(pMsg->hWin, ID_MULTIEDIT_11);
MULTIEDIT_SetFont(hItem,GUI_FONTHZ16);
MULTIEDIT_SetWrapWord(hItem);
MULTIEDIT_SetText(hItem, "DECODERII 1.2.2");
hItem = WM_GetDialogItem(pMsg->hWin, ID_MULTIEDIT_12);
MULTIEDIT_SetFont(hItem,GUI_FONTHZ16);
MULTIEDIT_SetWrapWord(hItem);
MULTIEDIT_SetText(hItem, "DECODERII 1.2.3");
hItem = WM_GetDialogItem(pMsg->hWin, ID_MULTIEDIT_13);
MULTIEDIT_SetFont(hItem,GUI_FONTHZ16);
MULTIEDIT_SetWrapWord(hItem);
MULTIEDIT_SetText(hItem, "DECODERII 1.2.4");
hItem = WM_GetDialogItem(pMsg->hWin, ID_MULTIEDIT_14);
MULTIEDIT_SetFont(hItem,GUI_FONTHZ16);
MULTIEDIT_SetWrapWord(hItem);
MULTIEDIT_SetText(hItem, "DECODERII 2.1.1-2.1.4");
MULTIEDIT_SetTextColor(hItem, MULTIEDIT_CI_EDIT, GUI_BLUE);
hItem = WM_GetDialogItem(pMsg->hWin, ID_MULTIEDIT_15);
MULTIEDIT_SetFont(hItem,GUI_FONTHZ16);
MULTIEDIT_SetWrapWord(hItem);
MULTIEDIT_SetText(hItem, "DECODERII 2.1.1");
hItem = WM_GetDialogItem(pMsg->hWin, ID_MULTIEDIT_16);
MULTIEDIT_SetFont(hItem,GUI_FONTHZ16);
MULTIEDIT_SetWrapWord(hItem);
MULTIEDIT_SetText(hItem, "DECODERII 2.1.2");
hItem = WM_GetDialogItem(pMsg->hWin, ID_MULTIEDIT_17);
MULTIEDIT_SetFont(hItem,GUI_FONTHZ16);
MULTIEDIT_SetWrapWord(hItem);
MULTIEDIT_SetText(hItem, "DECODERII 2.1.3");
hItem = WM_GetDialogItem(pMsg->hWin, ID_MULTIEDIT_18);
MULTIEDIT_SetFont(hItem,GUI_FONTHZ16);
MULTIEDIT_SetWrapWord(hItem);
MULTIEDIT_SetText(hItem, "DECODERII 2.1.4");
hItem = WM_GetDialogItem(pMsg->hWin, ID_MULTIEDIT_19);
MULTIEDIT_SetFont(hItem,GUI_FONTHZ16);
MULTIEDIT_SetWrapWord(hItem);
MULTIEDIT_SetText(hItem, "DECODERII 2.2.1-2.2.4");
MULTIEDIT_SetFont(hItem, GUI_FONTHZ16);
MULTIEDIT_SetTextColor(hItem, MULTIEDIT_CI_EDIT, GUI_BLUE);
hItem = WM_GetDialogItem(pMsg->hWin, ID_MULTIEDIT_20);
MULTIEDIT_SetFont(hItem,GUI_FONTHZ16);
MULTIEDIT_SetWrapWord(hItem);
MULTIEDIT_SetText(hItem, "DECODERII 2.2.1");
hItem = WM_GetDialogItem(pMsg->hWin, ID_MULTIEDIT_21);
MULTIEDIT_SetFont(hItem,GUI_FONTHZ16);
MULTIEDIT_SetWrapWord(hItem);
MULTIEDIT_SetText(hItem, "DECODERII 2.2.2");
hItem = WM_GetDialogItem(pMsg->hWin, ID_MULTIEDIT_22);
MULTIEDIT_SetFont(hItem,GUI_FONTHZ16);
MULTIEDIT_SetWrapWord(hItem);
MULTIEDIT_SetText(hItem, "DECODERII 2.2.3");
hItem = WM_GetDialogItem(pMsg->hWin, ID_MULTIEDIT_23);
MULTIEDIT_SetFont(hItem,GUI_FONTHZ16);
MULTIEDIT_SetWrapWord(hItem);
MULTIEDIT_SetText(hItem, "DECODERII 2.2.4");
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:
break;
case WM_NOTIFICATION_RELEASED:
break;
case WM_NOTIFICATION_VALUE_CHANGED:
break;
}
break;
case ID_CHECKBOX_1: // Notifications sent by 'Checkbox'
switch(NCode) {
case WM_NOTIFICATION_CLICKED:
break;
case WM_NOTIFICATION_RELEASED:
break;
case WM_NOTIFICATION_VALUE_CHANGED:
break;
}
break;
case ID_CHECKBOX_2: // Notifications sent by 'Checkbox'
switch(NCode) {
case WM_NOTIFICATION_CLICKED:
break;
case WM_NOTIFICATION_RELEASED:
break;
case WM_NOTIFICATION_VALUE_CHANGED:
break;
}
break;
case ID_CHECKBOX_3: // Notifications sent by 'Checkbox'
switch(NCode) {
case WM_NOTIFICATION_CLICKED:
break;
case WM_NOTIFICATION_RELEASED:
break;
case WM_NOTIFICATION_VALUE_CHANGED:
break;
}
break;
case ID_CHECKBOX_4: // Notifications sent by 'Checkbox'
switch(NCode) {
case WM_NOTIFICATION_CLICKED:
break;
case WM_NOTIFICATION_RELEASED:
break;
case WM_NOTIFICATION_VALUE_CHANGED:
break;
}
break;
case ID_CHECKBOX_5: // Notifications sent by 'Checkbox'
switch(NCode) {
case WM_NOTIFICATION_CLICKED:
break;
case WM_NOTIFICATION_RELEASED:
break;
case WM_NOTIFICATION_VALUE_CHANGED:
break;
}
break;
case ID_CHECKBOX_6: // Notifications sent by 'Checkbox'
switch(NCode) {
case WM_NOTIFICATION_CLICKED:
break;
case WM_NOTIFICATION_RELEASED:
break;
case WM_NOTIFICATION_VALUE_CHANGED:
break;
}
break;
case ID_CHECKBOX_7: // Notifications sent by 'Checkbox'
switch(NCode) {
case WM_NOTIFICATION_CLICKED:
break;
case WM_NOTIFICATION_RELEASED:
break;
case WM_NOTIFICATION_VALUE_CHANGED:
break;
}
break;
case ID_CHECKBOX_8: // Notifications sent by 'Checkbox'
switch(NCode) {
case WM_NOTIFICATION_CLICKED:
break;
case WM_NOTIFICATION_RELEASED:
break;
case WM_NOTIFICATION_VALUE_CHANGED:
break;
}
break;
case ID_CHECKBOX_9: // Notifications sent by 'Checkbox'
switch(NCode) {
case WM_NOTIFICATION_CLICKED:
break;
case WM_NOTIFICATION_RELEASED:
break;
case WM_NOTIFICATION_VALUE_CHANGED:
break;
}
break;
case ID_CHECKBOX_10: // Notifications sent by 'Checkbox'
switch(NCode) {
case WM_NOTIFICATION_CLICKED:
break;
case WM_NOTIFICATION_RELEASED:
break;
case WM_NOTIFICATION_VALUE_CHANGED:
break;
}
break;
case ID_CHECKBOX_11: // Notifications sent by 'Checkbox'
switch(NCode) {
case WM_NOTIFICATION_CLICKED:
break;
case WM_NOTIFICATION_RELEASED:
break;
case WM_NOTIFICATION_VALUE_CHANGED:
break;
}
break;
case ID_CHECKBOX_12: // Notifications sent by 'Checkbox'
switch(NCode) {
case WM_NOTIFICATION_CLICKED:
break;
case WM_NOTIFICATION_RELEASED:
break;
case WM_NOTIFICATION_VALUE_CHANGED:
break;
}
break;
case ID_CHECKBOX_13: // Notifications sent by 'Checkbox'
switch(NCode) {
case WM_NOTIFICATION_CLICKED:
break;
case WM_NOTIFICATION_RELEASED:
break;
case WM_NOTIFICATION_VALUE_CHANGED:
break;
}
break;
case ID_CHECKBOX_14: // Notifications sent by 'Checkbox'
switch(NCode) {
case WM_NOTIFICATION_CLICKED:
break;
case WM_NOTIFICATION_RELEASED:
break;
case WM_NOTIFICATION_VALUE_CHANGED:
break;
}
break;
case ID_CHECKBOX_15: // Notifications sent by 'Checkbox'
switch(NCode) {
case WM_NOTIFICATION_CLICKED:
break;
case WM_NOTIFICATION_RELEASED:
break;
case WM_NOTIFICATION_VALUE_CHANGED:
break;
}
break;
case ID_CHECKBOX_16: // Notifications sent by 'Checkbox'
switch(NCode) {
case WM_NOTIFICATION_CLICKED:
break;
case WM_NOTIFICATION_RELEASED:
break;
case WM_NOTIFICATION_VALUE_CHANGED:
break;
}
break;
case ID_CHECKBOX_17: // Notifications sent by 'Checkbox'
switch(NCode) {
case WM_NOTIFICATION_CLICKED:
break;
case WM_NOTIFICATION_RELEASED:
break;
case WM_NOTIFICATION_VALUE_CHANGED:
break;
}
break;
case ID_CHECKBOX_18: // Notifications sent by 'Checkbox'
switch(NCode) {
case WM_NOTIFICATION_CLICKED:
break;
case WM_NOTIFICATION_RELEASED:
break;
case WM_NOTIFICATION_VALUE_CHANGED:
break;
}
break;
case ID_CHECKBOX_19: // Notifications sent by 'Checkbox'
switch(NCode) {
case WM_NOTIFICATION_CLICKED:
break;
case WM_NOTIFICATION_RELEASED:
break;
case WM_NOTIFICATION_VALUE_CHANGED:
break;
}
break;
case ID_CHECKBOX_20: // Notifications sent by 'Checkbox'
switch(NCode) {
case WM_NOTIFICATION_CLICKED:
break;
case WM_NOTIFICATION_RELEASED:
break;
case WM_NOTIFICATION_VALUE_CHANGED:
break;
}
break;
case ID_CHECKBOX_21: // Notifications sent by 'Checkbox'
switch(NCode) {
case WM_NOTIFICATION_CLICKED:
break;
case WM_NOTIFICATION_RELEASED:
break;
case WM_NOTIFICATION_VALUE_CHANGED:
break;
}
break;
case ID_CHECKBOX_22: // Notifications sent by 'Checkbox'
switch(NCode) {
case WM_NOTIFICATION_CLICKED:
break;
case WM_NOTIFICATION_RELEASED:
break;
case WM_NOTIFICATION_VALUE_CHANGED:
break;
}
break;
case ID_CHECKBOX_23: // Notifications sent by 'Checkbox'
switch(NCode) {
case WM_NOTIFICATION_CLICKED:
break;
case WM_NOTIFICATION_RELEASED:
break;
case WM_NOTIFICATION_VALUE_CHANGED:
break;
}
break;
case ID_BUTTON_0: // Notifications sent by 'Button1'
hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_0); //得到按钮BUTTON_1的窗口句柄(小工具本身也是窗口)
switch(NCode) {
case WM_NOTIFICATION_CLICKED:
break;
case WM_NOTIFICATION_RELEASED:
button_flag0 ^=1;
if(button_flag0)
{ BUTTON_SetBkColor(hItem,BUTTON_CI_UNPRESSED,GUI_RED );}
else
{ BUTTON_SetBkColor(hItem,BUTTON_CI_UNPRESSED,GUI_LIGHTGRAY ); }
break;
}
break;
case ID_BUTTON_1: // Notifications sent by 'Button2'
hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_1); //得到按钮BUTTON_2的窗口句柄(小工具本身也是窗口)
switch(NCode) {
case WM_NOTIFICATION_CLICKED:
break;
case WM_NOTIFICATION_RELEASED:
button_flag1 ^=1;
if(button_flag1)
{ BUTTON_SetBkColor(hItem,BUTTON_CI_UNPRESSED,GUI_RED );}
else
{ BUTTON_SetBkColor(hItem,BUTTON_CI_UNPRESSED,GUI_LIGHTGRAY ); }
break;
}
break;
case ID_BUTTON_2: // Notifications sent by 'Button3'
hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_2); //得到按钮BUTTON_3的窗口句柄(小工具本身也是窗口)
switch(NCode) {
case WM_NOTIFICATION_CLICKED:
break;
case WM_NOTIFICATION_RELEASED:
button_flag2 ^=1;
if(button_flag2)
{ BUTTON_SetBkColor(hItem,BUTTON_CI_UNPRESSED,GUI_RED );}
else
{ BUTTON_SetBkColor(hItem,BUTTON_CI_UNPRESSED,GUI_LIGHTGRAY ); }
break;
}
break;
case ID_BUTTON_3: // Notifications sent by 'Button4'
hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_3); //得到按钮BUTTON_4的窗口句柄(小工具本身也是窗口)
switch(NCode) {
case WM_NOTIFICATION_CLICKED:
break;
case WM_NOTIFICATION_RELEASED:
button_flag3 ^=1;
if(button_flag3)
{ BUTTON_SetBkColor(hItem,BUTTON_CI_UNPRESSED,GUI_RED );}
else
{ BUTTON_SetBkColor(hItem,BUTTON_CI_UNPRESSED,GUI_LIGHTGRAY ); }
break;
}
break;
case ID_BUTTON_4: // Notifications sent by 'Button5'
hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_4); //得到按钮BUTTON_5的窗口句柄(小工具本身也是窗口)
switch(NCode) {
case WM_NOTIFICATION_CLICKED:
break;
case WM_NOTIFICATION_RELEASED:
button_flag4 ^=1;
if(button_flag4)
{ BUTTON_SetBkColor(hItem,BUTTON_CI_UNPRESSED,GUI_RED );}
else
{ BUTTON_SetBkColor(hItem,BUTTON_CI_UNPRESSED,GUI_LIGHTGRAY ); }
break;
}
break;
case ID_BUTTON_5: // Notifications sent by 'Button6'
hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_5); //得到按钮BUTTON_6的窗口句柄(小工具本身也是窗口)
switch(NCode) {
case WM_NOTIFICATION_CLICKED:
break;
case WM_NOTIFICATION_RELEASED:
button_flag5 ^=1;
if(button_flag5)
{ BUTTON_SetBkColor(hItem,BUTTON_CI_UNPRESSED,GUI_RED );}
else
{ BUTTON_SetBkColor(hItem,BUTTON_CI_UNPRESSED,GUI_LIGHTGRAY ); }
break;
}
break;
case ID_BUTTON_6: // Notifications sent by 'Button'
hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_6); //得到按钮BUTTON_7的窗口句柄(小工具本身也是窗口)
switch(NCode) {
case WM_NOTIFICATION_CLICKED:
break;
case WM_NOTIFICATION_RELEASED:
button_flag6 ^=1;
if(button_flag6)
{ BUTTON_SetBkColor(hItem,BUTTON_CI_UNPRESSED,GUI_RED );}
else
{ BUTTON_SetBkColor(hItem,BUTTON_CI_UNPRESSED,GUI_LIGHTGRAY ); }
break;
}
break;
case ID_BUTTON_7: // Notifications sent by 'Button'
hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_7); //得到按钮BUTTON_8的窗口句柄(小工具本身也是窗口)
switch(NCode) {
case WM_NOTIFICATION_CLICKED:
break;
case WM_NOTIFICATION_RELEASED:
button_flag7 ^=1;
if(button_flag7)
{ BUTTON_SetBkColor(hItem,BUTTON_CI_UNPRESSED,GUI_RED );}
else
{ BUTTON_SetBkColor(hItem,BUTTON_CI_UNPRESSED,GUI_LIGHTGRAY ); }
break;
}
break;
case ID_BUTTON_8: // Notifications sent by 'Button9'
hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_8); //得到按钮BUTTON_9的窗口句柄(小工具本身也是窗口)
switch(NCode) {
case WM_NOTIFICATION_CLICKED:
break;
case WM_NOTIFICATION_RELEASED:
button_flag8 ^=1;
if(button_flag8)
{ BUTTON_SetBkColor(hItem,BUTTON_CI_UNPRESSED,GUI_RED );}
else
{ BUTTON_SetBkColor(hItem,BUTTON_CI_UNPRESSED,GUI_LIGHTGRAY ); }
break;
}
break;
case ID_BUTTON_9: // Notifications sent by 'Button10'
hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_9); //得到按钮BUTTON_10的窗口句柄(小工具本身也是窗口)
switch(NCode) {
case WM_NOTIFICATION_CLICKED:
break;
case WM_NOTIFICATION_RELEASED:
button_flag9 ^=1;
if(button_flag9)
{ BUTTON_SetBkColor(hItem,BUTTON_CI_UNPRESSED,GUI_RED );}
else
{ BUTTON_SetBkColor(hItem,BUTTON_CI_UNPRESSED,GUI_LIGHTGRAY ); }
break;
}
break;
case ID_BUTTON_10: // Notifications sent by 'Button11'
hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_10); //得到按钮BUTTON_11的窗口句柄(小工具本身也是窗口)
switch(NCode) {
case WM_NOTIFICATION_CLICKED:
break;
case WM_NOTIFICATION_RELEASED:
button_flag10 ^=1;
if(button_flag10)
{ BUTTON_SetBkColor(hItem,BUTTON_CI_UNPRESSED,GUI_RED );}
else
{ BUTTON_SetBkColor(hItem,BUTTON_CI_UNPRESSED,GUI_LIGHTGRAY ); }
break;
}
break;
case ID_BUTTON_11: // Notifications sent by 'Button12'
hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_11); //得到按钮BUTTON_12的窗口句柄(小工具本身也是窗口)
switch(NCode) {
case WM_NOTIFICATION_CLICKED:
break;
case WM_NOTIFICATION_RELEASED:
button_flag11 ^=1;
if(button_flag11)
{ BUTTON_SetBkColor(hItem,BUTTON_CI_UNPRESSED,GUI_RED );}
else
{ BUTTON_SetBkColor(hItem,BUTTON_CI_UNPRESSED,GUI_LIGHTGRAY ); }
break;
}
break;
case ID_BUTTON_12: // Notifications sent by 'SEND'
hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_12); //得到按钮BUTTON_13的窗口句柄(小工具本身也是窗口)
switch(NCode) {
case WM_NOTIFICATION_CLICKED:
break;
case WM_NOTIFICATION_RELEASED:
button_flag12 ^=1;
if(button_flag12)
{ BUTTON_SetBkColor(hItem,BUTTON_CI_UNPRESSED,GUI_YELLOW );}
else
{ BUTTON_SetBkColor(hItem,BUTTON_CI_UNPRESSED,GUI_GREEN ); }
break;
}
break;
case ID_MULTIEDIT_0: // Notifications sent by 'Edit'
switch(NCode) {
case WM_NOTIFICATION_CLICKED:
break;
case WM_NOTIFICATION_RELEASED:
MULTIEDIT_ID_Storage =ID_MULTIEDIT_0;
keypad_Create();
break;
case WM_NOTIFICATION_VALUE_CHANGED:
break;
}
break;
case ID_MULTIEDIT_1: // Notifications sent by 'Edit'
switch(NCode) {
case WM_NOTIFICATION_CLICKED:
break;
case WM_NOTIFICATION_RELEASED:
MULTIEDIT_ID_Storage =ID_MULTIEDIT_1;
keypad_Create();
break;
case WM_NOTIFICATION_VALUE_CHANGED:
break;
}
break;
case ID_MULTIEDIT_2: // Notifications sent by 'Edit'
switch(NCode) {
case WM_NOTIFICATION_CLICKED:
break;
case WM_NOTIFICATION_RELEASED:
MULTIEDIT_ID_Storage =ID_MULTIEDIT_2;
keypad_Create();
break;
case WM_NOTIFICATION_VALUE_CHANGED:
break;
}
break;
case ID_MULTIEDIT_3: // Notifications sent by 'Edit'
switch(NCode) {
case WM_NOTIFICATION_CLICKED:
break;
case WM_NOTIFICATION_RELEASED:
MULTIEDIT_ID_Storage =ID_MULTIEDIT_3;
keypad_Create();
break;
case WM_NOTIFICATION_VALUE_CHANGED:
break;
}
break;
case ID_MULTIEDIT_4: // Notifications sent by 'Edit'
switch(NCode) {
case WM_NOTIFICATION_CLICKED:
break;
case WM_NOTIFICATION_RELEASED:
MULTIEDIT_ID_Storage =ID_MULTIEDIT_4;
keypad_Create();
break;
case WM_NOTIFICATION_VALUE_CHANGED:
break;
}
break;
case ID_MULTIEDIT_5: // Notifications sent by 'Edit'
switch(NCode) {
case WM_NOTIFICATION_CLICKED:
break;
case WM_NOTIFICATION_RELEASED:
MULTIEDIT_ID_Storage =ID_MULTIEDIT_5;
keypad_Create();
break;
case WM_NOTIFICATION_VALUE_CHANGED:
break;
}
break;
case ID_MULTIEDIT_6: // Notifications sent by 'Edit'
switch(NCode) {
case WM_NOTIFICATION_CLICKED:
break;
case WM_NOTIFICATION_RELEASED:
MULTIEDIT_ID_Storage =ID_MULTIEDIT_6;
keypad_Create();
break;
case WM_NOTIFICATION_VALUE_CHANGED:
break;
}
break;
case ID_MULTIEDIT_7: // Notifications sent by 'Edit'
switch(NCode) {
case WM_NOTIFICATION_CLICKED:
break;
case WM_NOTIFICATION_RELEASED:
MULTIEDIT_ID_Storage =ID_MULTIEDIT_7;
keypad_Create();
break;
case WM_NOTIFICATION_VALUE_CHANGED:
break;
}
break;
case ID_MULTIEDIT_8: // Notifications sent by 'Edit'
switch(NCode) {
case WM_NOTIFICATION_CLICKED:
break;
case WM_NOTIFICATION_RELEASED:
MULTIEDIT_ID_Storage =ID_MULTIEDIT_8;
keypad_Create();
break;
case WM_NOTIFICATION_VALUE_CHANGED:
break;
}
break;
case ID_MULTIEDIT_9: // Notifications sent by 'Edit'
switch(NCode) {
case WM_NOTIFICATION_CLICKED:
break;
case WM_NOTIFICATION_RELEASED:
MULTIEDIT_ID_Storage =ID_MULTIEDIT_9;
keypad_Create();
break;
case WM_NOTIFICATION_VALUE_CHANGED:
break;
}
break;
case ID_MULTIEDIT_10: // Notifications sent by 'Edit'
switch(NCode) {
case WM_NOTIFICATION_CLICKED:
break;
case WM_NOTIFICATION_RELEASED:
MULTIEDIT_ID_Storage =ID_MULTIEDIT_10;
keypad_Create();
break;
case WM_NOTIFICATION_VALUE_CHANGED:
break;
}
break;
case ID_MULTIEDIT_11: // Notifications sent by 'Edit'
switch(NCode) {
case WM_NOTIFICATION_CLICKED:
break;
case WM_NOTIFICATION_RELEASED:
MULTIEDIT_ID_Storage =ID_MULTIEDIT_11;
keypad_Create();
break;
case WM_NOTIFICATION_VALUE_CHANGED:
break;
}
break;
case ID_MULTIEDIT_12: // Notifications sent by 'Edit'
switch(NCode) {
case WM_NOTIFICATION_CLICKED:
break;
case WM_NOTIFICATION_RELEASED:
MULTIEDIT_ID_Storage =ID_MULTIEDIT_12;
keypad_Create();
break;
case WM_NOTIFICATION_VALUE_CHANGED:
break;
}
break;
case ID_MULTIEDIT_13: // Notifications sent by 'Edit'
switch(NCode) {
case WM_NOTIFICATION_CLICKED:
break;
case WM_NOTIFICATION_RELEASED:
MULTIEDIT_ID_Storage =ID_MULTIEDIT_13;
keypad_Create();
break;
case WM_NOTIFICATION_VALUE_CHANGED:
break;
}
break;
case ID_MULTIEDIT_14: // Notifications sent by 'Edit'
switch(NCode) {
case WM_NOTIFICATION_CLICKED:
break;
case WM_NOTIFICATION_RELEASED:
MULTIEDIT_ID_Storage =ID_MULTIEDIT_14;
keypad_Create();
case WM_NOTIFICATION_VALUE_CHANGED:
break;
}
break;
case ID_MULTIEDIT_15: // Notifications sent by 'Edit'
switch(NCode) {
case WM_NOTIFICATION_CLICKED:
break;
case WM_NOTIFICATION_RELEASED:
MULTIEDIT_ID_Storage =ID_MULTIEDIT_15;
keypad_Create();
break;
case WM_NOTIFICATION_VALUE_CHANGED:
break;
}
break;
case ID_MULTIEDIT_16: // Notifications sent by 'Edit'
switch(NCode) {
case WM_NOTIFICATION_CLICKED:
break;
case WM_NOTIFICATION_RELEASED:
MULTIEDIT_ID_Storage =ID_MULTIEDIT_16;
keypad_Create();
break;
case WM_NOTIFICATION_VALUE_CHANGED:
break;
}
break;
case ID_MULTIEDIT_17: // Notifications sent by 'Edit'
switch(NCode) {
case WM_NOTIFICATION_CLICKED:
break;
case WM_NOTIFICATION_RELEASED:
MULTIEDIT_ID_Storage =ID_MULTIEDIT_17;
keypad_Create();
break;
case WM_NOTIFICATION_VALUE_CHANGED:
break;
}
break;
case ID_MULTIEDIT_18: // Notifications sent by 'Edit'
switch(NCode) {
case WM_NOTIFICATION_CLICKED:
break;
case WM_NOTIFICATION_RELEASED:
MULTIEDIT_ID_Storage =ID_MULTIEDIT_18;
keypad_Create();
break;
case WM_NOTIFICATION_VALUE_CHANGED:
break;
}
break;
case ID_MULTIEDIT_19: // Notifications sent by 'Edit'
switch(NCode) {
case WM_NOTIFICATION_CLICKED:
break;
case WM_NOTIFICATION_RELEASED:
MULTIEDIT_ID_Storage =ID_MULTIEDIT_19;
keypad_Create();
break;
case WM_NOTIFICATION_VALUE_CHANGED:
break;
}
break;
case ID_MULTIEDIT_20: // Notifications sent by 'Edit'
switch(NCode) {
case WM_NOTIFICATION_CLICKED:
break;
case WM_NOTIFICATION_RELEASED:
MULTIEDIT_ID_Storage =ID_MULTIEDIT_20;
keypad_Create();
break;
case WM_NOTIFICATION_VALUE_CHANGED:
break;
}
break;
case ID_MULTIEDIT_21: // Notifications sent by 'Edit'
switch(NCode) {
case WM_NOTIFICATION_CLICKED:
break;
case WM_NOTIFICATION_RELEASED:
MULTIEDIT_ID_Storage =ID_MULTIEDIT_21;
keypad_Create();
break;
case WM_NOTIFICATION_VALUE_CHANGED:
break;
}
break;
case ID_MULTIEDIT_22: // Notifications sent by 'Edit'
switch(NCode) {
case WM_NOTIFICATION_CLICKED:
break;
case WM_NOTIFICATION_RELEASED:
MULTIEDIT_ID_Storage =ID_MULTIEDIT_22;
keypad_Create();
break;
case WM_NOTIFICATION_VALUE_CHANGED:
break;
}
break;
case ID_MULTIEDIT_23: // Notifications sent by 'Edit'
switch(NCode) {
case WM_NOTIFICATION_CLICKED:
break;
case WM_NOTIFICATION_RELEASED:
MULTIEDIT_ID_Storage =ID_MULTIEDIT_23;
keypad_Create();
break;
case WM_NOTIFICATION_VALUE_CHANGED:
break;
}
break;
}
break;
// USER START (Optionally insert additional message handling)
// USER END
default:
WM_DefaultProc(pMsg);
break;
}
}
//背景窗口的回调函数
static void _cbBkWindow(WM_MESSAGE *pMsg)
{
switch(pMsg->MsgId)
{
case WM_PAINT:
GUI_SetBkColor(GUI_DARKGRAY);
GUI_Clear();
break;
default:
WM_DefaultProc(pMsg);
break;
}
}
WM_HWIN CreateFramewin(void) {
hWin_Main = GUI_CreateDialogBox(_aDialogCreate, GUI_COUNTOF(_aDialogCreate), _cbDialog, WM_HBKWIN, 0, 0);
//为背景设置回调函数
WM_SetCallback(WM_HBKWIN,_cbBkWindow); //因为_cbDialog这个回调函数中已经有了case WM_PAINT: 因此背景窗口中的case WM_PAINT: 就失去了作用
return hWin_Main;
}
void windows(void)
{
WM_HWIN hWin;
WM_EnableMemdev(WM_HBKWIN);
hWin=CreateFramewin();
while(1)
{
GUI_Delay(100);
}
}
我来回答