...UCGUI的界面里要加自己的应该程序,应该怎么加。求高手回答。。_百...
发布网友
发布时间:2024-10-19 22:46
我来回答
共1个回答
热心网友
时间:2024-12-02 00:46
我给你写个简单的,你参考下。
/*
******************************************************************
** uCGUIBuilder **
** Version: 4.0.0.0 **
** 2012 / 04 **
** CpoyRight to: wyl **
** Email:ucguibuilder@163.com **
** This text was Created by uCGUIBuilder **
******************************************************************/
#include <stddef.h>
#include <stdio.h>
#include "GUI.h"
#include "WM.h"
#include "BUTTON.h"
#include "FRAMEWIN.h"
static const GUI_WIDGET_CREATE_INFO _aDialogCreate[] =
{
{ FRAMEWIN_CreateIndirect, "Caption", 0, 0, 0, 320,240,0,0},
{ BUTTON_CreateIndirect, "BUTTON", GUI_ID_BUTTON0, 10, 10,300, 200, 0,0},
};
void InitDialog(WM_MESSAGE * pMsg)
{
WM_HWIN hWin = pMsg->hWin;
//FRAMEWIN
FRAMEWIN_AddCloseButton(hWin, FRAMEWIN_BUTTON_RIGHT, 0);
FRAMEWIN_AddMaxButton(hWin, FRAMEWIN_BUTTON_RIGHT, 1);
FRAMEWIN_AddMinButton(hWin, FRAMEWIN_BUTTON_RIGHT, 2);
}
static void doUserApp(void)
{
;;;
}
static void _cbCallback(WM_MESSAGE * pMsg)
{
int NCode, Id;
WM_HWIN hWin = pMsg->hWin;
WM_HWIN hEdit = WM_GetDialogItem(hWin, GUI_ID_EDIT0);
char str[30] = "";
switch (pMsg->MsgId)
{
case WM_INIT_DIALOG:
InitDialog(pMsg);
break;
case WM_NOTIFY_PARENT:
Id = WM_GetId(pMsg->hWinSrc);
NCode = pMsg->Data.v;
if (NCode == WM_NOTIFICATION_RELEASED)//如果按钮已被释放;如果缺省这句会执行3次(即BUTTON的3个通知代码)
{
switch (Id)
{
case GUI_ID_BUTTON0:
{
doUserApp();
}
break;
}
}
break;
default:
WM_DefaultProc(pMsg);
}
}
/*GUI初始化*/
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 */
while (1)
{
GUI_ExecDialogBox(_aDialogCreate, GUI_COUNTOF(_aDialogCreate), &_cbCallback, 0, 0, 0);
}
}