home *** CD-ROM | disk | FTP | other *** search
/ World of Graphics / WOGRAPH.BIN / 314.IMGDEMO.PRG < prev    next >
Text File  |  1992-04-08  |  3KB  |  141 lines

  1. *********************************************************
  2. * Clipper Demonstration Program
  3. * Using Visage Document Image Processing
  4. * Copyright 1992, Document Image Development Corp.
  5. *********************************************************
  6. i = 0
  7. declare brwse_fields[1]
  8. brwse_fields[1] = "DOCID"
  9.  
  10. use docs index docs
  11. choice = 0
  12.  
  13. * Make sure that Visage is loaded
  14. i = LOCATETSR()
  15. if (i = 0)
  16.   ? "Visage must be loaded before running this program."
  17.   return
  18. endif
  19.  
  20. * Start the menu system
  21. do while choice != 5
  22.   clear screen
  23.   @  5, 9 to 11, 19
  24.   @  6, 10 PROMPT " Memos   "
  25.   @  7, 10 PROMPT " Letters "
  26.   @  8, 10 PROMPT " Bills   "
  27.   @  9, 10 PROMPT " Misc    "
  28.   @ 10, 10 PROMPT " Quit    "
  29.   menu to choice
  30.  
  31.   if choice = 1
  32.     set filter to DOCS->DOCTYPE = "MEMO"
  33.     DOC_ST = "MEMO"
  34.   endif
  35.  
  36.   if choice = 2
  37.     set filter to DOCS->DOCTYPE = "LETTER"
  38.     DOC_ST = "LETTER"
  39.   endif
  40.  
  41.   if choice = 3
  42.     set filter to DOCS->DOCTYPE = "BILL"
  43.     DOC_ST = "BILL"
  44.   endif
  45.  
  46.   if choice = 4
  47.     set filter to DOCS->DOCTYPE = "MISC"
  48.     DOC_ST = "MISC"
  49.   endif
  50.  
  51.   if choice = 5
  52.     clear screen
  53.     return
  54.   endif
  55.  
  56.   save screen to scr
  57.   @ 3, 29 to 15, 50
  58.   @ 16, 29 say "Press INS to add a record"
  59.   @ 17, 29 say "Press ENTER to edit a record"
  60.   @ 18, 29 say "Press F10 for Document Menu"
  61.   dbedit(4, 30, 14, 49, brwse_fields, "USERFUNC")
  62.   restore screen from scr
  63. enddo
  64.  
  65. *********************************************************
  66.  
  67. function userfunc
  68. parameters status, fld_ptr
  69. private request
  70.  
  71. key_stroke = lastkey()
  72.  
  73. do case
  74.  
  75.    case status = 4
  76.  
  77.      if key_stroke = 22 && INS key means add a new record
  78.        add_record()
  79.      endif
  80.  
  81.      if key_stroke = 27 && ESC exits from DBEDIT
  82.        return 0
  83.      endif
  84.  
  85.      if key_stroke = 13 && Enter means edit current record or add if blank
  86.        if empty(DOCS->DOCTYPE)
  87.          add_record()
  88.        else
  89.          edit_record()
  90.        endif
  91.      endif
  92.  
  93.      if key_stroke = -9 && F10 activates Visage menu system.
  94.        if .not. empty(DOCS->IMGKEY)
  95.          CALLMENU("DOCS",DOCS->IMGKEY,0,"")
  96.        endif
  97.      endif
  98.  
  99. endcase
  100.  
  101. return 1
  102.  
  103. *********************************************************
  104.  
  105. function edit_record
  106. private scr
  107. save screen to scr
  108.  
  109. @ 21,10 say "DOCID: " get docs->docid
  110. set cursor on
  111. read
  112. set cursor off
  113.  
  114. restore screen from scr
  115. return 0
  116.  
  117. *********************************************************
  118.  
  119. function add_record
  120. private scr,m1
  121.  
  122. m1 = space(10)
  123. save screen to scr
  124.  
  125. @ 21,10 say "DOCID: " get m1
  126. set cursor on
  127. read
  128. set cursor off
  129.  
  130. if lastkey() != 27
  131.   append blank
  132.   replace docs->doctype with DOC_ST
  133.   replace docs->docid with m1
  134.  
  135.   * Get a unique image key from Visage
  136.   replace docs->IMGKEY with UKEY("DOCS",10)
  137. endif
  138.  
  139. restore screen from scr
  140. return 0
  141.