home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c222 / 1.ddi / DEMOS / MN_TEST.C < prev    next >
Encoding:
C/C++ Source or Header  |  1990-05-22  |  2.2 KB  |  76 lines

  1. /*********************
  2.  *
  3.  *  mn_test.c - menu test program.
  4.  *
  5.  *  Purpose: This file contains functions to test the menu functions.
  6.  *
  7.  *  Blackstar C Function Library
  8.  *  (c) Copyright 1985 Sterling Castle Software
  9.  *
  10.  *******/
  11.  
  12. #include <stdio.h>
  13. #include <stdlib.h>
  14. #include "blackstr.h"
  15. #include "sc_head.h"
  16. #include "kb_head.h"
  17. #include "pr_head.h"
  18. #include "ut_head.h"
  19. #include "gr_head.h"
  20. #include "tx_head.h"
  21.  
  22. char *selbuf[] ={"first","second","third","fourth"};
  23.  
  24. void main()
  25. {
  26.     struct MENU menu;
  27.     extern int hour_,minute_,sec_,hsec_,year_,month_,day_;
  28.  
  29.     /***************************************************************
  30.      INITIALIZE THE SCREEN AND SAY HELLO
  31.     ***************************************************************/
  32.     kb_init(NULL,NULL,NULL);
  33.     sc_init(MO_CO80,BLUE,WHITE);            /* init screen */
  34.     sc_setcur(0,0);
  35.     sc_puts("Hello from mn_test.\n\n");
  36.     ut_gtod();
  37.     sc_printf("\nTime: %d:%d:%d.%d",hour_,minute_,sec_,hsec_);
  38.     sc_printf("\nDate: %d/%d/%d \n\n",month_,day_,year_);
  39.  
  40.     /***************************************************************
  41.      SET UP THE MENU FOR RETURNING SELECTION NUMBER
  42.     ***************************************************************/
  43.     menu.col = 25;
  44.     menu.row = 0;
  45.     menu.title="Test Menu";
  46.     menu.width = 12;
  47.     menu.field = 10;
  48.     menu.noel = 4;
  49.     menu.noelx = 1;
  50.     menu.sel = selbuf;
  51.     tx_menudsp(&menu);
  52.     sc_printf("\n\n\n\n\nYou picked the %s one.\n", selbuf[tx_menusel(&menu)]);
  53.     sc_printf("Strike key to continue...");
  54.     kb_getchar();
  55.  
  56.     /***************************************************************
  57.      NOW DO A MENU RETURNING THE STRING SELECTED
  58.     ***************************************************************/
  59.     menu.col = 45;
  60.     menu.row = 0;
  61.     menu.width = 23;
  62.     menu.field = 10;
  63.     menu.noel = 4;
  64.     menu.noelx = 2;
  65.     tx_menudsp(&menu);
  66.     sc_setcur(0,8);
  67.     sc_printf("\n\n\n\n\n\n\n\nYou picked the %s one.\n", selbuf[tx_menusel(&menu)]);
  68.  
  69.     sc_color(WHITE,BLUE);
  70.     sc_setcur(0,22);  sc_eeol();
  71.     sc_puts("END OF TEST - Press any key to exit...");
  72.     kb_getc();
  73.     sc_color(WHITE,BLACK);
  74.     sc_clr();
  75. }
  76.