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

  1. <<* APPCOND.INC *>>
  2. <<#
  3.  
  4. procedure GenCondNoEdit
  5. begin
  6.   pushmargin( 1 )
  7.   GenColor( 0,'PROMPT' )
  8. #>>
  9. <<if Bracketed>>
  10. @ row,0 SAY ;
  11.   "CONDITION:  {A}dd  {S}elect  <PgUp>  <PgDn>  <Del>  <Return> "
  12. <<elsif LiteBar>>
  13. <<*       1         2         3         4         5
  14. 0123456789012345678901234567890123456789012345678901234567890
  15. CONDITION:  (A)dd  (S)elect  <PgUp>  <PgDn>  <Del>  <Return>
  16. *>>
  17. @ row,0 SAY ;
  18.   "CONDITION:  (A)dd  (S)elect  <PgUp>  <PgDn>  <Del>  <Return>"
  19. <<GenColor( 0,'HILITE' )>>
  20. @ row,12 SAY "(A)"
  21. @ row,19 SAY "(S)"
  22. @ row,30 SAY "PgUp"
  23. @ row,38 SAY "PgDn"
  24. @ row,46 SAY "Del"
  25. @ row,53 SAY "Return"
  26. <<GenColor( 0,'PROMPT' )>>
  27. @ row,61 SAY ""
  28. <<else>>  <<*Simple*>>
  29. @ row,0 SAY;
  30.   "CONDITION:  (A)dd  (S)elect  <PgUp>  <PgDn>  <Del>  <Return> "
  31. <<endif>>
  32. DO GetKey WITH choice,"AS"+PgUp+PgDn+DelRecord+Returnkey
  33. <<popmargin>>
  34. <<end GenCondNoEdit>>
  35.  
  36.  
  37. <<#
  38. procedure GenCondWithEdit  <<*Allows (E)dit option: TYPE() function avail*>>
  39. begin
  40.   pushmargin( 1 )
  41.   GenColor( 0,'PROMPT' )
  42. #>>
  43. <<if Bracketed>>
  44. @ row,0 SAY;
  45. "CONDITION:  {A}dd  {E}dit  {S}elect  <PgUp>  <PgDn>  <Del>  <Return> "
  46. <<elsif LiteBar>>
  47. <<*       1         2         3         4         5
  48. 01234567890123456789012345678901234567890123456789012345678901234
  49. CONDITION:  (A)dd  (E)dit  (S)elect  <PgUp>  <PgDn>  <Del>  <Return>
  50. *>>
  51. @ row,0 SAY ;
  52. "CONDITION:  (A)dd  (E)dit  (S)elect  <PgUp>  <PgDn>  <Del>  <Return>"
  53. <<GenColor( 0,'HILITE' )>>
  54. @ row,12 SAY "(A)"
  55. @ row,19 SAY "(E)"
  56. @ row,27 SAY "(S)"
  57. @ row,38 SAY "PgUp"
  58. @ row,46 SAY "PgDn"
  59. @ row,54 SAY "Del"
  60. @ row,61 SAY "Return"
  61. <<GenColor( 0,'PROMPT' )>>
  62. @ row,69 SAY ""
  63. <<else>>
  64. @ row,0 SAY;
  65. "CONDITION:  (A)dd  (E)dit  (S)elect  <PgUp>  <PgDn>  <Del>  <Return> "
  66. <<endif>>
  67. DO GetKey WITH choice,"AES"+PgUp+PgDn+DelRecord+Returnkey
  68. <<popmargin>>
  69. <<end GenCondWithEdit>>
  70.  
  71.  
  72. <<procedure GenCondMain( IsTypeAvail : logical )>>
  73. <<begin>>
  74. PARAMETER expr
  75. PRIVATE row,rowTOP,recnum,recnumTOP
  76. PRIVATE newexpr,PagePaint,skipRECS,exprTOTAL
  77. SELECT H
  78. GOTO BOTTOM
  79. IF EOF()
  80.    exprTOTAL = 0
  81.    recnumTOP = 0
  82. ELSE
  83.    exprTOTAL = RECNO()
  84.    GOTO TOP
  85.    recnumTOP = RECNO()
  86. ENDIF
  87. skipRECS = 18
  88. row = 23
  89. rowTOP = 2
  90. recnum = 0
  91. expr = ""
  92. newexpr = ""
  93. PagePaint = .T.
  94. *
  95. DO WHILE .T.
  96.    IF PagePaint
  97.      <<GenColor( 2,'WINDOW' )>>
  98.       @ rowTOP,0 CLEAR
  99.      <<GenColor( 2,'PROMPT' )>>
  100.       @ rowTOP,0 SAY CHR(222) + REPLICATE( CHR(223),78 ) + CHR(221)
  101.       @ rowTOP,34 SAY "<CONDITIONS>"
  102.       @ row-1,0 SAY PromptBar
  103.       @ rowTOP,0 SAY ""
  104.       IF recnumTOP > 0
  105.          GOTO recnumTOP
  106.       ENDIF
  107.       SET HEADING OFF
  108.       LIST NEXT skipRECS SUBSTR( CondExpr,1,69 ) FOR CondArea = dbfarea
  109.       SET HEADING ON
  110.       PagePaint = .F.
  111.    ENDIF
  112.    IF "" = expr
  113.      <<GenColor( 2,'PROMPT' )>>
  114.      @ row-2,0
  115.    ELSE
  116.      <<GenColor( 2,'PROMPT' )>>
  117.       @ row-2,0 SAY "<selected>"
  118.      <<GenColor( 2,'HILITE' )>>
  119.       @ row-2,11 SAY SUBSTR( expr,1,69 )
  120.    ENDIF
  121. <<#
  122.   if IsTypeAvail
  123.     GenCondWithEdit
  124.   else
  125.     GenCondNoEdit
  126.   endif
  127. #>>
  128.    DO CASE
  129.    CASE choice = Returnkey
  130.       EXIT
  131.    CASE choice = "A"
  132.       * ---Add new CONDITION.
  133.       DO {fileprefix}_EXPR WITH newexpr
  134.       IF "" <> TRIM(newexpr)
  135.          APPEND BLANK
  136.          REPLACE CondExpr WITH newexpr,CondArea WITH dbfarea
  137.          expr = CondExpr
  138.          exprTOTAL = exprTOTAL + 1
  139.       ENDIF
  140.       PagePaint = .T.
  141. <<if IsTypeAvail>>   <<*Allows (E)dit option*>>
  142.    CASE choice = "E"
  143.       * ---Edit CONDITION.
  144.       DO GotoRec WITH row,recnum,exprTOTAL
  145.       IF recnum > 0 .AND. CondArea = dbfarea
  146.          recnumTOP = RECNO()
  147.          @ row,0 GET CondExpr
  148.          READ
  149.          expr = CondExpr
  150.          PagePaint = .T.
  151.       ENDIF
  152. <<endif>>
  153.    CASE choice = "S"
  154.       * ---Select CONDITION.
  155.       DO GotoRec WITH row,recnum,exprTOTAL
  156.       IF recnum = 0 .OR. CondArea <> dbfarea
  157.          expr = ""
  158.       ELSE
  159.          expr = CondExpr
  160.       ENDIF
  161.    CASE choice = PgDn
  162.       IF .NOT. EOF()
  163.          IF recnumTOP > 0
  164.             GOTO recnumTOP
  165.          ENDIF
  166.          SKIP skipRECS
  167.          IF EOF()
  168.             GOTO BOTTOM
  169.          ENDIF
  170.          recnumTOP = RECNO()
  171.          PagePaint = .T.
  172.       ENDIF
  173.    CASE choice = PgUp
  174.       IF .NOT. BOF()
  175.          IF recnumTOP > 0
  176.             GOTO recnumTOP
  177.          ENDIF
  178.          SKIP -skipRECS
  179.          IF BOF()
  180.             GOTO TOP
  181.          ENDIF
  182.          recnumTOP = RECNO()
  183.          PagePaint = .T.
  184.       ENDIF
  185.    CASE choice = DelRecord
  186.       * ---Delete the record.
  187.       DO GotoRec WITH row,recnum,exprTOTAL
  188.       IF recnum > 0 .AND. CondArea = dbfarea
  189.          DELETE
  190.          PACK
  191.          IF exprTOTAL > 0
  192.             exprTOTAL = exprTOTAL - 1
  193.          ENDIF
  194.          GOTO TOP
  195.          IF EOF()
  196.             recnumTOP = 0
  197.             expr = ""
  198.          ELSE
  199.             recnumTOP = RECNO()
  200.          ENDIF
  201.          PagePaint = .T.
  202.       ENDIF
  203.    ENDCASE
  204. ENDDO
  205. expr = TRIM( expr )
  206. SELECT &dbfarea
  207. <<end GenCondMain>>
  208.  
  209.  
  210. <<#
  211. procedure GenCondBody
  212. begin
  213.     GenCondMain( true )
  214. end GenCondBody
  215.  
  216. <<* EOF: APPCOND.INC *>>
  217. #>>
  218.