home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / vol_300 / 328_01 / wformerr.c < prev    next >
C/C++ Source or Header  |  1991-03-17  |  1KB  |  53 lines

  1.  
  2.  
  3. /* WFORMERR.C
  4.  *    source file for form error check function
  5.  *
  6.  *      This function can be named in the header of a WFORM table
  7.  *    It loops through all the form data items,
  8.  *        and calls any special validation functions for eachitem
  9.  *    If any of the data is invalid, this function will return (1)
  10.  *    else, will return (0) for all valid;
  11.  *
  12.  */
  13. #include "wsys.h"
  14.  
  15. void  wform_showerror (WFORM *form, char *errmsg)
  16.     {
  17.     int l,t, xmax;
  18.     char *msg;
  19.  
  20.  
  21.     msg = errmsg ? errmsg : "Invalid. Press any key, then re-enter.";
  22.  
  23.     xmax = 3 + strlen (msg);
  24.  
  25.     /* locate border of window 1 over and 1 down
  26.      */
  27.     wsetlocation ( WLOC_ATWIN, (form->wfx)+1, (form->wfy)+1 );
  28.  
  29.     wlocate ( &l, &t, xmax, 2 );
  30.  
  31.  
  32.     wopen ( l, t, xmax, 2,
  33.         (RED <<4) + YELLOW, DOUBLE_BORDER, (RED<<4)+YELLOW,
  34.         WSAVE2RAM );
  35.  
  36.     w0-> winputstyle &= ~(WPUTWRAP + WPUTSCROLL);
  37.  
  38.     wputc ( 0x18 );        /* up-arrow */
  39.     wputc ( ' ' );
  40.     wputs ( msg );
  41.  
  42.     wgetc();
  43.  
  44.     wclose();
  45.  
  46.  
  47.     return; /* wform_showerror() */
  48.     }
  49.  
  50.  
  51.  
  52. /*------------- end of WFORMERR.C -------------------*/
  53.