
/****************************************************************************/

/*  Module PNLXV01C.C 

    Copyright 1986 Roundhill Computer Systems Limited
    All rights reserved

    Use and disclosure of this code are prohibited unless in accordance
    with the terms of the PANEL software licence.

    ************************************************************************
    *** THE OBJECT CODE VERSION OF THIS MODULE IS INCLUDED IN THE PANEL  ***
    *** LIBRARY.  IF YOU AMEND AND COMPILE THIS MODULE AND LINK IT WITH  ***
    *** YOUR APPLICATION IT WILL SUPERSEDE THE LIBRARY VERSION.          ***
    ************************************************************************

    PANEL:  Type 4          : Validation
            Source Language : C

    Modification History (Push-Down List):  

            28.12.85        : Convert to table-driven operation

*****************************************************************************/

#include <pnl4.h>

/*  The function below using PARDHI can highlight each field to be read,
    as the cursor is moved to it.  If you like this style of operation, it
    can be bought into use by moving the selected highlight type to PARDHI
    before making the read call to PANELS.  Fields which have this type
    already will not be changed for reading.                                 */

extern int PARDHI;          /* highlight code to be used for each field read */
static int savehi = 0;
static int hlchanged = 0;

PAXV01(fn,fp)
int fn;
panfcb *fp;

{
    if (fn == freadh)               /* before read */
        {
        if (UCI(fp->hightype) != PARDHI)    /* not this hl already */
            {
            savehi = fp->hightype;  /* save original hl */
            PAOLDH = savehi;        /* and save for change fn */
            fp->hightype = PARDHI;  /* plug in the one wanted */
            PANELF(fhighc,fp);      /* change displayed hl function */
            hlchanged++;            /* indicate changed */
            }
        }
    if (fn == -(freadh))            /* after read */
        {
        if (hlchanged)              /* has been changed above */    
            {
            PAOLDH = PARDHI;        /* save existing for change fn */
            fp->hightype = savehi;  /* put original back in fcb */
            PANELF(fhighc,fp);      /* change it back */
            }
        hlchanged = savehi = 0;     /* clean up */
        }
}

 