home *** CD-ROM | disk | FTP | other *** search
- /*
- demohelp.c
-
- Copyright (c) 1988, 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.
- */
-
- #include <stdio.h>
- #include <cscape.h>
-
- #include <helpdecl.h>
- #include <popdecl.h>
-
- /*** Note: C-scape uses the _arg macro to turn off prototyping
- for older compilers */
-
- int test(_arg4(int *, long *, long *, char *));
-
- struct hx_struct hxd = { '\x07', '\x0f', '\x70', '\x07', bd_xref};
-
- void main()
- {
- FILE *fp;
-
- char string[25];
- int i = 0;
- long l = 0L;
- long money = 0L;
-
- string[0] = '\0';
-
- /* Initialize the display */
- disp_Init(def_ModeText, NULL);
-
- fp = fopen("demohelp.hlp", "rb");
-
- if (fp == NULL) {
- pop_Prompt("Unable to open help file.\n", -1, -1, -1, 26, (char) '\x70', bd_2);
-
- /* Close down the display interface */
- disp_Close();
- return;
- }
-
- /*
- 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();
- }
-
- int test(i, l, money, s)
- int *i;
- long *l;
- long *money;
- char *s;
- {
- menu_type menu;
- sed_type sed;
- int ret;
-
- menu = menu_Open();
-
- menu_Printf(menu, "@c[\x70]");
- 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, '\x70', '\x70', '\x07');
- 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);
- }
-
-