Sphinx‎ > ‎Documentation‎ > ‎Reference‎ > ‎

isxkb

Isxkb is a lightweight interface object between Sphinx-aware programs and the Sphinx keyboard driver (sxkb).
 
Note that any object in a program's object hierarchy can use isxkb, not just the top object. This allows keyboard input anywhere in a program and can be very useful.

Spin interface methods 

  • PUB peekkey -- returns the next keycode but does not remove it from the queue. Returns 0 if no key pressed.
  • PUB key -- returns the next keycode. Returns 0 if no key pressed.
  • PUB getkey -- returns the next keycode. If no keys are in the queue, this method will wait until one is.

Example

' A simple demonstration of isxkb
' Note: Sphinx-aware programs don't need clock settings
obj
  kb : "isxkb"
  term : "isxtv"
  f: "sxfile"
pub Main | ch
  term.str( string("Are you alive? ") )
  ch := kb.getkey
  term.out( ch ) ' echo keystroke
  term.out( 13 )
  if ch == "y" or ch == "Y"
    term.str( string("That's a relief", 13) )
  else
    term.str( string("Uh-oh", 13) )
  ' Our work here is done. Now back to the command shell:
  f.Open( string("sphinx.bin"), "R" )
  f.Execute( 0 )