示例#1
0
// Main Function
void _main(void)
{
  HANDLE menu_handle = MenuNew (2, 240, 18);
  MenuAddText (menu_handle, 0, "First", 1, DMF_TOP_SUB);
  MenuAddText (menu_handle, 1, "Subitem 1.1", 5, DMF_CHILD_SUB);
  MenuAddText (menu_handle, 5, "Subitem 1.1.1", 8, DMF_CHILD_SUB);
  MenuAddText (menu_handle, 5, "Subitem 1.1.2", 9, DMF_CHILD);
  MenuAddText (menu_handle, 8, "Subitem 1.1.1.1", 10, DMF_CHILD);
  MenuAddText (menu_handle, 1, "Subitem 1.2", 6, DMF_CHILD);
  MenuAddText (menu_handle, 0, "Second", 2, DMF_TOP_SUB);
  MenuAddText (menu_handle, 2, "Subitem 2.1", 7, DMF_CHILD);
  MenuAddText (menu_handle, -1, "Third", 3, DMF_TOP);
  MenuAddText (menu_handle, -1, "Fourth", 4, DMF_TOP);
  HANDLE exec_handle = MenuBegin (NULL, 0, 0, MBF_HMENU, menu_handle);
  short result;
  do {
    result = MenuKey (exec_handle, ngetchx ());
  } while (result == M_NOTMENUKEY);
  MenuEnd (exec_handle);
  MenuUpdate ();
  push_shortint (result);
}
示例#2
0
/******************************************************************
*  Function: TopMenu
*
*  Purpose: Generates the top level menu.
* 
******************************************************************/
static int TopMenu( void )
{
  char ch;

  /* Print the top-level menu to stdout */
  while (1)
  {
    MenuBegin("      Memory Test Main Menu");
    MenuItem( 'a', "Test RAM" );
    MenuItem( 'b', "Test Flash");
    ch = MenuEnd( 'a', 'b' );

    switch(ch)
    {
      MenuCase('a',TestRam());
      MenuCase('b',TestFlash(TEST));
      MenuCase('e',FlashErase());       /* hidden option */
      MenuCase('m',TestFlash(SHOWMAP)); /* hidden option */
    }
    if (ch == 'q')
      break;
  }
  return (ch);
}