📄 menu.c.bak
字号:
else
IntValue[sel-4] = 23;
IntValue[sel-3] = 30;
itoa(IntValue[sel-4],StrValue[sel-4],10); //转化为字符串
}
else
IntValue[sel-3] = 0;
itoa(IntValue[sel-3],StrValue[sel-3],10); //转化为字符串
}
else //时钟数
{
if(IntValue[sel-3] > 0)
IntValue[sel-3]--;
else
IntValue[sel-3] = 23;
itoa(IntValue[sel-3],StrValue[sel-3],10); //转化为字符串
}
MenuFlag = 0;
break;
case TM_KEYRIGHT: //按向左键
if(sel == 2) //退出
{
WinId = 3;
WinFlag = 0;
}
else if(sel == 1)
sel = 3;
else if(sel < 10)
sel++;
else
sel = 2;
MenuFlag = 0;
break;
case TM_KEYLEFT: //按向右键
if((sel < 10) && (sel > 2))
sel--;
MenuFlag = 0;
break;
case TM_KEYMEASURE: // 此时按测量键时,如果未进入通讯及测量操作,
//则开始测量,否则提示用户稍后进行
switch(TStatus)
{
//注意显示信息不能覆盖界面上的静态数据
case Idle: //空闲时进入测量界面
WinId = 1; //测量前界面
WinFlag = 0;
break;
case Measure: //正在启动测量
SetFont(2); //设置字体
DispString(7,7,(char *)"正在启动测量!",0);
break;
case communication: //正在传输数据
SetFont(2); //设置字体
DispString(7,7,(char *)"正在传输数据!",0);
break;
case Buff: //无效时错误
SetFont(2); //设置字体
DispString(7,7,(char *)"系统错误!",0);
break;
default:
break;
}
MenuFlag = 0;
break;
default:
break;
} //switch(pMsg->message)
}//while(MenuFlag)
}//while(WinFlag)
}
/****************************************************************************
* 函数名:SetTime
* 功能: 设置时间
白天
返回
2006年11月21日
21:45
---上下键选择,向右键进入下一个设置
---上下键对数据进行修正,上加下减
任何时候按功能键--提示是否保存并退出
说明: 返回时WinId为3(主界面)
日期: 2000-2999
月份; 1-12
日期: 1-31
小时: 0-23
分钟: 0-59
****************************************************************************/
void SetTime()
{
uint8 sel=1; //当前选择的菜单
uint8 WinFlag = 1; //懑足窗体切换条件时置为0
uint8 MenuFlag ;//满足菜单选择条件时,置为0
int8 date[20];
int8 StrValue[5][5]; //保存年,月,日,时段小时,时段分钟的字符串
uint16 IntValue[6]; //保存年,月,日,时段小时,时段分钟,用户状态的数值
MSGtemp *pMsg; //声明消息
SetFont(2);
PC_GetDateTime(date); //"YYYY-MM-DD HH:MM:SS"
strcpy(StrValue[0],SubString(date,0,4));
strcpy(StrValue[1],SubString(date,5,2));
strcpy(StrValue[2],SubString(date,8,2));
strcpy(StrValue[3],SubString(date,12,2));
strcpy(StrValue[4],SubString(date,15,2));
strcpy(StrValue[5],(char *)"0");
strcpy(StrValue[6],(char *)"0");
for(i=0;i<7;i++)
IntValue[i] = atoi(StrValue[i]);
//根据系统时间初始化以上的值
while(WinFlag)
{
clr_scr();
//显示界面静态数据
DispString(50,50,(char *)"时间设置",0);
DispPhoto (145, 150, (char *)"年",0);
DispPhoto (195, 150, (char *)"月",0);
DispPhoto (245, 150, (char *)"日",0);
DispPhoto (195, 180, (char *)":",0);
//显示界面动态数据
DispPhoto (100, 100, (char *)"返回", sel==1?1:0);
DispPhoto (100, 150, StrValue[0], sel==2?1:0);
DispPhoto (170, 150, StrValue[1], sel==3?1:0);
DispPhoto (220, 150, StrValue[2], sel==4?1:0);
DispPhoto (170, 180, StrValue[3], sel==5?1:0);
DispPhoto (220, 180, StrValue[4], sel==6?1:0);
MenuFlag = 1;
while(MenuFlag)
{
pMsg = GetMessagetemp(task1_tmq);
switch(pMsg->message)
{
case TM_KEYOK:
clr_kb(); //清除键盘缓存消息
DispString(1,0,(char *)"正在退出,是否保存消息?",0);
DispString(1,2,(char *)"功能键是,其它键否",0);
while (GetMessagetemp(task1_tmq)->message == 0x00);
if(GetMessagetemp(task1_tmq)->message == TM_KEYOK)
;//保存设置的数据于分配的地址
WinId = 3;
MenuFlag = 0;
WinFlag = 0;
break;
case TM_KEYUP: //向上 数值累加
switch(sel)
{
case 2: //年份
if(IntValue[sel-1] < 2999)
IntValue[sel-1]++;
else
IntValue[sel-1] = 2000;
itoa(IntValue[sel-1],StrValue[sel-1],10); //转化为字符串
break;
case 3: //月份
if(IntValue[sel-1] < 12)
IntValue[sel-1]++;
else
IntValue[sel-1] = 1;
itoa(IntValue[sel-1],StrValue[sel-1],10); //转化为字符串
break;
case 4: //日子
if(IntValue[sel-1] < 31)
IntValue[sel-1]++;
else
IntValue[sel-1] = 1;
itoa(IntValue[sel-1],StrValue[sel-1],10); //转化为字符串
break;
case 5: //小时数
if(IntValue[sel-1] < 23)
IntValue[sel-1]++;
else
IntValue[sel-1] = 0;
itoa(IntValue[sel-1],StrValue[sel-1],10); //转化为字符串
break;
case 6: //分钟数
if(IntValue[sel-1] < 59)
IntValue[sel-1]++;
else
IntValue[sel-1] = 0;
itoa(IntValue[sel-1],StrValue[sel-1],10); //转化为字符串
break;
default:
break;
}
MenuFlag = 0;
break;
case TM_KEYDOWN: //向下 数值减少
switch(sel)
{
case 2: //年份
if(IntValue[sel-1] > 2000)
IntValue[sel-1]--;
else
IntValue[sel-1] = 2999;
itoa(IntValue[sel-1],StrValue[sel-1],10); //转化为字符串
break;
case 3: //月份
if(IntValue[sel-1] > 1)
IntValue[sel-1]--;
else
IntValue[sel-1] = 12;
itoa(IntValue[sel-1],StrValue[sel-1],10); //转化为字符串
break;
case 4: //日子
if(IntValue[sel-1] > 1)
IntValue[sel-1]--;
else
IntValue[sel-1] = 31;
itoa(IntValue[sel-1],StrValue[sel-1],10); //转化为字符串
break;
case 5: //小时数
if(IntValue[sel-1] > 0)
IntValue[sel-1]--;
else
IntValue[sel-1] = 23;
itoa(IntValue[sel-1],StrValue[sel-1],10); //转化为字符串
break;
case 6: //分钟数
if(IntValue[sel-1] > 0)
IntValue[sel-1]--;
else
IntValue[sel-1] = 59;
itoa(IntValue[sel-1],StrValue[sel-1],10); //转化为字符串
break;
default:
break;
}
MenuFlag = 0;
break;
case TM_KEYRIGHT: //按向右键
if(sel == 1)
sel = 6; //菜单循环
else
sel--;
MenuFlag = 0;
break;
case TM_KEYLEFT: //按向左键
if(sel == 6)
sel = 1; //菜单循环
else
sel--;
MenuFlag = 0;
break;
case TM_KEYMEASURE: // 此时按测量键时,如果未进入通讯及测量操作,
//则开始测量,否则提示用户稍后进行
switch(TStatus)
{
//注意显示信息不能覆盖界面上的静态数据
case Idle: //空闲时进入测量界面
WinId = 1; //测量前界面
WinFlag = 0;
break;
case Measure: //正在启动测量
SetFont(2); //设置字体
DispString(7,7,(char *)"正在启动测量!",0);
break;
case communication: //正在传输数据
SetFont(2); //设置字体
DispString(7,7,(char *)"正在传输数据!",0);
break;
case Buff: //无效时错误
SetFont(2); //设置字体
DispString(7,7,(char *)"系统错误!",0);
break;
default:
break;
}
MenuFlag = 0;
break;
default:
break;
} //switch(pMsg->message)
}//while(MenuFlag)
}//while(WinFlag)
}
/****************************************************************************
* 函数名:ShowAdvice
* 功能: 显示医嘱信息,按测量键时,进入测量前界面;按上下键时,查看医嘱信息,按向左键
时返回上层菜单
注意: 没有医嘱信息时,
返回值: 无
****************************************************************************/
void ShowAdvice()
{
clr_scr();
DispString(1,1,(char *)"按上下键时,查看医嘱信息",0);
DispString(1,2,(char *)"按向左键时返回上层菜单",0);
DispMessage(100,120,(char *)"医嘱信息为空?按任意键返回",1);
}
/****************************************************************************
* 函数名:SetVolume
* 功能: 设置音量
打开/关闭/增加/降低
说明: 返回时WinId为3(主界面)
****************************************************************************/
void SetVolume()
{
int a;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -