初中生
最后登录1970-1-1
在线时间 小时
注册时间2016-1-10
|
楼主 |
发表于 2016-1-13 20:25:59
|
显示全部楼层
还是直接请教吧 看看我的代码有什么问题
/*File : WIDGET_Edit.c*/
----------------------------------------------------------------------
*/
#include <stdlib.h>
#include "GUI.h"
#include "EDIT.h"
#include "DIALOG.h"
#include "WM.h"
#include "EDIT.h"
#include "FRAMEWIN.h"
#include "TEXT.h"
GUI_COLOR _acColor[3] = {GUI_BLUE,GUI_RED,GUI_YELLOW};
static char ucBackColor;
/*********************************************************************
*
* Defines
*
**********************************************************************
*/
#define WM_APP_SHOW_TEXT (WM_USER + 0)
/*********************************************************************
/*********************************************************************
*
* Static data
*
**********************************************************************
*/
/*********************************************************************
*
* Dialog resource
*
* These tables contain the information required to create the dialogs.
* It has been created manually, but could also be created by the GUIBuilder.
*/
static const GUI_WIDGET_CREATE_INFO _aDialogCreate1[] = {
{ FRAMEWIN_CreateIndirect,”Dialog”,0,10,10,180,230,0,0 },
{ EDIT_CreateIndirect, "Edit", EDIT0, 5, 30, 80, 20, 0},//set
{ TEXT_CreateIndirect, "Display ",GUI_ID_TEXT1, 5, 10, 50, 20, TEXT_CF_LEFT }//dis
};
/*********************************************************************
*
* _cbBkWindow
*
* Function description
* Callback routine of the background window.
* It shows the sample title and draws the background.
*/
static void _cbBkWindow(WM_MESSAGE * pMsg) {
switch (pMsg->MsgId) {
case WM_PAINT:
GUI_SetBkColor(GUI_BLUE);
GUI_Clear();
GUI_SetColor(GUI_WHITE);
GUI_SetFont(&GUI_Font24_ASCII);
GUI_DispStringHCenterAt("WIDGET - Sample", 160, 5);
break;
case WM_TIMER://处理时间显示的信息,每秒钟修改一次时间
if(!TimeDisplay||UserApp_Flag)
{
WM_RestartTimer(pMsg->Data.v, 250);
break;
}
/* 获取text句柄 */
hText = WM_GetDialogItem(pMsg->hWin, GUI_ID_TEXT1);
/* 转换rtc值至北京时间 */
RTC_TimeCovr(&systmtime);
/* 转换成字符串 */
sprintf(text_buffer,"%02d:%02d:%02d",systmtime.tm_hour,systmtime.tm_min,systmtime.tm_sec);
/* 输
出时间 */
TEXT_SetText(hText,text_buffer);
WM_RestartTimer(pMsg->Data.v, 250);
break;
default:
WM_DefaultProc(pMsg);
}
}
/*********************************************************************
*
* Public code
*
**********************************************************************
*/
/*********************************************************************
*
* MainTask
*/
void FrameWin_Demo(void){
WM_HWIN hFrameWin;
WM_HWIN hDialog;
//
// Enable use of memory devices
//
WM_SetCreateFlags(WM_CF_MEMDEV);
GUI_Init();
WM_SetCallback(WM_HBKWIN, _cbBkWindow);
hTimer = WM_CreateTimer(WM_HBKWIN, 0, 1000, 0);
hFrameWin = FRAMEWIN_Create("FrameWindow", NULL, WM_CF_SHOW, 40, 44, 240, 152);
GUI_CreateDialogBox())
while (1) {
GUI_Delay(10);
GUI_Exec();
}
}
|
|