home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 5 / 05.iso / a / a002 / 6.ddi / SAMPLE / APTFORMS / CLRFD.C < prev    next >
Encoding:
C/C++ Source or Header  |  1990-08-24  |  1.2 KB  |  51 lines

  1. #include <sybfront.h>
  2. #include <sybdb.h>
  3. #include <sybfrs.h>
  4.  
  5. #if MSDOS
  6. #    include    "aforms.h"
  7. #endif /* MSDOS */
  8.  
  9. /*
  10. **    CLRFD - Clear the fields on the screen.
  11. **    
  12. **    The user has pressed the "Clear" option: reset all the fields
  13. **    other than the date and operator login fields.
  14. */
  15.  
  16. clrfd(context, argarray)
  17. FRSCONTEXT          *context;
  18. POINTER             argarray[];
  19. {
  20.  
  21.     FORM              *salesform;
  22.     FRSIO             *io_cxt;
  23.     OBJDSC            objdsc;
  24.     OBJDSC            *curfld = &objdsc;
  25.     OBJDSC            *nextfld;
  26.  
  27.     /* Get the form and allocate an io_cxt */
  28.     salesform = fscurform(context);
  29.     io_cxt = fsioalloc(salesform);
  30.  
  31.     /* Set the store id field as the first field fsionxtfld will return,
  32.     ** so that we skip the first two fields.
  33.     */
  34.     fsiosetfld(io_cxt, NULL,
  35.         fsfgetfld(salesform, "storeid", -1, NULL, curfld));
  36.  
  37.     /* Step through each field, starting with storeid, and clear it
  38.     ** by writing an empty string into it.
  39.     */
  40.     for (nextfld = fsionxtfld(io_cxt, FALSE);
  41.          nextfld != NULL;
  42.          nextfld = fsionxtfld(io_cxt, FALSE)    )
  43.     {
  44.         /* Note the zero passed for the string length. */
  45.         fsfputval(salesform, nextfld, -1, SSOFF, NULL, "", 0, FALSE);
  46.     }
  47.  
  48.     fsiofree(io_cxt);
  49.     return;
  50. }
  51.