zoukankan      html  css  js  c++  java
  • 一个按键液晶多级菜单设计方法

    typedef struct
    {
     uchar  KeyStateIndex ;   / / 当前状态索引号
     uchar  KeyDnState ;   / / 按下“向下”键时转向的状态索引号
     uchar  KeyUpState ;   / / 按下“向上”键时转向的状态索引号
     uchar  KeyCrState ;   / / 按下“回车”键时转向的状态索引号
     uchar  KeyBackState ;   / / 按下“退回”键时转向的状态索引号
     void   (*CurrentOperate)( ) ;   / / 当前状态应该执行的功能操作
    }  KbdTabSt ruct ;
    # define SIZE - OF KEYBD - MENU 55   / / 菜单总长度
    KbdTabSt ruct code KeyTab[ SIZE - OF - KEYBD - MENU ] =
    {
     {0 ,0 ,0 ,1 ,0 , MainJob1 } ,
     {1 ,7 ,2 ,8 ,0 , Dsp Point} ,   / / 第一层
     {2 ,1 ,3 ,8 ,0 , DspCurve},   / / 第一层
     {3 ,2 ,4 ,36 ,0 ,Dsp Kout} ,   / / 第一层
     {4 ,3 ,5 ,50 ,0 , DisCloseDown } ,   / / 第一层


     {5 ,4 ,6 ,8 ,0 ,   ModifyPoint} ,   / / 第一层
     {6 ,5 ,7 ,52 ,0 , SetCloseDown } ,   / / 第一层
     {7 ,6 ,1 ,0 ,0 , Cancel} ,   / / 第一层
     …
     …
     {52 ,53 ,53 ,0 ,1 ,   OkSetCloseDown1} ,
     {53 ,52 ,52 ,0 ,1 , OkSetCloseDown2} ,
     {54 ,0 ,0 ,0 ,0 , Disable} ,
       …
       …
    } ;
     void Get Keylnput (void)
    {
     switch ( status &0xf0)
      {
      case 0xe0 :/ / 回车键,找出新的菜单状态编号
       …
             KeyFuncIndex = KeyTab[ KeyFuncIndex ] . KeyCrState ;
       …
       break ;
      case 0xb0 :/ / 向下键,找出新的菜单状态编号
       …
        KeyFuncIndex = KeyTab [ KeyFuncIndex ] . KeyDn2State ;
       …
      break ;
        case 0xd0 :/ / 向上键,找出新的菜单状态编号


       …
        KeyFuncIndex = KeyTab [ KeyFuncIndex ] . KeyUp2State ;
       …
       break ;
      case 0x70 :/ / 回退键,找出新的菜单状态编号
       …
        KeyFuncIndex = KeyTab [ KeyFuncIndex ] . KeyBack2State ;
       …
       break ;
      case 0 ;
        return ;   / / 错误的处理
        break ;
       }
      KeyFuncPt r = KeyTab[ KeyFuncIndex ] . CurrentOperate ;
      ( * KeyFuncPt r) () ;   / / 执行当前按键的操作

  • 相关阅读:
    sqlserver 时间格式函数详细
    asp.net中session的原理及应用
    asp.net中的cookie
    WCF 应用(一)
    c#操作word文档之简历导出
    浅解多线程
    .net反射详解
    正则表达式、常用的匹配总结
    存储过程详解
    jquery.pagination.js分页
  • 原文地址:https://www.cnblogs.com/longbiao831/p/4556292.html
Copyright © 2011-2022 走看看