home *** CD-ROM | disk | FTP | other *** search
- <<* MSAOPEN.INC *>>
- <<* MODIFIED 13 JANUARY 1988 *>>
-
-
- <<#pragma
-
- function GetPromptRow : integer
- integer maxrow,row,col,fldlablen,templen
- begin
- maxrow := 0
- select all
- forall fields
- fldlablen := len( fldlab )
- if fldtyp = 'B' <<*BOX types*>>
- row := fldrow + flddec - 1
- elsif fldtyp = 'T' <<*TEXT types*>>
- if not fldhor <<*Vertical*>>
- row := fldrow + fldlablen - 1
- else
- row := fldrow
- endif
- else <<*all other types*>>
- row := fldrow
- col := fldcol
- if not fldsid <<*Stacked GET*>>
- row := row + 1
- else
- col := col + fldlablen
- endif
- if col + fldwid > SCREENWIDTH <<*Check for wraparound GETS*>>
- templen := fldwid - (SCREENWIDTH - col)
- if SCREENWIDTH - col > 0
- repeat
- row := row + 1
- templen := templen - (SCREENWIDTH - col)
- until templen <= 0
- endif
- endif
- endif
- if maxrow < row
- maxrow := row
- endif
- endfor
- maxrow := maxrow + 4 <<*Compute PromptRow*>>
- if maxrow > 23 <<*Don't go off the screen!*>>
- maxrow := 23
- endif
- RETURN maxrow
- end <<*GetPromptRow*>>
- #>>
-
-
- <<procedure GenOpenBody>>
- <<integer promptrow>>
- <<string strg>>
- <<begin>>
- <<promptrow := GetPromptRow>>
- * ---INKEY() constant values.
- PgDn = CHR(3)
- PgUp = CHR(18)
- Returnkey = CHR(13)
- DelRecord = CHR(7)
- *
- * ---SET COLOR TO values.
- ScreenAtr = {"}{ScreenColor}"
- StatusAtr = {"}{StatusColor}"
- WindowAtr = {"}{WindowColor}"
- PromptAtr = {"}{PromptColor}"
- HiliteAtr = {"}{HiliteColor}"
- * ---CHECK FOR NEW SETTINGS
- memfile = {"}{fileprefix}"+"_INST.MEM"
- IF FILE(memfile)
- RESTORE FROM {fileprefix}_INST ADDITIVE
- ScreenAtr = INST_C1
- StatusAtr = INST_C2
- WindowAtr = INST_C3
- PromptAtr = INST_C4
- HiliteAtr = INST_C5
- ELSE
- DO {fileprefix}_INST
- ENDIF
-
- *
- * ---Initialize global variables.
- STORE 0 TO LastRec,oldrecnum,recnum,menuchoice
- STORE " " TO choice,expr,notes
- <<if ismultipage>>
- pageno = 1
- <<select all>>
- PageMax = {pagtotal}
- <<if ismultials>>
- <<select database 1>>
- dbfpagemax = {pagtotal}
- <<endif>>
- <<endif>>
- PromptRow = {promptrow}
- PromptBar = REPLICATE( CHR( 196 ),80 )
- <<forall databases>>
- *
- * ---SET DEFAULT DRIVE AND PATH
- SET DEFAULT TO &INST_DRIVE
- * ---Open database file.
- <<filespec( dbfnam,fpath,fname,fext )>>
- <<strg := chr( dbfcount + 64 )>>
- SELECT {strg}
- IF .NOT. FILE( {"}{fname}.DBF{"} )
- ? [{"}{fname}.DBF{"} not found]
- WAIT
- QUIT
- ENDIF
- <<if dbfals = ''>>
- USE {fname}
- <<else>>
- USE {fname} ALIAS {dbfals}
- <<endif>>
- <<if ndxtotal > 0>>
- *
- * ---Open INDEX file(s).
- <<forall indexes>>
- <<filespec( ndxnam,fpath,fname,fext )>>
- <<fname := fname + '.' + GetIndexExt>>
- IF .NOT. FILE( {"}{fname}{"} )
- ? [Creating index {"}{fname}{"}...]
- INDEX ON {ndxkey} TO {fname}
- ENDIF
- <<endfor>>
- <<genln( 'SET INDEX TO ',GetIndexNames(1) )>>
- <<endif>>
- <<endfor>>
- <<select all>>
- <<if reltotal > 0>> <<*Any relations in entire system?*>>
- *
- * ---SET RELATION(s).
- <<#
- forall databases
- if reltotal > 0
- genln( 'SELECT ',chr( dbfcount+64 ) )
- endif
- forall relations
- if forcount = 1
- genln( 'SET RELATION TO ',relkey,' INTO ',relals )
- else
- genln( 'SET RELATION TO ',relkey,' INTO ',relals,' ADDITIVE' )
- endif
- endfor
- endfor
- endif
- #>>
- <<select database 8>> <<*Is SELECT H being used?*>>
- <<if dbfnam = ''>> <<*No, so let's do some fancy stuff...*>>
- *
- * ---Open CONDITIONS file.
- IF .NOT. FILE( {"}{fileprefix}_COND.DBF{"} )
- ? [Creating {"}{fileprefix}_COND.DBF{"} file...]
- COPY TO {fileprefix}_XXXX STRUCTURE EXTENDED
- SELECT H
- USE {fileprefix}_XXXX
- ZAP
- APPEND BLANK
- REPLACE FIELD_NAME WITH "CONDEXPR"
- REPLACE FIELD_TYPE WITH "C"
- REPLACE FIELD_LEN WITH 128
- APPEND BLANK
- REPLACE FIELD_NAME WITH "CONDAREA"
- REPLACE FIELD_TYPE WITH "C"
- REPLACE FIELD_LEN WITH 1
- APPEND BLANK
- REPLACE FIELD_NAME WITH "CONDNOTE"
- REPLACE FIELD_TYPE WITH "C"
- REPLACE FIELD_LEN WITH 40
- USE
- CREATE {fileprefix}_COND FROM {fileprefix}_XXXX
- DELETE FILE {fileprefix}_XXXX.DBF
- ENDIF
- SELECT H
- USE {fileprefix}_COND
- <<endif>>
- *
- * ---Initialize database variables for current workarea.
- DO {fileprefix}_AREA
- *
- <<end>> <<*GenOpenBody*>>
-
- <<* EOF: MASOPEN.INC *>>