Category : C Source Code
Archive   : TCU_31.ZIP
Filename : PULLDOWN.C

 
Output of file : PULLDOWN.C contained in archive : TCU_31.ZIP
#include "..\include\tcu.h"
#include
#include
#include
#include

char *headings[] = { "RRecords", "FFinance", "LLoad/Store",
"IInvoices", "SStatistics", "OLOGOUT",
NULL };

void main (void)
{
MENU records_m,
finance_m,
load_m,
invoices_m,
statistics_m,
*mlist[6];
FORM form;
FIELD_VALUE frm_val;
int message,
menu,
option,
r1,r2;
char msg[26];
PULLDOWN pd;
void far help_handler (int),
far p_help_handler (int);

char *records_options[] =
{ "PPatient", "SStaff", "DDoctors", "USUppliers", "AAppointment",
"IInvoice", NULL };

char *finance_options[] =
{ "Credits", "Debits", "Insurances", "Unpaid", NULL };

char *load_options[] =
{ "Remote data load", "Send data to remote", NULL };

char *invoices_options[] =
{ "New", "Browse all", "Find", "Delete", "Print", NULL };

char *statistics_options[] =
{ "Patient", "Staff", "Invoices", "Appointments", NULL };

set_mouse_mode (1);

r1 = define_menu (&records_m,
"Records",
colour_attrib (YELLOW, CYAN), /* Title */
colour_attrib (BLUE, CYAN), /* Box */
colour_attrib (WHITE, MAGENTA), /* Options */
colour_attrib (WHITE, BLUE), /* Selected */
colour_attrib (LIGHTGRAY, MAGENTA), /* Deselected */
ESC_ESC | ESC_CNTL_C | ESC_PGUP | ESC_FUNC,
BOX_DOUBLE,
records_options,
colour_attrib (LIGHTRED, MAGENTA));

r1 = define_menu (&finance_m,
"Finance",
colour_attrib (YELLOW, CYAN), /* Title */
colour_attrib (BLUE, CYAN), /* Box */
colour_attrib (WHITE, MAGENTA), /* Options */
colour_attrib (WHITE, BLUE), /* Selected */
colour_attrib (LIGHTGRAY, MAGENTA), /* Deselected */
ESC_ESC | ESC_CNTL_C | ESC_PGUP | ESC_FUNC,
BOX_DOUBLE,
finance_options,
0);

r1 = define_menu (&load_m,
"Data Load",
colour_attrib (YELLOW, CYAN), /* Title */
colour_attrib (BLUE, CYAN), /* Box */
colour_attrib (WHITE, MAGENTA), /* Options */
colour_attrib (WHITE, BLUE), /* Selected */
colour_attrib (LIGHTGRAY, MAGENTA), /* Deselected */
ESC_ESC | ESC_CNTL_C | ESC_PGUP | ESC_FUNC,
BOX_DOUBLE,
load_options,
0);

r1 = define_menu (&invoices_m,
"Invoices",
colour_attrib (YELLOW, CYAN), /* Title */
colour_attrib (BLUE, CYAN), /* Box */
colour_attrib (WHITE, MAGENTA), /* Options */
colour_attrib (WHITE, BLUE), /* Selected */
colour_attrib (LIGHTGRAY, MAGENTA), /* Deselected */
ESC_ESC | ESC_CNTL_C | ESC_PGUP | ESC_FUNC,
BOX_DOUBLE,
invoices_options,
0);

r1 = define_menu (&statistics_m,
"Statistics",
colour_attrib (YELLOW, CYAN), /* Title */
colour_attrib (BLUE, CYAN), /* Box */
colour_attrib (WHITE, MAGENTA), /* Options */
colour_attrib (WHITE, BLUE), /* Selected */
colour_attrib (LIGHTGRAY, MAGENTA), /* Deselected */
ESC_ESC | ESC_CNTL_C | ESC_PGUP | ESC_FUNC,
BOX_DOUBLE,
statistics_options,
0);

set_menu_help (&invoices_m, help_handler);
set_pulldown_help (&pd, p_help_handler);

set_menu_option (&invoices_m, 4, 0);

mlist[0] = &records_m;
mlist[1] = &finance_m;
mlist[2] = &load_m;
mlist[3] = &invoices_m;
mlist[4] = &statistics_m;
mlist[5] = NULL;

define_pulldown (&pd,
colour_attrib (WHITE,BLUE),
colour_attrib (YELLOW,BLUE),
colour_attrib (YELLOW,RED),
headings,
colour_attrib (LIGHTGREEN, BLUE),
mlist);

set_pulldown_help (&pd, p_help_handler);

load_form (&form, "pulldown");

get_field_id (&form, "menu", &menu);
get_field_id (&form, "option", &option);
get_field_id (&form, "message", &message);

set_field_mode (&form, menu, FORM_NOENTER);
set_field_mode (&form, option, FORM_NOENTER);
set_field_mode (&form, message, FORM_CONFIRM);

display_form (&form, 1, 2);

do {
read_pulldown_selection (&pd, &r1, &r2);
if (r1) {
frm_val.v_int = r1;
put_field (&form, menu, &frm_val);
frm_val.v_int = r2;
put_field (&form, option, &frm_val);
if (r2)
msg[0] = '\0';
else
strcpy (msg, "No sub-menu available");
frm_val.v_string = msg;
put_field (&form, message, &frm_val);
}
} while (r1);

remove_pulldown (&pd);

remove_form (&form);
}

void far help_handler (int option)
{
NOTICE notice;

prepare_notice (¬ice,
"Help",
colour_attrib (BLUE, LIGHTGRAY),
colour_attrib (LIGHTBLUE, LIGHTGRAY),
colour_attrib (BLUE, LIGHTGRAY),
BOX_SINGLE);

notice_text (¬ice, "Sorry, no help defined currently");
notice_text (¬ice, "for option %d.", option);

display_notice (¬ice, 25, 20);

clear_notice (¬ice);
}

void far p_help_handler (int option)
{
NOTICE notice;

prepare_notice (¬ice,
"HELP",
colour_attrib (BLUE, LIGHTGRAY),
colour_attrib (LIGHTBLUE, LIGHTGRAY),
colour_attrib (BLUE, LIGHTGRAY),
BOX_DOUBLE);

notice_text (¬ice,
"Sorry, no help defined currently");
notice_text (¬ice,
"for option %s.", headings[option-1]);

display_notice (¬ice,
23, 20);

clear_notice (¬ice);
}


  3 Responses to “Category : C Source Code
Archive   : TCU_31.ZIP
Filename : PULLDOWN.C

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/