Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Force 4.0 Reference - dispatchkey() enable execution of functions associated with keys http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 dispatchkey()       Enable execution of functions associated with keys
------------------------------------------------------------------------------
 Declaration
   io.hdr

 Syntax
   func uint dispatchkey extern

 Arguments
   None.

 Return
   The key code from the last key press.

 Description
   The dispatchkey() function hooks the keystroke/function pairs defined by
   the definesetkey() function in the input system. The dispatchkey()
   function should be installed via the on key do command.

 Example
   #define EXAMPLE_IO
   #include example.hdr

   proc QuitFunc static
   quit
   endproc
   
   proc PrintFunc static
   ? "hello"
   endproc
   
   proc Test_dispatchkey
   ? "Press F1 to test, Esc to finish"
   initsetkey()                       // initialize set key system
   definesetkey( K_F1, &PrintFunc )   // install PrintFunc()
   definesetkey( K_ESC, &QuitFunc )   // install QuitFunc()
   dispatchkey()                      // start key processing
   do while .t.                       // get key presses
      inkey()
   enddo
   endproc

   proc main
   Test_dispatchkey()
   endproc

See Also: definesetkey() getsetkey() initsetkey()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson