home *** CD-ROM | disk | FTP | other *** search
- /*********************
- *
- * mn_test.c - menu test program.
- *
- * Purpose: This file contains functions to test the menu functions.
- *
- * Blackstar C Function Library
- * (c) Copyright 1985 Sterling Castle Software
- *
- *******/
-
- #include <stdio.h>
- #include <stdlib.h>
- #include "blackstr.h"
- #include "sc_head.h"
- #include "kb_head.h"
- #include "pr_head.h"
- #include "ut_head.h"
- #include "gr_head.h"
- #include "tx_head.h"
-
- char *selbuf[] ={"first","second","third","fourth"};
-
- void main()
- {
- struct MENU menu;
- extern int hour_,minute_,sec_,hsec_,year_,month_,day_;
-
- /***************************************************************
- INITIALIZE THE SCREEN AND SAY HELLO
- ***************************************************************/
- kb_init(NULL,NULL,NULL);
- sc_init(MO_CO80,BLUE,WHITE); /* init screen */
- sc_setcur(0,0);
- sc_puts("Hello from mn_test.\n\n");
- ut_gtod();
- sc_printf("\nTime: %d:%d:%d.%d",hour_,minute_,sec_,hsec_);
- sc_printf("\nDate: %d/%d/%d \n\n",month_,day_,year_);
-
- /***************************************************************
- SET UP THE MENU FOR RETURNING SELECTION NUMBER
- ***************************************************************/
- menu.col = 25;
- menu.row = 0;
- menu.title="Test Menu";
- menu.width = 12;
- menu.field = 10;
- menu.noel = 4;
- menu.noelx = 1;
- menu.sel = selbuf;
- tx_menudsp(&menu);
- sc_printf("\n\n\n\n\nYou picked the %s one.\n", selbuf[tx_menusel(&menu)]);
- sc_printf("Strike key to continue...");
- kb_getchar();
-
- /***************************************************************
- NOW DO A MENU RETURNING THE STRING SELECTED
- ***************************************************************/
- menu.col = 45;
- menu.row = 0;
- menu.width = 23;
- menu.field = 10;
- menu.noel = 4;
- menu.noelx = 2;
- tx_menudsp(&menu);
- sc_setcur(0,8);
- sc_printf("\n\n\n\n\n\n\n\nYou picked the %s one.\n", selbuf[tx_menusel(&menu)]);
-
- sc_color(WHITE,BLUE);
- sc_setcur(0,22); sc_eeol();
- sc_puts("END OF TEST - Press any key to exit...");
- kb_getc();
- sc_color(WHITE,BLACK);
- sc_clr();
- }
-