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

  1. <<* APPMAIN.INC *>>
  2.  
  3. <<procedure GenMainBody>>
  4. <<integer count,ndxmax>>
  5. <<begin>>
  6. * ---SET environment.
  7. SET TALK OFF
  8. SET STATUS OFF
  9. SET HELP OFF
  10. SET BELL OFF
  11. SET MENUS OFF
  12. SET SAFETY OFF
  13. SET ESCAPE OFF
  14. SET SCOREBOARD OFF
  15. * ---Open PROCEDURE file.
  16. SET PROCEDURE TO {fileprefix}_PROC
  17. *
  18. * ---Declare Global memory variables.
  19. PRIVATE;
  20.    PgDn,PgUp,Returnkey,DelRecord,;
  21.    ScreenAtr,StatusAtr,WindowAtr,PromptAtr,HiliteAtr,;
  22.    DBFname,DBFtemp,dbfarea,dbfpagemax,NdxOrder,isedited,;
  23.    PromptBar,PromptRow,mainchoice,menuchoice,choice
  24. STORE .F. TO;
  25.    PgDn,PgUp,Returnkey,DelRecord,;
  26.    ScreenAtr,StatusAtr,WindowAtr,PromptAtr,HiliteAtr,;
  27.    DBFname,DBFtemp,dbfarea,dbfpagemax,NdxOrder,isedited,;
  28.    PromptBar,PromptRow,mainchoice,menuchoice,choice
  29. <<#
  30.   forall databases
  31.     if ndxtotal > ndxmax
  32.       ndxmax := ndxtotal
  33.     endif
  34.   endfor
  35.   for count := 1 to ndxmax
  36.     genln( 'PRIVATE NDXnam',count,',NDXkey',count )
  37.   endfor
  38.   for count := 1 to ndxmax
  39.     genln( 'STORE .F. TO NDXnam',count,',NDXkey',count )
  40.   endfor
  41. #>>
  42. <<if ismultipage>>
  43. PRIVATE LastRec,recnum,oldrecnum,pageno,PageMax,expr,IsValid
  44. <<else>>
  45. PRIVATE LastRec,recnum,oldrecnum,expr,IsValid
  46. <<endif>>
  47. <<if ismultipage>>
  48. STORE .F. TO LastRec,recnum,oldrecnum,pageno,PageMax,expr,IsValid
  49. <<else>>
  50. STORE .F. TO LastRec,recnum,oldrecnum,expr,IsValid
  51. <<endif>>
  52. <<#
  53.   select all    <<*Let memvars become visible*>>
  54.   select fields on (fldtyp $ 'CDLN') and (fldals = 'M') and fldget
  55.   if fldtotal > 0
  56.     genln( '* ---Declare user-defined memory variables.' )
  57.     GenFldList( 'PRIVATE;' )
  58.     GenMemStore( 'C','STORE " " TO;' )
  59.     GenMemStore( 'N','STORE 0.00 TO;' )
  60.     GenMemStore( 'L','STORE .F. TO;' )
  61.     GenMemStore( 'D','STORE CTOD("  /  /  ") TO;' )
  62.   endif
  63.   select all
  64.   select fields on (fldtyp $ 'CDLN') and (fldals <> 'M') and fldget
  65.   if (fldtotal <= 128)
  66.     genln( '* ---Declare field memory variables.' )
  67.     GenFldList( 'PRIVATE;' )
  68.     GenFldStore( 'C','STORE " " TO;' )
  69.     GenFldStore( 'N','STORE 0.00 TO;' )
  70.     GenFldStore( 'L','STORE .F. TO;' )
  71.     GenFldStore( 'D','STORE CTOD("  /  /  ") TO;' )
  72.   endif
  73. #>>
  74. *
  75. * ---Initialize Global memory variables and OPEN file(s).
  76. dbfarea = "1"
  77. DO {fileprefix}_OPEN
  78. *
  79. * ---Start with Edit/View.
  80. mainchoice = "E"
  81. * ---Execute main loop.
  82. DO WHILE .T.
  83.    * ---Display main menu and get choice.
  84.    DO {fileprefix}_MENU WITH mainchoice
  85.    <<GenColor( 1,'WINDOW' )>>
  86.    DO CASE
  87.    CASE mainchoice $ "Q"+Returnkey
  88.       EXIT
  89. <<if ismultials>>
  90.    CASE .NOT. (mainchoice $ "AHS") .AND. (LastRec = 0)
  91.       @ 17, 0 SAY "EMPTY DATABASE:  Only Append, Help, and Select are available."
  92. <<else>>
  93.    CASE .NOT. (mainchoice $ "AH") .AND. (LastRec = 0)
  94.       @ 17, 0 SAY "EMPTY DATABASE:  Only Append and Help are available."
  95. <<endif>>
  96.       WAIT
  97.    CASE mainchoice = "A"
  98.       * ---DO APPEND.
  99.       DO {fileprefix}_APPE
  100.    CASE mainchoice = "B"
  101.       * ---BROWSE the database file.
  102.       * ---If you prefer the regular BROWSE, then
  103.       * ---change the following line to IF .F.
  104.       IF .T.
  105.          DO {fileprefix}_BROW
  106.       ELSE
  107.          SET MENUS ON
  108.          SET SCOREBOARD ON
  109.          BROWSE
  110.          SET SCOREBOARD OFF
  111.          SET MENUS OFF
  112.       ENDIF
  113.       * ---It is advisable to close and reopen the
  114.       * ---datafiles after extensive browsing/editing.
  115.       CLOSE DATABASE
  116.       CLOSE INDEX
  117.       DO {fileprefix}_OPEN
  118.    CASE mainchoice = "E"
  119.       * ---DO EDIT/VIEW.
  120.       isedited = .F.
  121.       DO {fileprefix}_EDIT WITH isedited
  122.    CASE mainchoice = "H"
  123.       * ---DO HELP.
  124.       DO {fileprefix}_HELP
  125.    CASE mainchoice = "L"
  126.       * ---DO LABELS.
  127.       DO {fileprefix}_LABE
  128.    CASE mainchoice = "P"
  129.       * ---DO PACK.
  130.     <<if ismultials>>
  131.       DO {fileprefix}_PACK WITH 18
  132.     <<else>>
  133.       DO {fileprefix}_PACK WITH 17
  134.     <<endif>>
  135.    CASE mainchoice = "R"
  136.       * ---DO REPORT.
  137.       DO {fileprefix}_REPO
  138. <<if ismultials>>
  139.    CASE mainchoice = "S"
  140.       * ---DO SELECT FILE.
  141.       DO {fileprefix}_FILE WITH 18,choice
  142. <<endif>>
  143.    ENDCASE
  144. ENDDO
  145. *
  146. * ---Closing operations.
  147. <<GenColor( 0,'SCREEN' )>>
  148. CLEAR
  149. CLOSE DATABASE
  150. CLOSE INDEX
  151. CLOSE PROCEDURE
  152. SET SCOREBOARD ON
  153. SET ESCAPE ON
  154. SET SAFETY ON
  155. SET MENUS ON
  156. SET BELL ON
  157. SET HELP ON
  158. SET STATUS ON
  159. SET TALK ON
  160. <<end>> <<*GenMainBody*>>
  161.  
  162. <<* EOF: APPMAIN.INC *>>
  163.