#include "GUI.h"
#include "SIM.h"
#include "FRAMEWIN.h"
#include "LISTBOX.h"
#include <stddef.h>
#include "WM.h"
#include "BUTTON.h"
WM_HWIN mainwin;
int status = 0;
static void MainBinLogoWinCallBack(WM_MESSAGE * pMsg)
{
WM_HWIN hWin = pMsg->hWin;
int i = 0;
switch (pMsg->MsgId)
{
case WM_CREATE:
//WIDGET_SetDefaultEffect(&WIDGET_Effect_None);
//LISTBOX_Handle hListBox;
/* Create the listbox */
//hListBox = LISTBOX_Create(_aListBox, 100, 100, 120, 75, WM_CF_SHOW);
//WM_SetFocus(hListBox);
//LISTBOX_SetFont(hListBox, &GUI_Font13B_1);
//SCROLLBAR_CreateAttached(hListBox, SCROLLBAR_CF_VERTICAL);
//BUTTON_CreateAsChild(10,10,10,10,mainwin,5,0);
WM_SetFocus(mainwin);
break;
case WM_PAINT:
GUI_SetBkColor(GUI_BLACK);
GUI_Clear();
GUI_SetColor(GUI_WHITE);
GUI_SetTextMode(GUI_TM_TRANS);
GUI_DispStringAt("hello world",50,50);
GUI_DispDecAt(status,100,100,2);
// GUI_DrawBitmap(&sg_startLogo,
// (MYWIN_XSIZE - sg_startLogo.XSize) / 2,
// (MYWIN_YSIZE - sg_startLogo.YSize) / 2);
break;
case WM_KEY:
printf(">>key aaaaaa \n");
switch (((WM_KEY_INFO*)pMsg->Data.p)->Key)
{
case 19:
printf("recv 19");
status = (status == 0)? 1: 0 ;
WM_InvalidateWindow(pMsg->hWin);
break;
}
break;
case WM_DELETE:
break;
default:
WM_DefaultProc(pMsg);
}
}
void MainTask(void) {
GUI_Init();
/* set callback routine for hardkey */
//SIM_HARDKEY_SetCallback(1, &_cbKeyUp);
//SIM_HARDKEY_SetCallback(2, &_cbKeyDown);
/* start demo */
mainwin = WM_CreateWindow(0, 0, 300, 300,
WM_CF_SHOW | WM_CF_MEMDEV, MainBinLogoWinCallBack, 0);
while(1){
GUI_Exec();
GUI_Delay(500);
GUI_SendKeyMsg(19, 1);
}
}
sendkeymsg发送的消息一直收不到,找不到原因,貌似也不是焦点问题,求大神指导
|