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

  1. <<* SSBEDIT.INC *>>
  2. <<* (C) 1991 SHEN YANG WHITE HORSE SOFTWART COMPANY  *>>
  3.  
  4. <<procedure GenSBEditBody>>
  5. <<integer menutotal>>
  6. <<begin>>
  7. PARAMETER isedited
  8. PRIVATE row,lastpage,editchoice,ndxchoice,menuchoice
  9. PRIVATE IsBlank,IsUnique
  10. <<select all>>
  11. <<if LiteBar and (pagtotal > 2) and  Fox>>
  12. PRIVATE pagechoice
  13. <<endif>>
  14. row = PromptRow
  15. expr = ""
  16. STORE .F. TO isedited,IsBlank,IsUnique
  17. <<if ismultials>>
  18.   <<GenPrivateFlds( 0 )>>
  19. <<endif>>
  20. DO {fileprefix}F
  21. DO SayRec
  22. <<#
  23.   if LiteBar and Fox
  24.     menutotal := 8
  25.     if ismultials
  26.       menutotal := menutotal + 1
  27.     endif
  28.     if ismultipage
  29.       menutotal := menutotal + 1
  30.     endif
  31.     if feat(featlabel)
  32.       menutotal := menutotal + 1
  33.     endif
  34.     genln( 'menuchoice = ',menutotal )
  35.   endif
  36. #>>
  37. editchoice = "*"
  38. ndxchoice = "*"
  39. menuchoice = 0
  40. * ---Loop until {{}Return} is pressed.
  41. * ---The following loop is really a "REPEAT/UNTIL <cond>".
  42. DO WHILE .T.
  43.    <<GenColor( 1,'PROMPT' )>>
  44.    IF .NOT. (editchoice $ "NP"+DelRecord)
  45.       @ row,0 CLEAR
  46.    ENDIF
  47.    SET COLOR TO &promptatr
  48.    @ 22, 0 CLEAR TO 22, 79
  49.    SET MESSAGE TO 24
  50.    @ 23, 2  PROMPT "1.╨▐╕─" MESSAGE SPACE(4);
  51.          + '╢╘ ╡▒ ╟░ ╝╟ ┬╝ ╜° ╨╨ ╨▐ ╕─'
  52.    @ 23, 10 PROMPT "2.▓Θ╒╥" MESSAGE SPACE(4);
  53.          + '╩Σ ╚δ ╥¬ ▓Θ ╒╥ ╝╟ ┬╝ ╡─ ╣╪ ╝ⁿ ╫╓'
  54.    @ 23, 18 PROMPT "3.╠°╫¬" MESSAGE SPACE(4);
  55.          + '╩Σ ╚δ ╥¬ ╠° ╫¬ ╡╜ ╡─ ╝╟ ┬╝ ║┼'
  56.    @ 23, 26 PROMPT "4.╠⌡╝■▓Θ╤»" MESSAGE SPACE(4);
  57.          + '╢¿ ╥σ ╠⌡ ╝■,  ╕∙ ╛▌ ╠⌡ ╝■ ▓Θ ╒╥ ╧α ╙ª ╡─ ╝╟ ┬╝'
  58.    @ 23, 38 PROMPT "5.╔╛│²" MESSAGE SPACE(4);
  59.          + '╢╘ ╡▒ ╟░ ╝╟ ┬╝ ╫÷ ╔╛ │² ▒Ω ╝╟'
  60.    @ 23, 46 PROMPT "6.╧┬╠⌡╝╟┬╝" MESSAGE SPACE(4);
  61.          + '╖¡ ╡╜ ╧┬ ╥╗ ╕÷ ╝╟ ┬╝'
  62.    @ 23, 58 PROMPT "7.╔╧╠⌡╝╟┬╝" MESSAGE SPACE(4);
  63.          + '╖¡ ╡╜ ╔╧ ╥╗ ╕÷ ╝╟ ┬╝'
  64.    @ 23, 70 PROMPT "8.╖╡╗╪" MESSAGE SPACE(4);
  65.          + '╖╡ ╗╪ ╡╜ ╔╧ ╥╗ ╝╢ ▓╦ ╡Ñ'
  66.    MENU TO menuchoice
  67.    editchoice=SUBSTR("EEFGL"+delrecord+"NP"+returnkey,menuchoice+1,1)
  68. <<*
  69.    pushmargin(1)
  70.      if ismultipage
  71.        EditLitePage
  72.      else
  73.        EditLiteOne
  74.      endif
  75.    popmargin
  76. *>>
  77. * ---SET CURSOR OFF
  78.    ?? SYS(2002)
  79.    DO CASE
  80.    CASE editchoice = Returnkey
  81.       EXIT
  82.    CASE editchoice = "F"
  83.       * ---Find a record.
  84.       ?? SYS(2002,1)
  85.    <<select all databases>>
  86.    <<if ndxtotal = 0>>
  87.       DO SayLine WITH row,"*** ╡▒╟░╩²╛▌┐Γ├╗╙╨╦≈╥²╬─╝■."
  88.       WAIT
  89.       @ row,0 CLEAR
  90.    <<elsif ismultindx>>
  91.       DO {fileprefix}X WITH row,ndxchoice
  92.       IF ndxchoice > "0"
  93.          oldrecnum = RECNO()
  94.          DO {fileprefix}Z WITH row
  95.          IF EOF()
  96.             DO SayLine WITH row,"├╗╙╨▓Θ╡╜."
  97.             WAIT
  98.             GOTO oldrecnum
  99.          ELSE
  100.             DO SayRec
  101.          ENDIF
  102.       ENDIF
  103.    <<else>>
  104.       oldrecnum = RECNO()
  105.       DO {fileprefix}Z WITH row
  106.       IF EOF()
  107.          DO SayLine WITH row,"├╗╙╨▓Θ╡╜."
  108.          WAIT
  109.          GOTO oldrecnum
  110.       ELSE
  111.          DO SayRec
  112.       ENDIF
  113.    <<endif>>
  114. <<*
  115. <<if feat(featlabel)>>
  116.    CASE editchoice = "O"
  117.       * ---Print one label/record.
  118.       <<if AutoMem>>
  119.       DO {fileprefix}T
  120.       <<endif>>
  121.       <<pushmargin( 2 )>>
  122.       <<GenOutputItems>>
  123.       <<popmargin>>
  124. <<endif>>
  125. *>>
  126.    CASE editchoice = "N"
  127.       * ---Next record.
  128.       oldrecnum = RECNO()
  129.       SKIP
  130.       IF EOF()
  131.          DO SayEOF WITH row,oldrecnum
  132.       ELSE
  133.          DO SayRec
  134.       ENDIF
  135.    CASE editchoice = "P"
  136.       * ---Previous record.
  137.       oldrecnum = RECNO()
  138.       SKIP -1
  139.       IF BOF()
  140.          DO SayEOF WITH row,oldrecnum
  141.       ELSE
  142.          DO SayRec
  143.       ENDIF
  144.    CASE editchoice = "E"
  145.       * ---Edit the record.
  146.       isedited = .T.
  147.       <<if AutoMem>>
  148.       DO {fileprefix}T
  149.       <<endif>>
  150. <<if ismultipage>>
  151.       lastpage = pageno
  152.       DO {fileprefix}A
  153.       IF pageno <> lastpage
  154.          DO {fileprefix}F
  155.          DO SayRec
  156.          lastpage = pageno
  157.       ENDIF
  158.       DO WHILE .T.
  159.          DO SayLine WITH row+1,'╟δ╨▐╕─╝╟┬╝...'
  160.          IF pageno = lastpage
  161.             DO {fileprefix}K WITH expr,IsBlank,IsUnique
  162.             * ---If you don't want the user to edit the
  163.             * ---key fields, then delete this IF structure.
  164.          ENDIF
  165.          DO {fileprefix}G
  166.          DO Page WITH pageno,1,PageMax
  167.          DO {fileprefix}F
  168.    <<if AutoMem>>
  169.          IF pageno = lastpage
  170.             EXIT
  171.          ENDIF
  172.          DO SayRec
  173.       ENDDO
  174.       DO {fileprefix}R
  175.       DO SayRec
  176.    <<else>>
  177.          DO SayRec
  178.          IF pageno = lastpage
  179.             EXIT
  180.          ENDIF
  181.       ENDDO
  182.    <<endif>>
  183. <<else>> <<*single page format*>>
  184.       DO SayLine WITH row+1,'╟δ╨▐╕─╝╟┬╝...'
  185.       * ---If you don't want the user to edit the
  186.       * ---key fields, then delete the following line.
  187.       DO {fileprefix}K WITH expr,IsBlank,IsUnique
  188.       DO {fileprefix}G
  189.       <<if AutoMem>>
  190.       DO {fileprefix}R
  191.       <<endif>>
  192. <<endif>> <<*single page format*>>
  193. <<if ismultipage>>
  194.   <<select all>>
  195.   <<if LiteBar and (pagtotal > 2) and  Fox>>
  196.    CASE editchoice = PgDn
  197.       <<pushmargin( 2 )>>
  198.       <<GenPageItems>>
  199.       <<popmargin>>
  200.   <<else>>
  201.    CASE editchoice = PgDn
  202.       DO Page WITH pageno,1,PageMax
  203.       DO {fileprefix}F
  204.       DO SayRec
  205.    CASE editchoice = PgUp
  206.       DO Page WITH pageno,-1,PageMax
  207.       DO {fileprefix}F
  208.       DO SayRec
  209.  <<endif>>
  210. <<endif>>
  211.    CASE editchoice = "L"
  212.       * ---Locate a record.
  213.       <<GenColor( 2,'WINDOW' )>>
  214.       @ 1,0 CLEAR
  215.      <<select database 8>>  <<*Is SELECT H being used?*>>
  216.       DO {fileprefix}V WITH expr
  217.       <<if ismultipage>>
  218.       DO {fileprefix}F
  219.       <<else>>
  220.       DO {fileprefix}F
  221.       <<endif>>
  222.       DO SayRec
  223.       IF "" <> TRIM( expr )
  224.          * ---Check for valid LOGICAL expression.
  225.          IF TYPE( expr ) = "L"
  226.             DO DoLOCATE WITH row,expr
  227.          ELSE
  228.            <<GenColor( 4,'PROMPT' )>>
  229.             @ row,0 CLEAR
  230.             @ row,4 SAY "╠⌡ ╝■ ▒φ ┤∩ ╩╜ ▓╗ ╒² ╚╖."
  231.             WAIT
  232.          ENDIF
  233.       ENDIF
  234.    CASE editchoice = "G"
  235.       * ---Goto a record.
  236.       DO DoGOTO WITH row,recnum,LastRec
  237.       IF recnum > 0
  238.          DO SayRec
  239.       ENDIF
  240. <<if LiteBar and Fox>>
  241.       menuchoice = 3
  242. <<endif>>
  243.    CASE editchoice = DelRecord
  244.       * ---Delete the record.
  245.       isedited = .T.
  246.       IF DELETED()
  247.          RECALL
  248.       ELSE
  249.          DELETE
  250.       ENDIF
  251.       DO StatLine WITH RECNO(),DELETED()
  252. <<if ismultials>>
  253.    CASE editchoice = "S"
  254.       * ---Select database file.
  255. <<#
  256.       pushmargin( 2 )
  257.       GenPrivateFlds( 1 )
  258.       popmargin
  259. #>>
  260.     <<if ismultipage>>
  261.       lastpage = pageno
  262.       DO {fileprefix}U WITH row,choice
  263.       IF lastpage = pageno
  264.          DO StatLine WITH RECNO(),DELETED()
  265.       ELSE
  266.          DO {fileprefix}F
  267.          DO SayRec
  268.       ENDIF
  269.     <<else>>
  270.       DO {fileprefix}U WITH row,choice
  271.       DO StatLine WITH RECNO(),DELETED()
  272.     <<endif>>
  273. <<#
  274.       pushmargin( 2 )
  275.       GenPrivateFlds( 0 )
  276.       popmargin
  277. #>>
  278. <<endif>>
  279.    ENDCASE
  280. ENDDO
  281. <<end>> <<*GenSBEditBody*>>
  282.  
  283. <<*EOF: SSBEDIT.INC*>>
  284.