home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 5 / 05.iso / a / a067 / 1.img / GRUMP501.EXE / TIMESTA.PRG < prev    next >
Encoding:
Text File  |  1991-04-23  |  1.5 KB  |  48 lines

  1. /*
  2.     Program: TIMESTAMP()
  3.     System: GRUMPFISH LIBRARY
  4.     Author: Greg Lief
  5.     Copyright (c) 1988-90, Greg Lief
  6.     Clipper 5.01 version
  7.     Compile instructions: clipper timesta /n/w/a
  8.  
  9.     Calls:   MEMEDIT()  (function contained in MEMEDIT.PRG)
  10.              ERR_MSG()  (function contained in ERRMSG.PRG)
  11.  
  12.     To implant a date/time stamp into a memo field. Handy
  13.     for customer contact records and so forth
  14. */
  15.  
  16. //───── begin preprocessor directives
  17.  
  18. #include "grump.ch"
  19.  
  20. //───── end preprocessor directives
  21.  
  22. function timestamp(cfield, cvalue, edit_it)
  23. local oldinsert, mrow := row(), mcol := col(), cstring
  24. default cvalue to []
  25. if type(cfield) = 'M'   // VALTYPE() did not seem to work in this situation
  26.    //───── if third parameter was passed, put them into memoedit()
  27.    cstring := dtoc(date()) + [ ] + time() + [ ] + ;
  28.              if(! empty(cvalue), cvalue, []) + CRLF
  29.    if edit_it != NIL
  30.       oldinsert := readinsert(.t.)
  31.       keyboard cstring + CRLF + chr(5) + chr(5) + replicate(chr(4), 18)
  32.       memedit(cfield)
  33.       readinsert(oldinsert)
  34.    elseif rlock()
  35.       fieldput(fieldpos(cfield), cstring + fieldget(fieldpos(cfield)))
  36.       //───── note complete absence of macro operators!
  37.    else
  38.       err_msg("could not write timestamp to " + cfield)
  39.    endif
  40. endif
  41. setpos(mrow, mcol)    // return cursor position
  42. return NIL
  43.  
  44. * end function TimeStamp()
  45. *--------------------------------------------------------------------*
  46.  
  47. * eof timesta.prg
  48.