home *** CD-ROM | disk | FTP | other *** search
/ Shareware Overload / ShartewareOverload.cdr / database / mul_read.zip / MUL_READ.PRG next >
Text File  |  1988-10-11  |  5KB  |  150 lines

  1. * Code fragment to do more than one read at a time
  2. * Author: Ron Lane
  3. * BBS   : RON'S ROS   (817) 540-4183
  4. * this will compile to a simple demo
  5. *
  6. *
  7. CLEA
  8. SET KEY -4 TO F5proc               && Proc to call from main read
  9. read1_a = SPACE(10)
  10. read1_b = SPACE(10)
  11. read1_c = SPACE(10)
  12. read1_d = SPACE(20)
  13. read1_e = SPACE(10)
  14. in_var  = ""                      && public var for READVAR()
  15.  
  16. @ 0,25 SAY "E D I T     F5 for Read change"
  17. @ 1,0 TO 24,79
  18. DO get_1                         && get our Main gets
  19.  
  20. DO WHIL .T.                     && Loop to control our reads
  21. changed = .F.                   && var to check for sub reads
  22. READ
  23.   IF changed                    && have we done a sub read
  24. SET KEY -4 TO F5proc            && reset our proc key
  25. DO get_1                        && get our main gets again
  26. SET KEY 99 TO reset_get         && looping proc to retun to our current get
  27. KEYBOARD CHR(99)                && any key will work
  28. LOOP                            && do this till we are were we want
  29. ELSE                            && no sub reads
  30. EXIT                            && we are done so quit
  31.   ENDI
  32. ENDD * --- whil .t.
  33.  
  34. INKEY(0)
  35. QUIT
  36.  
  37. **********
  38. PROC get_1
  39. **********
  40. CLEA GETS                      && this way we can do multi reads
  41. @  4, 2 CLEA TO 12,78
  42. changed = .T.                  && so our loop will continue
  43. @  4, 2 SAY "Read1 A " GET read1_a
  44. @  6, 2 SAY "Read1 B " GET read1_b
  45. @  8, 2 SAY "Read1 C " GET read1_c
  46. @ 10, 2 SAY "Read1 D " GET read1_d VALID SUB_READ()     && we can do it from
  47. @ 10,35 SAY "Press <CR> on empty get for Valid read"    && a Valid Function
  48. @ 12, 2 SAY "Read1 E " GET read1_e
  49. RETU
  50.  
  51. ************
  52. PROC  F5proc
  53. ************
  54. in_var  = READVAR()        && update our current read
  55. DO CASE
  56. **
  57.  
  58. CASE READVAR() = "READ1_A"       && check were we are in main read
  59. ****
  60. SET KEY -4 TO              && kill our proc key
  61. CLEA GETS                  && kill previous reads
  62. @  4, 2 CLEA TO 12,78
  63. changed = .T.              && we have been here so let main read know
  64. read2_a = SPACE(10)              && we could select other workarea
  65. read2_b = SPACE(10)              && and make changes
  66. @  4, 2 SAY "Read2 A " GET read2_a   && these could be a proc like get_1
  67. @  6, 2 SAY "Read2 A " GET read2_b
  68. READ
  69.  
  70. CASE READVAR() = "READ1_B"
  71. ****
  72. SET KEY -4 TO              && kill our proc key
  73. CLEA GETS                  && kill previous reads
  74. @  4, 2 CLEA TO 12,78
  75. changed = .T.              && we have been here so let main read know
  76. read3_a = SPACE(10)
  77. read3_b = SPACE(10)
  78. @  4, 2 SAY "Read3 A " GET read3_a
  79. @  6, 2 SAY "Read3 B " GET read3_b
  80. READ
  81.  
  82. CASE READVAR() = "READ1_C"
  83. ****
  84. SET KEY -4 TO              && kill our proc key
  85. CLEA GETS                  && kill previous reads
  86. @  4, 2 CLEA TO 12,78
  87. changed = .T.              && we have been here so let main read know
  88. DO READ1C                       && Pass control to another proc
  89.  
  90. OTHE
  91. ****
  92. in_var = ""
  93. RETU                            && do nothing
  94. ENDC * --- Readvar()
  95. RETU                            && retun to main read
  96.  
  97. **************
  98. PROC reset_get                  && our looping proc to get to current get
  99. **************
  100.   IF READVAR() = in_var         && are we there yet
  101. SET KEY 99 TO                   && yes so kill our temp key
  102. in_var = ""                     && clear our current READVAR()
  103. ELSE
  104. KEYBOARD CHR(13) + CHR(99)      && no so do it again
  105.   ENDI                          && Chr 13 is <CR>
  106. RETU
  107.  
  108. ***********
  109. PROC read1c
  110. ***********                          && here we change one of our main gets
  111. read4_a = SPACE(5)                   && again this could be another workarea
  112. read4_b = SPACE(5)
  113. @  4, 2 SAY "Read4 A " GET read4_a
  114. @  6, 2 SAY "Read4 B " GET read4_b
  115. READ
  116. M->&in_var = read4_a + read4_b       && update our main var with data from
  117. RETU                                 && this read
  118.  
  119. *************
  120. FUNC sub_read
  121. *************
  122. in_var  = READVAR()
  123. read5_a = SPACE(10)                  && again this could be another workarea
  124. read5_b = SPACE(10)
  125.  
  126. DO WHIL EMPTY(M->&in_var)   && this could be a test for anything
  127. SET KEY -4 TO              && kill our proc key
  128. CLEA GETS                  && kill previous reads
  129. @  4, 2 CLEA TO 12,78
  130. @  4, 2 SAY "Read5 A " GET read5_a
  131. @  6, 2 SAY "Read5 B " GET read5_b
  132. READ
  133.  
  134.   IF EMPTY(read5_a) .OR. EMPTY(read5_b)     && did we update ?
  135. ?? CHR(7)                                   && get there attention
  136. @ 10,20 SAY "No empty Gets Please"          && tell them whats wrong
  137. INKEY(2)
  138. LOOP
  139. ELSE
  140. M->&in_var = read5_a + read5_b              && OK got what we want
  141. DO get_1                        && main gets
  142. changed = .F.                   && in a valid read we don't need to loop
  143.   ENDI
  144.  
  145. SET KEY -4 TO F5proc            && reset our proc key
  146. ENDD * --- empty(in_var)
  147.  
  148. RETU( .T. )                     && retun to our Valid function
  149.  
  150.