Amos Professional Manual  Contents  Index

Using the Keyboard


E> Do
    While K$=""
     K$=Inkey$
    Wend
    If Asc(K$)=0 Then Print "No Ascii Code"
    Print "The Scan Code is ";Scancode
    K$=""
   Loop

SCANSHIFT
function: return shift status of key entered with INKEY$
s=Scanshift

To determine if keys are pressed at the same time as either or both of the [Shift] keys, the Scanshift function returns the following values:

Value   Meaning
0       no [Shift] key pressed
1       [Left Shift] pressed
2       [Right Shift] pressed
3       both [Shift] keys pressed

Try out the following example by pressing various keys, in combination with the [Shift] keys:

E> Do
    A$=Inkey$
    S=Scanshift
    If S<>0
     Print S
    End If
   Loop

KEY STATE
function: test for a specific key press
k=Key State(scan code)

Use this function to check whether or not a specific key has been pressed. The relevant scan code should be enclosed in brackets, and when the associated key is being pressed KEY STATE will return a value of TRUE (-1), otherwise the result will be given as FALSE (0). For example:

E> Do
    If Key State(69)=True Then Print "ESCAPE!" : Rem Esc key pressed
    If Key State(95)=True Then Print "HELP!": Rem Help key pressed
   Loop
Back    Next
10.01.02