home *** CD-ROM | disk | FTP | other *** search
/ The Pier Shareware 6 / The_Pier_Shareware_Number_6_(The_Pier_Exchange)_(1995).iso / 008 / beechl.zip / DEMO.PRG < prev    next >
Text File  |  1994-10-06  |  3KB  |  80 lines

  1. * ┌─ Function ───────────────────────────────────────────────────────────────┐
  2. * │         Name: main                  Docs: AWB                            │
  3. * │  Description:                                                            │
  4. * │       Author: Andrew Bell                                                │
  5. * │ Date created: 24-05-94              Date updated: ■24-05-94              │
  6. * │ Time created: 02:35:29pm            Time updated: ■02:35:29pm            │
  7. * │    Copyright: A W Bell 1994                                              │
  8. * ├──────────────────────────────────────────────────────────────────────────┤
  9. * │    Arguments: None                                                       │
  10. * │ Return Value: (Nil)                                                      │
  11. * │     See Also:                                                            │
  12. * └──────────────────────────────────────────────────────────────────────────┘
  13.  
  14. //compile with the /N switch
  15. //Link rtlink fi demo lib beechlib
  16. #INCLUDE "inkey.CH"
  17. static cAction := '', nMemoRow:=0, nMemoCol:=1 //needs to be file wide
  18.  
  19. function main
  20.  
  21. /*
  22. Demonstrates the search and replace functions in action
  23. */
  24. local cOldScreen := savescreen()
  25. local cOldColor := setcolor("b/w,w+/b"),aRes
  26.  
  27. local cFile := memoread("memos.doc")
  28. cls
  29. set scoreboard off
  30. bl_box(5,5,20,75,"Demo - Press F9 to do a search")
  31.  
  32. do while cAction <> "QUIT"
  33.     //normally we'd save the result, but this is just a demo
  34.     cFile:=memoedit(cFile,7,6,19,74,.t.,"memocontrol",255,,nMemoRow,nMemoCol)
  35.     IF cAction=="SEARCH"
  36.         aRes:=bl_searchmem(@cFile,7,6,19,74,nMemoRow,nMemoCol)
  37.         nMemoRow:=aRes[1]
  38.         nMemoCol:=aRes[2]
  39.     ENDIF
  40. enddo
  41. restscreen(,,,,cOldScreen)
  42.  
  43. return (Nil)
  44.  
  45. * ┌─ Function ───────────────────────────────────────────────────────────────┐
  46. * │         Name: memocontrol()         Docs: AWB                            │
  47. * │  Description:                                                            │
  48. * │       Author: Andrew Bell                                                │
  49. * │ Date created: 24-05-94              Date updated: ■24-05-94              │
  50. * │ Time created: 02:43:52pm            Time updated: ■02:43:52pm            │
  51. * │    Copyright: A W Bell 1994                                              │
  52. * ├──────────────────────────────────────────────────────────────────────────┤
  53. * │    Arguments: mode                                                       │
  54. * │             : nLine                                                      │
  55. * │             : nCol                                                       │
  56. * │ Return Value: (Nil)                                                    │
  57. * │     See Also:                                                            │
  58. * └──────────────────────────────────────────────────────────────────────────┘
  59. function memocontrol(mode,nLine,nCol)
  60.  
  61. //test the mode
  62.  
  63. DO CASE
  64. CASE mode == 3
  65.     return 0
  66. CASE mode <> 0
  67.     IF lastkey(0)==K_F9
  68.         cAction:="SEARCH"
  69.         nMemoRow:=nLine
  70.         nMemoCol:=nCol
  71.         return K_CTRL_END
  72.     elseif lastkey()==K_ESC .OR. lastkey()==K_CTRL_W
  73.         cAction:="QUIT"
  74.         return K_CTRL_END
  75.     ENDIF
  76.  
  77. ENDCASE
  78.  
  79. return 0
  80.