初级会员
- 积分
- 98
- 金钱
- 98
- 注册时间
- 2015-1-9
- 在线时间
- 0 小时
|
楼主 |
发表于 2015-1-21 12:17:18
|
显示全部楼层
#include <stddef.h>
#include "GUI.h"
#include "DIALOG.h"
#include "WM.h"
#include "BUTTON.h"
#include "CHECKBOX.h"
#include "DROPDOWN.h"
#include "EDIT.h"
#include "FRAMEWIN.h"
#include "LISTBOX.h"
#include "MULTIEDIT.h"
#include "RADIO.h"
#include "SLIDER.h"
#include "TEXT.h"
#include "ROGBAR.h"
#include "SCROLLBAR.h"
#include "LISTVIEW.h"
//EventsFunctionList
//void OnButton5Release(WM_MESSAGE * pMsg);
//void OnButton4Release(WM_MESSAGE * pMsg);
//void OnButton3Release(WM_MESSAGE * pMsg);
//void OnButton2Release(WM_MESSAGE * pMsg);
//void OnButton1Release(WM_MESSAGE * pMsg);
//void OnButton0Released(WM_MESSAGE * pMsg);
//EndofEventsFunctionList
int x = 0 ;
static const GUI_WIDGET_CREATE_INFO _aDialogCreate[] = {
{ FRAMEWIN_CreateIndirect, "Caption", 0, 0, 0, 800,480,FRAMEWIN_CF_MOVEABLE,0},
{ BUTTON_CreateIndirect, "BUTTON0", GUI_ID_BUTTON0, 186,164,136,83, 0,0},
{ BUTTON_CreateIndirect, "BUTTON0", GUI_ID_BUTTON1, 318,164,136,83, 0,0},
{ BUTTON_CreateIndirect, "BUTTON0", GUI_ID_BUTTON2, 450,164,136,83, 0,0},
{ BUTTON_CreateIndirect, "BUTTON0", GUI_ID_BUTTON3, 186,243,136,83, 0,0},
{ BUTTON_CreateIndirect, "BUTTON0", GUI_ID_BUTTON4, 318,243,136,83, 0,0},
{ BUTTON_CreateIndirect, "BUTTON0", GUI_ID_BUTTON5, 450,243,136,83, 0,0}
};
void aintDialog(WM_MESSAGE * pMsg)
{
WM_HWIN hWin = pMsg->hWin;
GUI_DispDecAt(x,100,5 ,2);
}
void InitDialog(WM_MESSAGE * pMsg)
{
WM_HWIN hWin = pMsg->hWin;
FRAMEWIN_SetClientColor(hWin,0xff0000);
FRAMEWIN_SetTitleVis(hWin,0);
BUTTON_SetBkColor(WM_GetDialogItem(hWin,GUI_ID_BUTTON0),BUTTON_CI_UNPRESSED,0xff0000);
//
//GUI_ID_BUTTON1
//
BUTTON_SetBkColor(WM_GetDialogItem(hWin,GUI_ID_BUTTON1),BUTTON_CI_UNPRESSED,0xff0000);
//
//GUI_ID_BUTTON2
//
BUTTON_SetBkColor(WM_GetDialogItem(hWin,GUI_ID_BUTTON2),BUTTON_CI_UNPRESSED,0xff0000);
//
//GUI_ID_BUTTON3
//
BUTTON_SetBkColor(WM_GetDialogItem(hWin,GUI_ID_BUTTON3),BUTTON_CI_UNPRESSED,0xff0000);
//
//GUI_ID_BUTTON4
//
BUTTON_SetBkColor(WM_GetDialogItem(hWin,GUI_ID_BUTTON4),BUTTON_CI_UNPRESSED,0xff0000);
//
//GUI_ID_BUTTON5
//
BUTTON_SetBkColor(WM_GetDialogItem(hWin,GUI_ID_BUTTON5),BUTTON_CI_UNPRESSED,0xff0000);
}
static void _cbCallback(WM_MESSAGE * pMsg)
{
int NCode, Id;
WM_HWIN hWin = pMsg->hWin;
switch (pMsg->MsgId)
{
case WM_PAINT:
 aintDialog(pMsg);
break;
case WM_INIT_DIALOG:
InitDialog(pMsg);
break;
case WM_KEY:
switch (((WM_KEY_INFO*)(pMsg->Data.p))->Key)
{
case GUI_KEY_ESCAPE:
GUI_EndDialog(hWin, 1);
break;
case GUI_KEY_ENTER:
GUI_EndDialog(hWin, 0);
break;
}
break;
case WM_NOTIFY_PARENT:
Id = WM_GetId(pMsg->hWinSrc);
NCode = pMsg->Data.v;
switch (Id)
{
case GUI_ID_OK:
if(NCode==WM_NOTIFICATION_RELEASED)
GUI_EndDialog(hWin, 0);
break;
case GUI_ID_CANCEL:
if(NCode==WM_NOTIFICATION_RELEASED)
GUI_EndDialog(hWin, 0);
break;
case GUI_ID_BUTTON0:
switch(NCode)
{
case WM_NOTIFICATION_RELEASED:
// OnButton0Released(pMsg);
x++
WM_Paint(hWin);
WM_Exec();
break;
}
break;
case GUI_ID_BUTTON1:
switch(NCode)
{
case WM_NOTIFICATION_RELEASED:
// OnButton1Release(pMsg);
x++
WM_Paint(hWin);
WM_Exec();
break;
}
break;
case GUI_ID_BUTTON2:
switch(NCode)
{
case WM_NOTIFICATION_RELEASED:
// OnButton2Release(pMsg);
x++
WM_Paint(hWin);
WM_Exec();
break;
}
break;
case GUI_ID_BUTTON3:
switch(NCode)
{
case WM_NOTIFICATION_RELEASED:
// OnButton3Release(pMsg);
x++
WM_Paint(hWin);
WM_Exec();
break;
}
break;
case GUI_ID_BUTTON4:
switch(NCode)
{
case WM_NOTIFICATION_RELEASED:
// OnButton4Release(pMsg);
x++
WM_Paint(hWin);
WM_Exec();
break;
}
break;
case GUI_ID_BUTTON5:
switch(NCode)
{
case WM_NOTIFICATION_RELEASED:
OnButton5Release(pMsg);
break;
}
break;
}
break;
default:
WM_DefaultProc(pMsg);
}
}
/*********************************************************************
*
* MainTask
*
**********************************************************************
*/
void MainTask(void)
{
GUI_Init();
WM_SetDesktopColor(GUI_WHITE); /* Automacally update desktop window */
WM_SetCreateFlags(WM_CF_MEMDEV); /* Use memory devices on all windows to avoid flicker */
//PROGBAR_SetDefaultSkin(PROGBAR_SKIN_FLEX);
//FRAMEWIN_SetDefaultSkin(FRAMEWIN_SKIN_FLEX);
//PROGBAR_SetDefaultSkin(PROGBAR_SKIN_FLEX);
//BUTTON_SetDefaultSkin(BUTTON_SKIN_FLEX);
//CHECKBOX_SetDefaultSkin(CHECKBOX_SKIN_FLEX);
//DROPDOWN_SetDefaultSkin(DROPDOWN_SKIN_FLEX);
//SCROLLBAR_SetDefaultSkin(SCROLLBAR_SKIN_FLEX);
//SLIDER_SetDefaultSkin(SLIDER_SKIN_FLEX);
//HEADER_SetDefaultSkin(HEADER_SKIN_FLEX);
//RADIO_SetDefaultSkin(RADIO_SKIN_FLEX);
GUI_ExecDialogBox(_aDialogCreate, GUI_COUNTOF(_aDialogCreate), &_cbCallback, 0, 0, 0);
}
我只想按钮按一下x值+1,然后在屏幕上显示出来,可是好象不行, |
|