|
发表于 2019-8-15 13:32:59
|
显示全部楼层
本帖最后由 horizon0315 于 2019-8-15 13:34 编辑
贴一个我们现在用的界面结构,这个文件内容是其中的一个界面,其他的都类似结构。几十个界面,配合比较理想
进入这个界面需要先调用界面初始化函数,然后根据消息调用消息处理函数。
#include "UI_Includes.h"
#include "UI_Start.h"
//0.首界面控件定义
const Window Window_StartPage={gStartPage,0,0,480,320, SystemColor,0};
const Shape Shape_StartPage={gStartPage,10,10,460,300,2,SystemColor,SystemColor,sRectangle};
const Label Label_StartPage[]={
{gStartPage,30,30,CommonLabelColor,SystemColor,24,"编号:",1},
{gStartPage,158,152,CommonLabelColor,SystemColor,24,"( Ver4.",1},
{gStartPage,290,152,CommonLabelColor,SystemColor,24,")",1}
};
const Variable Variable_StartPage[]={
{gStartPage,240,152,SystemColor,SystemColor,24,Version,0,0,&SystemSoftwareVision,0,1}, //版本号
{gStartPage,70,210,Red,SystemColor,24,String,0,999,StatusVariableString1,0,1}, //提示信息
};
//45,开始页
void UI_StartPage_Init(void)
{
//注册本页面的控件
GUI_Register_Window(&Window_StartPage);
GUI_Register_Label(Label_StartPage,4);
GUI_WindowInit(); //绘制界面
}
//开始页
void UI_StartPage_MessageProcess(void)
{
u16 msgtype,msgcontent;
msgtype = UI_Message.MessageType;
msgcontent = UI_Message.MessageContent;
//--------------------------------------------------------------------------------------------------------------
//按键处理
if(msgtype == MsgType_KeyPressUp) //按键发来的消息
{
if(msgcontent == kEnter) //按下确认键
{
if(RegisterFlag == 1) //正常
{
UI_Switch(gMainPage); //跳转到主页:
}
else
{
UI_Switch(gFactoryParameter); //跳到工厂设置 页
}
}
}
//--------------------------------------------------------------------------------------------------------------
//串口消息处理
else if(msgtype == MsgType_UartData) //串口发来的消息
{
}
}
|
|