home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
QBasic & Borland Pascal & C
/
Delphi5.iso
/
C
/
Samples
/
CSAPE32.ARJ
/
EXAMPLES
/
DEMOHELP.C
< prev
next >
Wrap
C/C++ Source or Header
|
1991-03-09
|
3KB
|
135 lines
/*
demohelp.c
C-scape 3.2 Example Program
Copyright (c) 1988, 1990 by Oakland Group, Inc.
ALL RIGHTS RESERVED.
This program demonstrates the use of the C-scape help system.
The help file "demohelp.hlp" is used.
Revision History:
-----------------
4/01/90 jmd ansi-fied
6/06/90 jmd changed main to return an int
9/14/90 bkd changed to use exit(0) instead of return(0).
10/19/90 pmcm included ostdlib.h for exit(), added return(1)
12/01/90 ted prototyped main, except if Turbo C++.
12/04/90 ted restored "" includes for C-scape headers (not <> includes).
*/
#include <stdio.h>
#include "cscape.h"
#include "ostdlib.h" /* for exit() */
#include "helpdecl.h"
#include "popdecl.h"
/*** Function prototypes ***/
/* Turbo C++ complains if main is prototyped */
#ifndef TCP
int main(void);
#endif
int test(int *i, long *l, long *money, char *s);
struct hx_struct hxd = { 0x07, 0x0f, 0x70, 0x07, bd_xref};
int main(void)
{
FILE *fp;
char string[25];
int i = 0;
long l = 0L;
long money = 0L;
string[0] = '\0';
/* Initialize the display */
disp_Init(def_ModeText, FNULL);
fp = fopen("demohelp.hlp", "rb");
if (fp == NULL) {
pop_Prompt("Unable to open help file.\n", -1, -1, -1, 26, (byte) 0x70, bd_2);
/* Close down the display interface */
disp_Close();
exit(1);
return(1);
}
/*
help_Init sets up the help system.
The first argument is a pointer to the help file.
The second argument is a pointer to the help display function.
The third argument tells the help system how much space to allocate
to hold the help messages. This is the maximum size of a help message.
The cscape field functions automatically call help when F1 is pressed.
(see fnspec.c)
*/
help_Init(fp, help_Xref, 6000, (char *) &hxd);
test(&i, &l, &money, string);
fclose(fp);
/* Close down the display interface */
disp_Close();
exit(0);
return(0);
}
int test(int *i, long *l, long *money, char *s)
{
menu_type menu;
sed_type sed;
int ret;
menu = menu_Open();
menu_Printf(menu, "@p[0,0]int:");
menu_Printf(menu, "@p[2,0]long:");
menu_Printf(menu, "@p[4,0]money:");
menu_Printf(menu, "@p[6,0]string:");
menu_Printf(menu, "@p[0,11]@fd2[####]",
i, &int_funcs, "Enter an integer (0-100)", "(0,100)");
menu_Printf(menu, "@p[2,7]@fd2[########]",
l, &long_funcs, "Enter a long (0-10000)", "(0,10000)");
menu_Printf(menu, "@p[4,7]@fd2[########]",
money, &cmoney_funcs, "Enter the amount (0-100.00)", "(0,10000)");
menu_Printf(menu, "@p[6,8]@fd3[################] ",
s, &string_funcs, "Enter a string", NULL, "^");
menu_Flush(menu);
sed = sed_Open(menu);
sed_SetColors(sed, 0x70, 0x70, 0x07);
sed_SetBorder(sed, bd_std);
sed_SetBorderTitle(sed, "Press F1 for help");
sed_SetPosition(sed, 7, 19);
sed_Repaint(sed);
/*
The label is used to determine which help chapter to use for the sed.
The field number determines which paragraph to use.
(see demohelp.hlp)
*/
sed_SetLabel(sed, 1);
ret = sed_Go(sed);
menu_Close(menu);
sed_Close(sed);
return(ret);
}