home *** CD-ROM | disk | FTP | other *** search
/ PC User 2001 August / APC_Aug2001_CD2.iso / features / devtools / files / lb202win.exe / LB202W.EXE / INKEY.BAS < prev    next >
Encoding:
BASIC Source File  |  1998-02-16  |  661 b   |  30 lines

  1.  
  2.   'INKEY.BAS  - how to use the Inkey$ variable
  3.  
  4.   open "Inkey$ example" for graphics as #graph
  5.   print #graph, "when characterInput [fetch]"
  6.  
  7. [mainLoop]
  8.   print #graph, "setfocus"
  9.   input r$
  10.  
  11. [fetch]  'a character was typed!
  12.  
  13.   key$ = Inkey$
  14.   if len(key$) = 1 then
  15.       notice key$+" was pressed!"
  16.   else
  17.       keyValue = asc(right$(key$, 1))
  18.       if keyValue = _VK_SHIFT then
  19.           notice "Shift was pressed"
  20.         else
  21.           if keyValue = _VK_CONTROL then
  22.               notice "Ctrl was pressed"
  23.             else
  24.               notice "Unhandled key pressed"
  25.           end if
  26.       end if
  27.   end if
  28.  
  29.   goto [mainLoop]
  30.