home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 5 / 05.iso / a / a070 / 3.ddi / FOXPRO / TEMPLGEN / SIMMAIN.INC < prev    next >
Encoding:
Text File  |  1988-02-18  |  2.2 KB  |  101 lines

  1. <<* SIMMAIN.INC *>>
  2.  
  3. <<procedure ProgramBody( procfile : string )>>
  4. <<string prgname,fpath,fname,fext>>
  5. <<begin>>
  6. <<*---The "program" label returns the current---*>>
  7. <<*---program filename being generated---*>>
  8. <<filespec( program,fpath,fname,fext )>>
  9. <<*---Rebuild the program filename without the PATH---*>>
  10. <<prgname := fname + '.' + fext>>
  11. * Program.: {prgname}
  12. * Author..: {Author}
  13. * Date....: {date}
  14. * Notice..: Copyright (c) 1987, {Copyright}, All Rights Reserved
  15. * Notes...: Simple database application.
  16. *
  17. * ---Set environment.
  18. SET TALK OFF
  19. SET BELL OFF
  20. SET SCOREBOARD OFF
  21. * ---Open procedure file.
  22. <<filespec( procfile,fpath,fname,fext )>>
  23. SET PROCEDURE TO {fname}
  24. *
  25. * ---Initialize database file.
  26. SELECT 1
  27. <<select database 1>>
  28. <<filespec( dbfnam,fpath,fname,fext )>>
  29. USE {fname}
  30. <<if ndxtotal>>
  31.    <<filespec( ndxnam,fpath,fname,fext )>>
  32. INDEX ON {ndxkey} TO {fname}
  33. <<endif>>
  34. *
  35. * ---Declare PUBLIC memvars to store field values.
  36. <<forall fldget and (fldtyp $ 'CDLN')>>
  37. PUBLIC m{fldnam}
  38. <<endfor>>
  39. *
  40. * ---Display screen format.
  41. DO DispForm
  42. *
  43. * ---Main execution loop.
  44. DO WHILE .T.
  45.    * ---Display record.
  46.    DO DispRec
  47.    * ---Display simple menu.
  48.    choice = " "
  49.    SET COLOR TO {PromptColor}
  50.    @ 24,0 SAY "SELECT:  Append  Edit  Delete  Next-Prev-Top-Bottom  Quit";
  51.           GET choice PICTURE "!" VALID(choice $ "AEDNPTBQ")
  52.    READ
  53.    DO CASE
  54.    CASE choice ='Q'
  55.       EXIT
  56.    CASE choice ='A'
  57.       * ---Append record.
  58.       DO AddRec
  59.    CASE choice ='E'
  60.       * ---Edit record.
  61.       DO EditRec
  62.    CASE choice ='D'
  63.       * ---Delete record.
  64.       IF .NOT. DELETED()
  65.          DELETE
  66.       ELSE
  67.          RECALL
  68.       ENDIF
  69.    CASE choice ='N'
  70.       * ---Next record.
  71.       SKIP
  72.       IF EOF()
  73.          GOTO BOTTOM
  74.       ENDIF
  75.    CASE choice ='P'
  76.       * ---Previous record.
  77.       SKIP -1
  78.       IF BOF()
  79.          GOTO TOP
  80.       ENDIF
  81.    CASE choice ='T'
  82.       * ---Top record.
  83.       GOTO TOP
  84.    CASE choice ='B'
  85.       * ---Bottom record.
  86.       GOTO BOTTOM
  87.    ENDCASE
  88. ENDDO
  89. *
  90. * ---Closing operations.
  91. SET COLOR TO {WindowColor}
  92. CLEAR
  93. SET SCOREBOARD ON
  94. SET BELL ON
  95. SET TALK ON
  96. RETURN
  97. * EOF: {prgname}
  98. <<end>> <<*ProgramBody*>>
  99.  
  100. <<* SIMMAIN.INC *>>
  101.