home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 5 / 05.iso / a / a046 / 5.img / TEMPLATE / SSBOPEN.INC < prev    next >
Encoding:
Text File  |  1992-04-01  |  4.0 KB  |  168 lines

  1. <<* SSBOPEN.INC *>>
  2. <<* (C) 1991 SHEN YANG WHITE HORSE SOFTWART COMPANY  *>>
  3.  
  4. <<#pragma
  5.  
  6. function GetPromptRow : integer
  7. integer maxrow,row,col,fldlablen,templen
  8. begin
  9.   maxrow := 0
  10.   select all
  11.   forall fields
  12.     fldlablen := len( fldlab )
  13.     if fldtyp = 'B'     <<*BOX types*>>
  14.       row := fldrow + flddec - 1
  15.     elsif fldtyp = 'T'  <<*TEXT types*>>
  16.       if not fldhor     <<*Vertical*>>
  17.         row := fldrow + fldlablen - 1
  18.       else
  19.         row := fldrow
  20.       endif
  21.     else  <<*all other types*>>
  22.       row := fldrow
  23.       col := fldcol
  24.       if not fldsid     <<*Stacked GET*>>
  25.         row := row + 1
  26.       else
  27.         col := col + fldlablen
  28.       endif
  29.       if col + fldwid > SCREENWIDTH   <<*Check for wraparound GETS*>>
  30.         templen := fldwid - (SCREENWIDTH - col)
  31.         if SCREENWIDTH - col > 0
  32.           repeat
  33.             row := row + 1
  34.             templen := templen - (SCREENWIDTH - col)
  35.           until templen <= 0
  36.         endif
  37.       endif
  38.     endif
  39.     if maxrow < row
  40.       maxrow := row
  41.     endif
  42.   endfor
  43.   maxrow := maxrow + 4   <<*Compute PromptRow*>>
  44.   if maxrow > 23         <<*Don't go off the screen!*>>
  45.     maxrow := 23
  46.   endif
  47.   RETURN maxrow
  48. end <<*GetPromptRow*>>
  49. #>>
  50.  
  51.  
  52. <<procedure GenSBOpenBody>>
  53. <<integer promptrow>>
  54. <<string  strg>>
  55. <<begin>>
  56.    <<promptrow := GetPromptRow>>
  57. * ---INKEY() constant values.
  58. PgDn = CHR(3)
  59. PgUp = CHR(18)
  60. Returnkey = CHR(13)
  61. DelRecord = CHR(7)
  62. *
  63. * ---SET COLOR TO values.
  64. ScreenAtr = "W+/B,N/W"
  65. StatusAtr = "N/BG,N/W"
  66. WindowAtr = "W/B,N/W"
  67. PromptAtr = "N/W,GR+/R"
  68. HiliteAtr = "N/W"
  69. *
  70. * ---Initialize global variables.
  71. STORE 0 TO LastRec,oldrecnum,recnum,menuchoice
  72. STORE " " TO choice,expr,notes
  73.     <<if ismultipage>>
  74. pageno = 1
  75.       <<select all>>
  76. PageMax = {pagtotal}
  77.       <<if ismultials>>
  78.         <<select database 1>>
  79. dbfpagemax = {pagtotal}
  80.       <<endif>>
  81.     <<endif>>
  82. PromptRow = 23
  83. PromptBar = REPLICATE( "⌐ñ",40 )
  84.  
  85. <<forall databases>>
  86. *
  87. * ---Open database file.
  88.   <<filespec( dbfnam,fpath,fname,fext )>>
  89.   <<strg := chr( dbfcount + 64 )>>
  90. SELECT {strg}
  91. IF .NOT. FILE( {"}{fname}.DBF{"} )
  92.    ? [{"}{fname}.DBF{"} not found]
  93.    WAIT
  94.    QUIT
  95. ENDIF
  96.   <<if dbfals = ''>>
  97. USE {fname}
  98.   <<else>>
  99. USE {fname} ALIAS {dbfals}
  100.   <<endif>>
  101.   <<if ndxtotal > 0>>
  102. *
  103. * ---Open INDEX file(s).
  104.     <<forall indexes>>
  105.       <<filespec( ndxnam,fpath,fname,fext )>>
  106.       <<fname := fname + '.' + GetIndexExt>>
  107. IF .NOT. FILE( {"}{fname}{"} )
  108.    ? [Creating index {"}{fname}{"}...]
  109.    INDEX ON {ndxkey} TO {fname}
  110. ENDIF
  111.     <<endfor>>
  112.     <<genln( 'SET INDEX TO ',GetIndexNames(1) )>>
  113.   <<endif>>
  114. <<endfor>>
  115. <<select all>>
  116. <<if reltotal > 0>>   <<*Any relations in entire system?*>>
  117. *
  118. * ---SET RELATION(s).
  119. <<#
  120.   forall databases
  121.     if reltotal > 0
  122.       genln( 'SELECT ',chr( dbfcount+64 ) )
  123.     endif
  124.       forall relations
  125.         if forcount = 1
  126.           genln( 'SET RELATION TO ',relkey,' INTO ',relals )
  127.         else
  128.           genln( 'SET RELATION TO ',relkey,' INTO ',relals,' ADDITIVE' )
  129.         endif
  130.       endfor
  131.   endfor
  132. endif
  133. #>>
  134. <<select database 8>>  <<*Is SELECT H being used?*>>
  135. <<if dbfnam = ''>>     <<*No, so let's do some fancy stuff...*>>
  136. * ---Open CONDITIONS file.
  137. IF .NOT. FILE( {"}{fileprefix}C.DBF{"} )
  138.    ? [Creating {"}{fileprefix}C.DBF{"} file...]
  139.    COPY TO {fileprefix}X STRUCTURE EXTENDED
  140.    SELECT H
  141.    USE {fileprefix}X
  142.    ZAP
  143.    APPEND BLANK
  144.    REPLACE FIELD_NAME WITH "CONDEXPR"
  145.    REPLACE FIELD_TYPE WITH "C"
  146.    REPLACE FIELD_LEN  WITH 128
  147.    APPEND BLANK
  148.    REPLACE FIELD_NAME WITH "CONDAREA"
  149.    REPLACE FIELD_TYPE WITH "C"
  150.    REPLACE FIELD_LEN  WITH 1
  151.    APPEND BLANK
  152.    REPLACE FIELD_NAME WITH "CONDNOTE"
  153.    REPLACE FIELD_TYPE WITH "C"
  154.    REPLACE FIELD_LEN  WITH 40
  155.    USE
  156.    CREATE {fileprefix}C FROM {fileprefix}X
  157.    DELETE FILE {fileprefix}X.DBF
  158. ENDIF
  159. SELECT H
  160. USE {fileprefix}C
  161. <<endif>>
  162. * ---Initialize database variables for current workarea.
  163. DO {fileprefix}A
  164.  
  165. <<end>> <<*GenSBOpenBody*>>
  166.  
  167. <<* EOF: SSBOPEN.INC *>>
  168.