Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Ways to trap function key
#1
This is not a bug report but I was about to declare an error.

This code contains 2 ways to trap the F1 key:

The difference is between soft key and scan key when key is set
  (has nothing to do with Key On or Key Off)..

Code: (Select All)
' Ways to trap function keys.
f$ = "EDIT"
KEY 1, f$ ' activate soft key.
Print "Press F1:"
Do
   x$ = InKey$
   If Len(x$) Then
      q$ = q$ + x$
   Else
      If Len(q$) Then
         Exit Do
      End If
   End If
Loop
If q$ = f$ Then
   Print "F1 pressed. (equals:"; q$; ")"
End If
KEY 1, "" ' decativate soft key.
Print "Press F1:"
Do
   x$ = InKey$
   If x$ = Chr$(0) + Chr$(59) Then
      Print "F1 pressed. (equals:"; Asc(Right$(x$, 1)); ")"
      Exit Do
   End If
Loop
End
Reply


Messages In This Thread
Ways to trap function key - by eoredson - 01-20-2024, 06:55 AM
RE: Ways to trap function key - by PhilOfPerth - 01-20-2024, 10:00 AM
RE: Ways to trap function key - by SMcNeill - 01-20-2024, 12:28 PM
RE: Ways to trap function key - by bplus - 01-20-2024, 02:01 PM
RE: Ways to trap function key - by TerryRitchie - 01-20-2024, 02:26 PM
RE: Ways to trap function key - by bplus - 01-20-2024, 03:46 PM
RE: Ways to trap function key - by SMcNeill - 01-20-2024, 06:25 PM



Users browsing this thread: 2 Guest(s)