新手上路
- 积分
- 48
- 金钱
- 48
- 注册时间
- 2016-2-29
- 在线时间
- 10 小时
|
1金钱
求,求,求,EMWIN实验15BUTTON使用,图片中的程序,当BUTTON释放后例程实现的是LED灯的反向亮与灭,但是我现在想把这个LED灯的亮灭的功能改成弹出一个空白的对话框,
我也尝试了再创建一个对话框,但是创建不成功,就像guibuilder只能放置一个对话框一样,想问一下如何实现??
//对话框资源表
static const GUI_WIDGET_CREATE_INFO _aDialogCreate[] =
{
{ FRAMEWIN_CreateIndirect, "Framewin", ID_FRAMEWIN_0, 0, 0, 400, 480, 0, 0x64, 0 },
{ BUTTON_CreateIndirect, "Button", ID_BUTTON_0, 150, 61, 75, 50, 0, 0x0, 0 },
{ BUTTON_CreateIndirect, "Button", ID_BUTTON_1, 150, 125, 75, 50, 0, 0x0, 0 },
};
//回调函数
static void _cbDialog(WM_MESSAGE * pMsg)
{
WM_HWIN hItem;
int NCode;
int Id;
switch (pMsg->MsgId)
{
case WM_INIT_DIALOG:
hItem = pMsg->hWin;
FRAMEWIN_SetTitleHeight(hItem, 30);
FRAMEWIN_SetText(hItem, "ALIENTE BUTTON USE");
FRAMEWIN_SetFont(hItem, GUI_FONT_24_ASCII);
FRAMEWIN_SetTextAlign(hItem, GUI_TA_HCENTER | GUI_TA_VCENTER);
FRAMEWIN_SetTextColor(hItem, 0x0000FFFF);
//3õê¼»ˉBUTTON0
hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_0);
BUTTON_SetFont(hItem, GUI_FONT_24_ASCII);
BUTTON_SetText(hItem, "LED1");
//3õê¼»ˉBUTTON1
hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_1);
BUTTON_SetText(hItem, "color");
BUTTON_SetFont(hItem, GUI_FONT_24_ASCII);
break;
case WM_NOTIFY_PARENT:
Id = WM_GetId(pMsg->hWinSrc);
NCode = pMsg->Data.v;
switch(Id)
{
case ID_BUTTON_0:
switch(NCode)
{
case WM_NOTIFICATION_CLICKED:
break;
case WM_NOTIFICATION_RELEASED: //
LED1=~LED1; //LED反转
//BEEP=~BEEP;
break;
}
break;
case ID_BUTTON_1: //BUTTON_1μÄí¨Öa′úÂ룬¿ØÖÆBEEP
switch(NCode)
{
case WM_NOTIFICATION_CLICKED:
break;
case WM_NOTIFICATION_RELEASED:
// BEEP=~BEEP; //·äÃùÆ÷·′×a
//LED1=~LED1;
GUI_Clear();
i++;
break;
}
break;
}
break;
default:
WM_DefaultProc(pMsg);
break;
}
}
//创建一个对话框
WM_HWIN CreateFramewin(void)
{
WM_HWIN hWin;
hWin = GUI_CreateDialogBox(_aDialogCreate, GUI_COUNTOF(_aDialogCreate), _cbDialog, WM_HBKWIN, 0, 0);
return hWin;
}
|
|