home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Media Share 9
/
MEDIASHARE_09.ISO
/
clarion
/
keyspeed.zip
/
KEYSPEED.CLA
< prev
Wrap
Text File
|
1990-04-21
|
6KB
|
155 lines
KEYSPEED PROGRAM
!------------------------------------------------------------------------------
! This demo shows how to control the Keyboard Typematic Delay and Rate.
! Note: This technique will only work on an AT (or better) class system.
! Sorry, it won't work on an XT class machine (8088).
! This technique is discussed in more detail in our PTC Toolkit for Clarion.
!------------------------------------------------------------------------------
! Randy Goodhew 04/21/90
! PROFESSIONAL TECHNOLOGIES CONSULTANTS
! 1005 Madison Avenue
! Covington, Kentucky 41011-3113
! Phone:(606)261-6819
!------------------------------------------------------------------------------
MAP
PROC(FX_Random) !Special Screen Effect
PROC(KB_Speed) !Keyboard Typematic Procedure
.
SCREEN SCREEN PRE(SCR),HUE(7,1)
ROW(1,1) STRING('<201,205{11},209,205{14},187>'),HUE(15,0)
ROW(2,1) REPEAT(3)
STRING('<186,0{11},179,0{14},186>'),HUE(15,0) .
ROW(5,1) STRING('<200,205{11},207,205{14},188>'),HUE(15,0)
ROW(1,29) STRING('<201,205{50},187>'),ENH
ROW(2,29) REPEAT(3);STRING('<186,0{50},186>'),ENH .
ROW(5,29) STRING('<200,205{50},188>'),ENH
ROW(2,3) STRING('<201,205,203,205,203,205,203,205,184>') |
HUE(4,7)
ROW(3,3) STRING('<204,205,188,0,186,0,186>'),HUE(4,7)
ROW(4,3) STRING('<208,0{3},208,0,200,205,190>'),HUE(4,7)
ROW(2,2) STRING(' '),HUE(4,7)
COL(12) STRING(' '),HUE(4,7)
COL(14) STRING(' PROFESSIONAL '),HUE(15,4)
ROW(3,2) STRING(' '),HUE(4,7)
COL(6) STRING(' '),HUE(4,7)
COL(8) STRING(' '),HUE(4,7)
COL(10) STRING(' '),HUE(4,7)
COL(14) STRING(' TECHNOLOGIES '),HUE(1,7)
COL(38) STRING('Demonstration of KB_Speed Procedure') |
HUE(14,1)
ROW(4,2) STRING(' '),HUE(4,7)
COL(4) STRING(' '),HUE(4,7)
COL(8) STRING(' '),HUE(4,7)
COL(12) STRING(' '),HUE(4,7)
COL(15) STRING('CONSULTANTS'),ENH
ROW(25,1) STRING(' {29}Delay: '),HUE(1,7)
COL(39) STRING(' {6}Rate: '),HUE(1,7)
COL(53) STRING(' {28}'),HUE(1,7)
T_DELAY COL(37) STRING(@N2),HUE(4,7)
T_RATE COL(51) STRING(@N2),HUE(4,7)
.
AskString STRING(60) !ASK Variable
CODE
SETHUE(7,1,0)
BLANK
SETHUE
OPEN(SCREEN)
LOOP WHILE KEYBOARD() !Clear keyboard buffer
ASK
END
SHOW(10,24,'Hold any key down until it repeats')
KB_Speed(0,0) !Speedup keyboard
SHOW(14,25,CENTER('Fastest Delay and Rate',30))
Scr:T_Delay = 0
Scr:T_Rate = 0
ASK(12,11,AskString,@S60)
CLEAR(AskString)
BLANK(12,11,1,60)
KB_Speed(3,31) !Slowdown keyboard
SHOW(14,25,CENTER('Slowest Delay and Rate',30))
Scr:T_Delay = 3
Scr:T_Rate = 31
ASK(12,11,AskString,@S60)
CLEAR(AskString)
BLANK(12,11,1,60)
KB_Speed !Reset keyboard to default.
SHOW(14,25,CENTER('Default Delay and Rate',30))
Scr:T_Delay = 2
Scr:T_Rate = 12
ASK(12,11,AskString,@S60)
CLEAR(AskString)
BLANK(12,11,1,60)
BLANK(10,24,1,34)
SETHUE(28,1,0)
SHOW(14,1,CENTER('Press any key to Exit',80))
ASK
FX_Random(0,0,0) !Special Screen Effect
! CLOSE(SCREEN)
SETHUE(7,0,0)
BLANK
!------------------------------------------------------------------------------
! Special Screen Effect Procedure from our FX Library
!------------------------------------------------------------------------------
FX_Random PROCEDURE(fg,bg,border)
fg LONG
bg LONG
border LONG
row1 LONG
col1 LONG
CODE
SETHUE(fg,bg,border)
LOOP 750 TIMES
row1 = RANDOM(1,24)
col1 = RANDOM(1,78)
COLOR(row1,col1,2,4)
END !loop
!------------------------------------------------------------------------------
! This Procedure is used to set the Keyboard Typematic Delay and Rate.
! Two parameters are used; T_Delay (to set INITIAL DELAY) and T_Rate (to set
! the REPEAT RATE). The INITIAL DELAY is adjustable from 250 milliseconds to
! one full second. The REPEAT RATE parameter is inversly related to the number
! of repeats per second, i.e. the lower the number, the higher the repeat rate.
! If a parameter is omitted or is not in the specified range, the default
! value is used.
!------------------------------------------------------------------------------
KB_Speed PROCEDURE(T_Delay,T_Rate)
T_Delay BYTE
T_Rate BYTE
CODE
IF OMITTED(1) OR NOT INRANGE(T_Delay,0,3) THEN T_Delay = 2. !Default delay
IF OMITTED(2) OR NOT INRANGE(T_Rate,0,31) THEN T_Rate = 12. !Default rate
OUT(96,243) !Alert keyboard port
OUT(96,BOR((T_Delay * 32),T_Rate)) !Send typematic value
!-------------------------------------------------------------------------------
! Tables of Typematic Delays and Rates
!-------------------------------------------------------------------------------
! ╔═════════════════╗ ╔═══════════════════════════════════════╗
! ║ INITIAL DELAY ║ ║ REPEAT RATE ║
! ╠═════════╤═══════╣ ╠════════╤══════════╦════════╤══════════╣
! ║ T_Delay │Second ║ ║ T_Rate │ Rpts/Sec ║ T_Rate │ Rpts/Sec ║
! ╟─────────┼───────╢ ╟────────┼──────────╫────────┼──────────╢
! ║ 0 │ .250 ║ ║ 0 │ 30.0 ║ 16 │ 7.5 ║
! ║ 1 │ .500 ║ ║ 1 │ 26.7 ║ 17 │ 6.7 ║
! ║ 2 │ .750 ║ ║ 2 │ 24.0 ║ 18 │ 6.0 ║
! ║ 3 │ 1.000 ║ ║ 3 │ 21.8 ║ 19 │ 5.5 ║
! ╚═════════╧═══════╝ ║ 4 │ 20.0 ║ 20 │ 5.0 ║
! ║ 5 │ 18.5 ║ 21 │ 4.6 ║
! ║ 6 │ 17.1 ║ 22 │ 4.3 ║
! ║ 7 │ 16.0 ║ 23 │ 4.0 ║
! ║ 8 │ 15.0 ║ 24 │ 3.7 ║
! ║ 9 │ 13.3 ║ 25 │ 3.3 ║
! ║ 10 │ 12.0 ║ 26 │ 3.0 ║
! ║ 11 │ 10.9 ║ 27 │ 2.7 ║
! ║ 12 │ 10.0 ║ 28 │ 2.5 ║
! ║ 13 │ 9.2 ║ 20 │ 2.3 ║
! ║ 14 │ 8.6 ║ 30 │ 2.1 ║
! ║ 15 │ 8.0 ║ 31 │ 2.0 ║
! ╚════════╧══════════╩════════╧══════════╝
!