home *** CD-ROM | disk | FTP | other *** search
- <<* APPMAIN.INC *>>
-
- <<procedure GenMainBody>>
- <<integer count,ndxmax>>
- <<begin>>
- * ---SET environment.
- SET TALK OFF
- SET STATUS OFF
- SET HELP OFF
- SET BELL OFF
- SET MENUS OFF
- SET SAFETY OFF
- SET ESCAPE OFF
- SET SCOREBOARD OFF
- * ---Open PROCEDURE file.
- SET PROCEDURE TO {fileprefix}_PROC
- *
- * ---Declare Global memory variables.
- PRIVATE;
- PgDn,PgUp,Returnkey,DelRecord,;
- ScreenAtr,StatusAtr,WindowAtr,PromptAtr,HiliteAtr,;
- DBFname,DBFtemp,dbfarea,dbfpagemax,NdxOrder,isedited,;
- PromptBar,PromptRow,mainchoice,menuchoice,choice
- STORE .F. TO;
- PgDn,PgUp,Returnkey,DelRecord,;
- ScreenAtr,StatusAtr,WindowAtr,PromptAtr,HiliteAtr,;
- DBFname,DBFtemp,dbfarea,dbfpagemax,NdxOrder,isedited,;
- PromptBar,PromptRow,mainchoice,menuchoice,choice
- <<#
- forall databases
- if ndxtotal > ndxmax
- ndxmax := ndxtotal
- endif
- endfor
- for count := 1 to ndxmax
- genln( 'PRIVATE NDXnam',count,',NDXkey',count )
- endfor
- for count := 1 to ndxmax
- genln( 'STORE .F. TO NDXnam',count,',NDXkey',count )
- endfor
- #>>
- <<if ismultipage>>
- PRIVATE LastRec,recnum,oldrecnum,pageno,PageMax,expr,IsValid
- <<else>>
- PRIVATE LastRec,recnum,oldrecnum,expr,IsValid
- <<endif>>
- <<if ismultipage>>
- STORE .F. TO LastRec,recnum,oldrecnum,pageno,PageMax,expr,IsValid
- <<else>>
- STORE .F. TO LastRec,recnum,oldrecnum,expr,IsValid
- <<endif>>
- <<#
- select all <<*Let memvars become visible*>>
- select fields on (fldtyp $ 'CDLN') and (fldals = 'M') and fldget
- if fldtotal > 0
- genln( '* ---Declare user-defined memory variables.' )
- GenFldList( 'PRIVATE;' )
- GenMemStore( 'C','STORE " " TO;' )
- GenMemStore( 'N','STORE 0.00 TO;' )
- GenMemStore( 'L','STORE .F. TO;' )
- GenMemStore( 'D','STORE CTOD(" / / ") TO;' )
- endif
- select all
- select fields on (fldtyp $ 'CDLN') and (fldals <> 'M') and fldget
- if (fldtotal <= 128)
- genln( '* ---Declare field memory variables.' )
- GenFldList( 'PRIVATE;' )
- GenFldStore( 'C','STORE " " TO;' )
- GenFldStore( 'N','STORE 0.00 TO;' )
- GenFldStore( 'L','STORE .F. TO;' )
- GenFldStore( 'D','STORE CTOD(" / / ") TO;' )
- endif
- #>>
- *
- * ---Initialize Global memory variables and OPEN file(s).
- dbfarea = "1"
- DO {fileprefix}_OPEN
- *
- * ---Start with Edit/View.
- mainchoice = "E"
- * ---Execute main loop.
- DO WHILE .T.
- * ---Display main menu and get choice.
- DO {fileprefix}_MENU WITH mainchoice
- <<GenColor( 1,'WINDOW' )>>
- DO CASE
- CASE mainchoice $ "Q"+Returnkey
- EXIT
- <<if ismultials>>
- CASE .NOT. (mainchoice $ "AHS") .AND. (LastRec = 0)
- @ 17, 0 SAY "EMPTY DATABASE: Only Append, Help, and Select are available."
- <<else>>
- CASE .NOT. (mainchoice $ "AH") .AND. (LastRec = 0)
- @ 17, 0 SAY "EMPTY DATABASE: Only Append and Help are available."
- <<endif>>
- WAIT
- CASE mainchoice = "A"
- * ---DO APPEND.
- DO {fileprefix}_APPE
- CASE mainchoice = "B"
- * ---BROWSE the database file.
- * ---If you prefer the regular BROWSE, then
- * ---change the following line to IF .F.
- IF .T.
- DO {fileprefix}_BROW
- ELSE
- SET MENUS ON
- SET SCOREBOARD ON
- BROWSE
- SET SCOREBOARD OFF
- SET MENUS OFF
- ENDIF
- * ---It is advisable to close and reopen the
- * ---datafiles after extensive browsing/editing.
- CLOSE DATABASE
- CLOSE INDEX
- DO {fileprefix}_OPEN
- CASE mainchoice = "E"
- * ---DO EDIT/VIEW.
- isedited = .F.
- DO {fileprefix}_EDIT WITH isedited
- CASE mainchoice = "H"
- * ---DO HELP.
- DO {fileprefix}_HELP
- CASE mainchoice = "L"
- * ---DO LABELS.
- DO {fileprefix}_LABE
- CASE mainchoice = "P"
- * ---DO PACK.
- <<if ismultials>>
- DO {fileprefix}_PACK WITH 18
- <<else>>
- DO {fileprefix}_PACK WITH 17
- <<endif>>
- CASE mainchoice = "R"
- * ---DO REPORT.
- DO {fileprefix}_REPO
- <<if ismultials>>
- CASE mainchoice = "S"
- * ---DO SELECT FILE.
- DO {fileprefix}_FILE WITH 18,choice
- <<endif>>
- ENDCASE
- ENDDO
- *
- * ---Closing operations.
- <<GenColor( 0,'SCREEN' )>>
- CLEAR
- CLOSE DATABASE
- CLOSE INDEX
- CLOSE PROCEDURE
- SET SCOREBOARD ON
- SET ESCAPE ON
- SET SAFETY ON
- SET MENUS ON
- SET BELL ON
- SET HELP ON
- SET STATUS ON
- SET TALK ON
- <<end>> <<*GenMainBody*>>
-
- <<* EOF: APPMAIN.INC *>>