我想用按键1控件创建WM_CreateWindowAsChild(子窗口) 按键2删除这个字窗口 怎么实现 谢谢
#include "pbdata.h"
void RCC_Configuration(void);
void GPIO_Configuration(void);
void LED_GPIO(void);
static void cbCallbsck(WM_MESSAGE* pMsg)
{
int NCode,Id;
switch(pMsg->MsgId)
{
case WM_PAINT:
{
GUI_SetBkColor(GUI_BLACK);
GUI_Clear();
GUI_SetFont(&GUI_Font24_ASCII);
GUI_SetColor(GUI_GREEN);
GUI_DispStringAt("www.ssdf.com",40,280);
}
break;
case WM_NOTIFY_PARENT:
{
Id=WM_GetId(pMsg->hWinSrc);
NCode = pMsg->Data.v;
switch(NCode)
{
case WM_NOTIFICATION_RELEASED:
{
switch(Id)
{
case GUI_ID_BUTTON0:
{
GPIO_ResetBits(GPIOB,GPIO_Pin_5);
}
break;
case GUI_ID_BUTTON1:
{
GPIO_SetBits(GPIOB,GPIO_Pin_5);
}
break;
case GUI_ID_BUTTON2:
{
GPIO_ResetBits(GPIOD,GPIO_Pin_3);
}
break;
case GUI_ID_BUTTON3:
{
GPIO_SetBits(GPIOD,GPIO_Pin_3);
}
break;
case GUI_ID_BUTTON4:
{
GPIO_ResetBits(GPIOD,GPIO_Pin_6);
}
break;
case GUI_ID_BUTTON5:
{
GPIO_SetBits(GPIOD,GPIO_Pin_6);
}
break;
}
}
break;
}
}
break;
default:
WM_DefaultProc(pMsg);
}
}
int main(void)
{
WM_HWIN hWin;
TEXT_Handle hText0,hText1,hText2,hText3;
BUTTON_Handle hButton;
RCC_Configuration();
GPIO_Configuration();
LED_GPIO();
FSMC_Configuration();
SPI1_Configuration();
Touch_GPIO();
ILI9325_Init();
GUI_Init();
//′′½¨′°ìå
hWin=WM_CreateWindow (0,0,240,320,WM_CF_SHOW,cbCallbsck,0);
//Îı¾¿Ø¼tÏÔê¾éèÖÃ
hText0=TEXT_CreateAsChild (0,0,240,40,hWin,GUI_ID_TEXT0,WM_CF_SHOW,"LCD UC/GUI",GUI_TA_HCENTER);//′˾ä±ØDëÔúéϱß
TEXT_SetFont(hText0,&GUI_Font24_ASCII);
TEXT_SetTextColor(hText0,GUI_RED);
TEXT_SetBkColor(hText0,GUI_BLUE);
hText1=TEXT_CreateAsChild (20,50,60,40,hWin,GUI_ID_TEXT1,WM_CF_SHOW,"LCD1",GUI_TA_HCENTER);
TEXT_SetFont(hText1,&GUI_Font24_ASCII);
TEXT_SetTextColor(hText1,GUI_RED);
// TEXT_SetBkColor(hText1,GUI_BLUE);
hText2=TEXT_CreateAsChild (90,50,60,40,hWin,GUI_ID_TEXT2,WM_CF_SHOW,"LCD2",GUI_TA_HCENTER);
TEXT_SetFont(hText2,&GUI_Font24_ASCII);
TEXT_SetTextColor(hText2,GUI_RED);
//TEXT_SetBkColor(hText2,GUI_BLUE);
hText3=TEXT_CreateAsChild (160,50,60,40,hWin,GUI_ID_TEXT3,WM_CF_SHOW,"LCD3",GUI_TA_HCENTER);
TEXT_SetFont(hText3,&GUI_Font24_ASCII);
TEXT_SetTextColor(hText3,GUI_RED);
//TEXT_SetBkColor(hText3,GUI_BLUE);
//°′Å¥¿Ø¼t
hButton=BUTTON_CreateAsChild (20,70, 60,40,hWin,GUI_ID_BUTTON0,WM_CF_SHOW);
BUTTON_SetFont(hButton,&GUI_Font24_ASCII);//éèÖÃ×Öìå
BUTTON_SetText(hButton,"ON");
BUTTON_SetTextColor(hButton,0, GUI_WHITE);
BUTTON_SetTextColor(hButton,1, GUI_BLACK);
BUTTON_SetBkColor(hButton,0, GUI_BLUE);
BUTTON_SetBkColor(hButton,1, GUI_RED);
hButton=BUTTON_CreateAsChild (20,140, 60,40,hWin,GUI_ID_BUTTON1,WM_CF_SHOW);
BUTTON_SetFont(hButton,&GUI_Font24_ASCII);
BUTTON_SetText(hButton,"OFF");
BUTTON_SetTextColor(hButton,0, GUI_WHITE);
BUTTON_SetTextColor(hButton,1, GUI_BLACK);
BUTTON_SetBkColor(hButton,0, GUI_BLUE);
BUTTON_SetBkColor(hButton,1, GUI_RED);
hButton=BUTTON_CreateAsChild (90,70, 60,40,hWin,GUI_ID_BUTTON2,WM_CF_SHOW);
BUTTON_SetFont(hButton,&GUI_Font24_ASCII);
BUTTON_SetText(hButton,"ON");
BUTTON_SetTextColor(hButton,0, GUI_WHITE);
BUTTON_SetTextColor(hButton,1, GUI_BLACK);
BUTTON_SetBkColor(hButton,0, GUI_BLUE);
BUTTON_SetBkColor(hButton,1, GUI_RED);
hButton=BUTTON_CreateAsChild (90,140, 60,40,hWin,GUI_ID_BUTTON3,WM_CF_SHOW);
BUTTON_SetFont(hButton,&GUI_Font24_ASCII);
BUTTON_SetText(hButton,"OFF");
BUTTON_SetTextColor(hButton,0, GUI_WHITE);
BUTTON_SetTextColor(hButton,1, GUI_BLACK);
BUTTON_SetBkColor(hButton,0, GUI_BLUE);
BUTTON_SetBkColor(hButton,1, GUI_RED);
hButton=BUTTON_CreateAsChild (160,70, 60,40,hWin,GUI_ID_BUTTON4,WM_CF_SHOW);
BUTTON_SetFont(hButton,&GUI_Font24_ASCII);
BUTTON_SetText(hButton,"ON");
BUTTON_SetTextColor(hButton,0, GUI_WHITE);
BUTTON_SetTextColor(hButton,1, GUI_BLACK);
BUTTON_SetBkColor(hButton,0, GUI_BLUE);
BUTTON_SetBkColor(hButton,1, GUI_RED);
hButton=BUTTON_CreateAsChild (160,140, 60,40,hWin,GUI_ID_BUTTON5,WM_CF_SHOW);
BUTTON_SetFont(hButton,&GUI_Font24_ASCII);
BUTTON_SetText(hButton,"OFF");
BUTTON_SetTextColor(hButton,0, GUI_WHITE);
BUTTON_SetTextColor(hButton,1, GUI_BLACK);
BUTTON_SetBkColor(hButton,0, GUI_BLUE);
BUTTON_SetBkColor(hButton,1, GUI_RED);
GUI_CURSOR_Show();
while(1)
{
GUI_TOUCH_Exec();
WM_Exec();
delay_ms(20);
}
}
|