home *** CD-ROM | disk | FTP | other *** search
/ Media Share 9 / MEDIASHARE_09.ISO / clarion / keyspeed.zip / KEYSPEED.CLA < prev   
Text File  |  1990-04-21  |  6KB  |  155 lines

  1. KEYSPEED     PROGRAM
  2. !------------------------------------------------------------------------------
  3. ! This demo shows how to control the Keyboard Typematic Delay and Rate.
  4. ! Note: This technique will only work on an AT (or better) class system.
  5. ! Sorry, it won't work on an XT class machine (8088).
  6. ! This technique is discussed in more detail in our PTC Toolkit for Clarion.
  7. !------------------------------------------------------------------------------
  8. !                 Randy Goodhew  04/21/90
  9. !              PROFESSIONAL TECHNOLOGIES CONSULTANTS
  10. !                   1005 Madison Avenue
  11. !               Covington, Kentucky    41011-3113
  12. !                   Phone:(606)261-6819
  13. !------------------------------------------------------------------------------
  14.  
  15.          MAP
  16.            PROC(FX_Random)             !Special Screen Effect
  17.            PROC(KB_Speed)             !Keyboard Typematic Procedure
  18.         .
  19. SCREEN         SCREEN      PRE(SCR),HUE(7,1)
  20.            ROW(1,1)      STRING('<201,205{11},209,205{14},187>'),HUE(15,0)
  21.            ROW(2,1)      REPEAT(3)
  22.                 STRING('<186,0{11},179,0{14},186>'),HUE(15,0) .
  23.            ROW(5,1)      STRING('<200,205{11},207,205{14},188>'),HUE(15,0)
  24.            ROW(1,29)  STRING('<201,205{50},187>'),ENH
  25.            ROW(2,29)  REPEAT(3);STRING('<186,0{50},186>'),ENH .
  26.            ROW(5,29)  STRING('<200,205{50},188>'),ENH
  27.            ROW(2,3)      STRING('<201,205,203,205,203,205,203,205,184>')      |
  28.                 HUE(4,7)
  29.            ROW(3,3)      STRING('<204,205,188,0,186,0,186>'),HUE(4,7)
  30.            ROW(4,3)      STRING('<208,0{3},208,0,200,205,190>'),HUE(4,7)
  31.            ROW(2,2)      STRING(' '),HUE(4,7)
  32.          COL(12)  STRING(' '),HUE(4,7)
  33.          COL(14)  STRING(' PROFESSIONAL '),HUE(15,4)
  34.            ROW(3,2)      STRING(' '),HUE(4,7)
  35.          COL(6)      STRING(' '),HUE(4,7)
  36.          COL(8)      STRING(' '),HUE(4,7)
  37.          COL(10)  STRING('   '),HUE(4,7)
  38.          COL(14)  STRING(' TECHNOLOGIES '),HUE(1,7)
  39.          COL(38)  STRING('Demonstration of KB_Speed Procedure')           |
  40.                 HUE(14,1)
  41.            ROW(4,2)      STRING(' '),HUE(4,7)
  42.          COL(4)      STRING('   '),HUE(4,7)
  43.          COL(8)      STRING(' '),HUE(4,7)
  44.          COL(12)  STRING(' '),HUE(4,7)
  45.          COL(15)  STRING('CONSULTANTS'),ENH
  46.            ROW(25,1)  STRING(' {29}Delay: '),HUE(1,7)
  47.          COL(39)  STRING(' {6}Rate: '),HUE(1,7)
  48.          COL(53)  STRING(' {28}'),HUE(1,7)
  49. T_DELAY         COL(37)  STRING(@N2),HUE(4,7)
  50. T_RATE         COL(51)  STRING(@N2),HUE(4,7)
  51.          .
  52.  
  53. AskString    STRING(60)                 !ASK Variable
  54.  
  55.   CODE
  56.     SETHUE(7,1,0)
  57.     BLANK
  58.     SETHUE
  59.     OPEN(SCREEN)
  60.     LOOP WHILE KEYBOARD()             !Clear keyboard buffer
  61.       ASK
  62.     END
  63.     SHOW(10,24,'Hold any key down until it repeats')
  64.   KB_Speed(0,0)                     !Speedup keyboard
  65.     SHOW(14,25,CENTER('Fastest Delay and Rate',30))
  66.     Scr:T_Delay = 0
  67.     Scr:T_Rate    = 0
  68.     ASK(12,11,AskString,@S60)
  69.     CLEAR(AskString)
  70.     BLANK(12,11,1,60)
  71.   KB_Speed(3,31)                 !Slowdown keyboard
  72.     SHOW(14,25,CENTER('Slowest Delay and Rate',30))
  73.     Scr:T_Delay = 3
  74.     Scr:T_Rate    = 31
  75.     ASK(12,11,AskString,@S60)
  76.     CLEAR(AskString)
  77.     BLANK(12,11,1,60)
  78.   KB_Speed                     !Reset keyboard to default.
  79.     SHOW(14,25,CENTER('Default Delay and Rate',30))
  80.     Scr:T_Delay = 2
  81.     Scr:T_Rate    = 12
  82.     ASK(12,11,AskString,@S60)
  83.     CLEAR(AskString)
  84.     BLANK(12,11,1,60)
  85.     BLANK(10,24,1,34)
  86.     SETHUE(28,1,0)
  87.     SHOW(14,1,CENTER('Press any key to Exit',80))
  88.     ASK
  89.     FX_Random(0,0,0)                 !Special Screen Effect
  90. !   CLOSE(SCREEN)
  91.     SETHUE(7,0,0)
  92.     BLANK
  93. !------------------------------------------------------------------------------
  94. ! Special Screen Effect Procedure from our FX Library
  95. !------------------------------------------------------------------------------
  96. FX_Random    PROCEDURE(fg,bg,border)
  97. fg         LONG
  98. bg         LONG
  99. border         LONG
  100. row1         LONG
  101. col1         LONG
  102.   CODE
  103.   SETHUE(fg,bg,border)
  104.   LOOP 750 TIMES
  105.     row1 = RANDOM(1,24)
  106.     col1 = RANDOM(1,78)
  107.     COLOR(row1,col1,2,4)
  108.   END !loop
  109.  
  110. !------------------------------------------------------------------------------
  111. ! This Procedure is used to set the Keyboard Typematic Delay and Rate.
  112. ! Two parameters are used; T_Delay (to set INITIAL DELAY) and T_Rate (to set
  113. ! the REPEAT RATE). The INITIAL DELAY is adjustable from 250 milliseconds to
  114. ! one full second. The REPEAT RATE parameter is inversly related to the number
  115. ! of repeats per second, i.e. the lower the number, the higher the repeat rate.
  116. ! If a parameter is omitted or is not in the specified range, the default
  117. ! value is used.
  118. !------------------------------------------------------------------------------
  119. KB_Speed     PROCEDURE(T_Delay,T_Rate)
  120. T_Delay         BYTE
  121. T_Rate         BYTE
  122.   CODE
  123.   IF OMITTED(1) OR NOT INRANGE(T_Delay,0,3) THEN T_Delay = 2.    !Default delay
  124.   IF OMITTED(2) OR NOT INRANGE(T_Rate,0,31) THEN T_Rate     = 12.    !Default rate
  125.   OUT(96,243)                !Alert keyboard port
  126.   OUT(96,BOR((T_Delay * 32),T_Rate))    !Send typematic value
  127.  
  128. !-------------------------------------------------------------------------------
  129. ! Tables of Typematic Delays and Rates
  130. !-------------------------------------------------------------------------------
  131. !    ╔═════════════════╗      ╔═══════════════════════════════════════╗
  132. !    ║  INITIAL DELAY  ║      ║         REPEAT RATE          ║
  133. !    ╠═════════╤═══════╣      ╠════════╤══════════╦════════╤══════════╣
  134. !    ║ T_Delay │Second ║      ║ T_Rate │ Rpts/Sec ║ T_Rate │ Rpts/Sec ║
  135. !    ╟─────────┼───────╢      ╟────────┼──────────╫────────┼──────────╢
  136. !    ║    0      │  .250 ║      ║    0   │   30.0   ║      16   │    7.5      ║
  137. !    ║    1      │  .500 ║      ║    1   │   26.7   ║      17   │    6.7      ║
  138. !    ║    2      │  .750 ║      ║    2   │   24.0   ║      18   │    6.0      ║
  139. !    ║    3      │ 1.000 ║      ║    3   │   21.8   ║      19   │    5.5      ║
  140. !    ╚═════════╧═══════╝      ║    4   │   20.0   ║      20   │    5.0      ║
  141. !                  ║    5   │   18.5   ║      21   │    4.6      ║
  142. !                  ║    6   │   17.1   ║      22   │    4.3      ║
  143. !                  ║    7   │   16.0   ║      23   │    4.0      ║
  144. !                  ║    8   │   15.0   ║      24   │    3.7      ║
  145. !                  ║    9   │   13.3   ║      25   │    3.3      ║
  146. !                  ║   10   │   12.0   ║      26   │    3.0      ║
  147. !                  ║   11   │   10.9   ║      27   │    2.7      ║
  148. !                  ║   12   │   10.0   ║      28   │    2.5      ║
  149. !                  ║   13   │    9.2   ║      20   │    2.3      ║
  150. !                  ║   14   │    8.6   ║      30   │    2.1      ║
  151. !                  ║   15   │    8.0   ║      31   │    2.0      ║
  152. !                  ╚════════╧══════════╩════════╧══════════╝
  153. !
  154.  
  155.