[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
##############################################################################
###+-----------+##############################################################
#+-| ON KEY DO |----------------------------------------------------+#########
#| +-----------+ The ON KEY DO command redirects all keyboard input |#########
#| to go through the specified function. This allows |#########
#| you to control and filter all keyboard I/O |#########
#+------------------------------------------------------------------+#########
##############################################################################
##############################################################################
#+--| Syntax |--------------------+###########################################
#| ON KEY DO [<Function>] |###########################################
#+--------------------------------+###########################################
##############################################################################
##############################################################################
##########+---| Description |--------------------------------------+##########
##########| The function <Function> is invoked every time the |##########
##########| keyboard is pressed. <Function> is responsible for |##########
##########| filtering important keystrokes. |##########
##########| ------------------------------------------------------ |##########
##########| If <Function> is not specified, then keyboard I/O is |##########
##########| redirected through the runtime library system. |##########
##########| ------------------------------------------------------ |##########
##########| <Function> must be a UINT or INT function. Any key |##########
##########| that is not filtered by <Function> must be returned |##########
##########| to the caller. |##########
##########| ------------------------------------------------------ |##########
##########| <Function> is always called, regardless of the current |##########
##########| keyboard driver installed via key_dos or key_bios. |##########
##########+--------------------------------------------------------+##########
##############################################################################
##############################################################################
#########+--| Example 1 |-------------------------------------------+#########
#########| * Use ON KEY to install a generic "help" system. |#########
#########| |#########
#########| FUNCTION INT do_help |#########
#########| IF lastkey() = &K_F1 |#########
#########| entered = .T. && don't process F1 in help |#########
#########| DO give_help |#########
#########| RETURN 0 |#########
#########| entered = .F. |#########
#########| ENDIF |#########
#########| RETURN lastkey() |#########
#########| ENDPRO |#########
#########| |#########
#########| {...} |#########
#########| ON KEY DO do_help |#########
#########+----------------------------------------------------------+#########
##############################################################################
##############################################################################
#########+--| Example 2 |-------------------------------------------+#########
#########| * If several GETS require the same filter, use |#########
#########| * ON KEY DO versus GET ... FILTER . |#########
#########| |#########
#########| ON KEY DO get_filter |#########
#########| @ x1,y1 GET a |#########
#########| @ x2,y2 GET b |#########
#########| @ x3,y3 GET c |#########
#########| READ |#########
#########| ON KEY DO |#########
#########+----------------------------------------------------------+#########
##############################################################################
See Also:
@...GET
FILTER
key_bios
key_dos
lastkey()
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson