Newer
Older
Microsoft / screendoor / SHOW_HLP.C
@tundra tundra on 24 May 2012 1 KB Initial revision
/*  SHOW_HLP.C - Help Screen Support For The vkeyin() Routine
				Last Modified: 06/13/87
				Copyright (C) 1986, 1987  T.A. Daneliuk
*/


#include		<stdio.h>
#include		<system.h>
#include		<t&r.h>
#include		<vstruct.h>

char	vpg_help=3;		/* Video Page Used For Help Screens */
int		help_cls=TRUE;	/* TRUE Means Clear Screen Before Doing Help Screen */
int		help_msg_cls=FALSE;	/* TRUE Means Clear Help Strings */
int		help_cattr=clrnorm;	/* Color To Use When Clearing Help Strings */
char	help_fill=' ';		/* Char. To Use When Clearing Help Strings */

int		show_help(vptr,fld,lasthelp)

struct	VSTRUCT	*vptr;
int		fld,lasthelp;

{
extern	char	scr_page;		/* Global Defining Video Page Used For Input Screen */
struct	VSTRUCT	*hptr;			/* Used As Temporary Pointer */
int		c;						/* Used To Get KBD Input */
char	vpg_temp;				/* Used To Save Video Page On Entry */
hptr=((vptr+fld)->hlp);			/* Pointer to Help structure */
vpg_temp=scr_page;				/* Save Current Video Page */

scr_cursoff();			/* Cursor Off During Help */
set_vpage(vpg_help);	/* Select Help video page */
if ((lasthelp == 0xffff) || (lasthelp != fld))	/* Build Screen If Needed */
	{
	if (help_cls)		/* Clear screen if desired */
		scr_clr();
	if ((hptr->rvalid) != NULL)
		(*(hptr->rvalid)) (vptr,fld);	/* Help Setup Call */
	vdsply((vptr+fld)->hlp);
	}
HELP_WAIT:
while ((c=ci()) != 0)	/* Wait For User */
	;
if ((c=ci()) != FN3)
	goto HELP_WAIT;

if ((lasthelp == 0xffff) || (lasthelp != fld))	/* If we built a screen */
	{
	if ((hptr->rvalid) != NULL)
		(*(hptr->rvalid)) (vptr,fld);	/* Help Setup Call */
	}

if (help_msg_cls)		/* Clear out help strings */
	{
	vundsply(((vptr+fld)->hlp),help_cattr,help_fill);	/* Un-Display The Help Messages */
	lasthelp=0xffff;		/* We'll Need To Redisplay Next Time Around */
	}
else
	lasthelp=fld;

set_vpage(vpg_temp);	/* Return to original Input video page */
scr_curson();			/* Cursor Back On */
return(lasthelp);
}