home *** CD-ROM | disk | FTP | other *** search
/ Media Share 9 / MEDIASHARE_09.ISO / clarion / putkeys.zip / PUTKEYS.CLA < prev   
Text File  |  1990-03-31  |  6KB  |  148 lines

  1. PUTKEYS         PROGRAM
  2. !-----------------------------------------------------------------------------
  3. ! This is a simple demonstration of how to put keys into the typeahead keyboard
  4. ! buffer. The keyboard buffer will accommodate a maximum of 15 characters. Each
  5. ! character must be converted to an ASCII value, then POKEd into an absolute
  6. ! address. Therefore, two parameters must be passed to the Put_Keyboard
  7. ! procedure; the STRING and its LENGTH. The Put_Keyboard procedure can be used
  8. ! to conditionally branch to another program upon existing a Clarion program.
  9. ! If the filename and its command line parameters are longer than 14 characters
  10. ! (15; counting the CHR(13)), a series of batch files may be used.
  11. ! Put_Keyboard may be used within an application to position the cursor in a
  12. ! field ,e.g. Put_Keyboard('   ',3) will move the cursor three characters in a
  13. ! string field. Also, Put_Keyboard can be used to pre-type default information
  14. ! into a string field, e.g. Put_Keyboard('Z',1) would start a string with the
  15. ! letter "Z" and position the cursor for the next character.
  16. ! Note: This technique only works with the standard ASCII character set.
  17. ! Function keys and Extended keys (Alt and Ctrl keys) do not work with this
  18. ! technique. However, I have a companion procedure that will. Please inquire.
  19. ! Also, Put_Keyboard may not work with utilities that extend or relocate the
  20. ! keyboard buffer address, e.g. SuperKey, ProKey.
  21. !            Your critical comments are welcome.
  22. !------------------------------------------------------------------------------
  23. !                  March 30, 1990
  24. !                   Randy Goodhew
  25. !               PROFESSIONAL TECHNOLOGIES CONSULTANTS
  26. !                508 Greenup Street
  27. !                 Covington, Kentucky 41011
  28. !                   (606)491-3020
  29. !-------------------------------------------------------------------------------
  30.   MAP
  31.    PROC(Put_Keyboard)
  32.    PROC(FX_Cross)
  33.   END !map
  34. Screen         SCREEN      HUE(3,0,0)
  35.            ROW(1,1)      STRING('╔═{11}╤═{14}╗'),HUE(15,0)
  36.            ROW(2,1)      REPEAT(3);STRING('║<0{11}>│<0{14}>║'),HUE(15,0) .
  37.            ROW(5,1)      STRING('╚═{11}╧═{14}╝'),HUE(15,0)
  38.            ROW(1,29)  STRING('╔═{50}╗'),HUE(15,1)
  39.            ROW(2,29)  REPEAT(3);STRING('║<0{50}>║'),HUE(15,1) .
  40.            ROW(5,29)  STRING('╚═{50}╝'),HUE(15,1)
  41.            ROW(14,14) STRING('┌─{51}┐'),HUE(15,1)
  42.            ROW(15,14) STRING('│<0{51}>│'),HUE(15,1)
  43.            ROW(16,14) STRING('└─{51}┘'),HUE(15,1)
  44.            ROW(2,3)      STRING('╔═╦═╦═╦═╕'),HUE(4,7)
  45.            ROW(3,3)      STRING('╠═╝<0>║<0>║'),HUE(4,7)
  46.            ROW(4,3)      STRING('╨<0{3}>╨<0>╚═╛'),HUE(4,7)
  47.            ROW(6,1)      REPEAT(8);STRING('▒{80}'),HUE(7,0) .
  48.            ROW(14,1)  STRING('▒{13}<0{53}>▒{14}'),HUE(7,0)
  49.            ROW(15,1)  REPEAT(2);STRING('▒{13}<0{55}>▒{12}'),HUE(7,0) .
  50.            ROW(17,1)  STRING('▒{15}<0{53}>▒{12}'),HUE(7,0)
  51.            ROW(18,1)  REPEAT(7);STRING('▒{80}'),HUE(7,0) .
  52.            ROW(2,2)      STRING(' '),HUE(4,7)
  53.          COL(12)  STRING(' '),HUE(4,7)
  54.          COL(14)  STRING(' PROFESSIONAL '),HUE(15,4)
  55.          COL(30)  STRING(' {50}'),HUE(14,1)
  56.            ROW(3,2)      STRING(' '),HUE(4,7)
  57.          COL(6)      STRING(' '),HUE(4,7)
  58.          COL(8)      STRING(' '),HUE(4,7)
  59.          COL(10)  STRING('   '),HUE(4,7)
  60.          COL(14)  STRING(' TECHNOLOGIES '),HUE(1,7)
  61.          COL(30)  STRING(' {5}Demonstration of Keyboard Buffer '       |
  62.                 & 'Stuffing    '),HUE(14,1)
  63.            ROW(4,2)      STRING(' '),HUE(4,7)
  64.          COL(4)      STRING('   '),HUE(4,7)
  65.          COL(8)      STRING(' '),HUE(4,7)
  66.          COL(12)  STRING(' '),HUE(4,7)
  67.          COL(14)  STRING(' CONSULTANTS  '),HUE(15,1)
  68.          COL(30)  STRING(' {50}'),HUE(14,1)
  69.            ROW(15,15) STRING(' Exit this program and Run:  '),HUE(7,1)
  70.          COL(51)  STRING('  '),HUE(7,1)
  71.          COL(56)  STRING('  '),HUE(7,1)
  72.          COL(65)  STRING(' '),HUE(7,1)
  73.            ROW(17,16) STRING(' {51}'),HUE(7,0)
  74.            ROW(25,55) STRING(' {26}'),HUE(1,7)
  75.          COL(1)      STRING(' {24}'),HUE(1,7)
  76.          COL(25)  MENU(@S30),HUE(1,7),SEL(1,7)
  77.            ROW(15,44)   STRING('Clarion'),HUE(14,1),SEL(0,7)           |
  78.                   DESC('CLARION.COM must be in PATH')
  79.          COL(53)    STRING('DIR'),HUE(14,1),SEL(0,7)               |
  80.                   DESC('Exit and run DIR *.* /P')
  81.          COL(58)    STRING('PUTKEYS'),HUE(14,1),SEL(0,7)           |
  82.                   DESC('Exit and run CRUN PUTKEYS')
  83.          .          .
  84.  
  85.   CODE
  86.   SETHUE(7,0,0)
  87.   BLANK
  88.   SETHUE
  89.   OPEN(SCREEN)
  90.   ACCEPT
  91.   CASE CHOICE()
  92.   OF 1
  93.      Put_Keyboard('CLARION' & CHR(13),8)      !string, length
  94.   OF 2                          !Note: CHR(13) = Enter key
  95.      Put_Keyboard('DIR *.* /P' & CHR(13),11)
  96.   OF 3
  97.      Put_Keyboard('CRUN PUTKEYS' & CHR(13),13)
  98.   END !case choice()
  99.   FX_Cross(0,0,0)                  !Screen Clearing Effect
  100.   SETHUE(7,0,0)
  101.   BLANK
  102.   RETURN
  103. !-------------------------------------------------
  104. Put_Keyboard PROCEDURE(param,length)
  105.          GROUP,PRE(L)              !Local Variables
  106. param           STRING(15)
  107. length           BYTE      !Length of string to be stuffed
  108. addr           REAL      !Absolute memory address in keyboard buffer
  109. count           LONG      !Loop count and substring position
  110. char           BYTE      !ASCII value of a character
  111.          END !group
  112.   CODE
  113.   IF L:length > 15 THEN L:length = 15.          !Be sure L:length is not > 15.
  114.   IF NOT L:length THEN RETURN.
  115.   POKE(0040001Ah,30)                  !Keyboard buffer head pointer
  116.   POKE(0040001Ch,30 + (L:length * 2))          !Keyboard buffer tail pointer
  117.   LOOP L:count = 1 TO L:length
  118.     L:addr = 0040001Ch + (L:count * 2)          !Note: Buffer starts at 0040001Eh
  119.     L:char = VAL(SUB(L:param,L:count,1))      !Get the ASCII value of character
  120.     POKE(L:addr,L:char)                  !Stuff the keyboard buffer
  121.   END !loop
  122. !-------------------------------------------------
  123. FX_Cross     PROCEDURE(fg,bg,border)          !Screen Clearing Effect
  124. fg         LONG
  125. bg         LONG
  126. border         LONG
  127. row1         LONG
  128. row2         LONG
  129. col1         LONG
  130. col2         LONG
  131.   CODE
  132.   SETHUE(fg,bg,border)
  133.   row1 = 13
  134.   row2 = 13
  135.   col1 = 41
  136.   col2 = 40
  137.   LOOP 13 TIMES
  138.     COLOR(row1,1,1,80)
  139.     COLOR(row2,1,1,80)
  140.     COLOR(1,col1,25,3)
  141.     COLOR(1,col2,25,3)
  142.     col1 -= 3
  143.     col2 += 3
  144.     row1 -= 1
  145.     row2 += 1
  146.     BEEP(0,8)             !TIMING DELAY =  8/100 SECOND
  147.   END !loop
  148.