home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Media Share 9
/
MEDIASHARE_09.ISO
/
clarion
/
putkeys.zip
/
PUTKEYS.CLA
< prev
Wrap
Text File
|
1990-03-31
|
6KB
|
148 lines
PUTKEYS PROGRAM
!-----------------------------------------------------------------------------
! This is a simple demonstration of how to put keys into the typeahead keyboard
! buffer. The keyboard buffer will accommodate a maximum of 15 characters. Each
! character must be converted to an ASCII value, then POKEd into an absolute
! address. Therefore, two parameters must be passed to the Put_Keyboard
! procedure; the STRING and its LENGTH. The Put_Keyboard procedure can be used
! to conditionally branch to another program upon existing a Clarion program.
! If the filename and its command line parameters are longer than 14 characters
! (15; counting the CHR(13)), a series of batch files may be used.
! Put_Keyboard may be used within an application to position the cursor in a
! field ,e.g. Put_Keyboard(' ',3) will move the cursor three characters in a
! string field. Also, Put_Keyboard can be used to pre-type default information
! into a string field, e.g. Put_Keyboard('Z',1) would start a string with the
! letter "Z" and position the cursor for the next character.
! Note: This technique only works with the standard ASCII character set.
! Function keys and Extended keys (Alt and Ctrl keys) do not work with this
! technique. However, I have a companion procedure that will. Please inquire.
! Also, Put_Keyboard may not work with utilities that extend or relocate the
! keyboard buffer address, e.g. SuperKey, ProKey.
! Your critical comments are welcome.
!------------------------------------------------------------------------------
! March 30, 1990
! Randy Goodhew
! PROFESSIONAL TECHNOLOGIES CONSULTANTS
! 508 Greenup Street
! Covington, Kentucky 41011
! (606)491-3020
!-------------------------------------------------------------------------------
MAP
PROC(Put_Keyboard)
PROC(FX_Cross)
END !map
Screen SCREEN HUE(3,0,0)
ROW(1,1) STRING('╔═{11}╤═{14}╗'),HUE(15,0)
ROW(2,1) REPEAT(3);STRING('║<0{11}>│<0{14}>║'),HUE(15,0) .
ROW(5,1) STRING('╚═{11}╧═{14}╝'),HUE(15,0)
ROW(1,29) STRING('╔═{50}╗'),HUE(15,1)
ROW(2,29) REPEAT(3);STRING('║<0{50}>║'),HUE(15,1) .
ROW(5,29) STRING('╚═{50}╝'),HUE(15,1)
ROW(14,14) STRING('┌─{51}┐'),HUE(15,1)
ROW(15,14) STRING('│<0{51}>│'),HUE(15,1)
ROW(16,14) STRING('└─{51}┘'),HUE(15,1)
ROW(2,3) STRING('╔═╦═╦═╦═╕'),HUE(4,7)
ROW(3,3) STRING('╠═╝<0>║<0>║'),HUE(4,7)
ROW(4,3) STRING('╨<0{3}>╨<0>╚═╛'),HUE(4,7)
ROW(6,1) REPEAT(8);STRING('▒{80}'),HUE(7,0) .
ROW(14,1) STRING('▒{13}<0{53}>▒{14}'),HUE(7,0)
ROW(15,1) REPEAT(2);STRING('▒{13}<0{55}>▒{12}'),HUE(7,0) .
ROW(17,1) STRING('▒{15}<0{53}>▒{12}'),HUE(7,0)
ROW(18,1) REPEAT(7);STRING('▒{80}'),HUE(7,0) .
ROW(2,2) STRING(' '),HUE(4,7)
COL(12) STRING(' '),HUE(4,7)
COL(14) STRING(' PROFESSIONAL '),HUE(15,4)
COL(30) STRING(' {50}'),HUE(14,1)
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(30) STRING(' {5}Demonstration of Keyboard Buffer ' |
& 'Stuffing '),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(14) STRING(' CONSULTANTS '),HUE(15,1)
COL(30) STRING(' {50}'),HUE(14,1)
ROW(15,15) STRING(' Exit this program and Run: '),HUE(7,1)
COL(51) STRING(' '),HUE(7,1)
COL(56) STRING(' '),HUE(7,1)
COL(65) STRING(' '),HUE(7,1)
ROW(17,16) STRING(' {51}'),HUE(7,0)
ROW(25,55) STRING(' {26}'),HUE(1,7)
COL(1) STRING(' {24}'),HUE(1,7)
COL(25) MENU(@S30),HUE(1,7),SEL(1,7)
ROW(15,44) STRING('Clarion'),HUE(14,1),SEL(0,7) |
DESC('CLARION.COM must be in PATH')
COL(53) STRING('DIR'),HUE(14,1),SEL(0,7) |
DESC('Exit and run DIR *.* /P')
COL(58) STRING('PUTKEYS'),HUE(14,1),SEL(0,7) |
DESC('Exit and run CRUN PUTKEYS')
. .
CODE
SETHUE(7,0,0)
BLANK
SETHUE
OPEN(SCREEN)
ACCEPT
CASE CHOICE()
OF 1
Put_Keyboard('CLARION' & CHR(13),8) !string, length
OF 2 !Note: CHR(13) = Enter key
Put_Keyboard('DIR *.* /P' & CHR(13),11)
OF 3
Put_Keyboard('CRUN PUTKEYS' & CHR(13),13)
END !case choice()
FX_Cross(0,0,0) !Screen Clearing Effect
SETHUE(7,0,0)
BLANK
RETURN
!-------------------------------------------------
Put_Keyboard PROCEDURE(param,length)
GROUP,PRE(L) !Local Variables
param STRING(15)
length BYTE !Length of string to be stuffed
addr REAL !Absolute memory address in keyboard buffer
count LONG !Loop count and substring position
char BYTE !ASCII value of a character
END !group
CODE
IF L:length > 15 THEN L:length = 15. !Be sure L:length is not > 15.
IF NOT L:length THEN RETURN.
POKE(0040001Ah,30) !Keyboard buffer head pointer
POKE(0040001Ch,30 + (L:length * 2)) !Keyboard buffer tail pointer
LOOP L:count = 1 TO L:length
L:addr = 0040001Ch + (L:count * 2) !Note: Buffer starts at 0040001Eh
L:char = VAL(SUB(L:param,L:count,1)) !Get the ASCII value of character
POKE(L:addr,L:char) !Stuff the keyboard buffer
END !loop
!-------------------------------------------------
FX_Cross PROCEDURE(fg,bg,border) !Screen Clearing Effect
fg LONG
bg LONG
border LONG
row1 LONG
row2 LONG
col1 LONG
col2 LONG
CODE
SETHUE(fg,bg,border)
row1 = 13
row2 = 13
col1 = 41
col2 = 40
LOOP 13 TIMES
COLOR(row1,1,1,80)
COLOR(row2,1,1,80)
COLOR(1,col1,25,3)
COLOR(1,col2,25,3)
col1 -= 3
col2 += 3
row1 -= 1
row2 += 1
BEEP(0,8) !TIMING DELAY = 8/100 SECOND
END !loop