[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
##############################################################################
###+-----------+##############################################################
#+-| GET_KEY() |--------------------------+###################################
#| +-----------+ Waits for keyboard input |###################################
#+----------------------------------------+###################################
##############################################################################
##############################################################################
#+--| Summary |------------+##################################################
#| #INCLUDE io.hdr |##################################################
#+-------------------------+##################################################
##############################################################################
##############################################################################
#+--| Syntax |-----------------------------+##################################
#| FUNCTION UINT get_key PROTOTYPE |##################################
#+-----------------------------------------+##################################
##############################################################################
##############################################################################
#########+---| Description |---------------------------------------+##########
#########| The get_key() routine waits for keyboard input. When a |##########
#########| key is pressed, the key value is returned. The key is |##########
#########| removed from the internal key buffer. |##########
#########+---------------------------------------------------------+##########
##############################################################################
##############################################################################
#########+--| Example 1 |-------------------------------------------+#########
#########| * Print ASCII value of keys until 'z' is pressed. |#########
#########| * The returned key values are contained in keys.hdr. |#########
#########| |#########
#########| #INCLUDE io.hdr |#########
#########| |#########
#########| VARDEF |#########
#########| UINT key |#########
#########| ENDDEF |#########
#########| |#########
#########| PROCEDURE force_main |#########
#########| REPEAT |#########
#########| key = get_key() |#########
#########| ? key |#########
#########| UNTIL key = 'z' |#########
#########| ENDPRO |#########
#########+----------------------------------------------------------+#########
##############################################################################
##############################################################################
#########+--| Example 2 |-------------------------------------------+#########
#########| * A "clear typeahead" procedure. The line |#########
#########| * " get_key() " generates a compiler WARNING |#########
#########| * indicating that we are using a function as |#########
#########| * a procedure (i.e., we're ignoring the |#########
#########| * results of the function). WARNINGs are okay. |#########
#########| * They just tell you of a condition which MIGHT |#########
#########| * be an error. |#########
#########| |#########
#########| PROCEDURE clear_it |#########
#########| DO WHILE is_key() <> 0 |#########
#########| get_key() |#########
#########| ENDDO |#########
#########| ENDPRO |#########
#########+----------------------------------------------------------+#########
##############################################################################
See Also:
delay()
inkey()
is_key()
lastkey()
no_burn_key()
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson