ID: Q89574
The information in this article applies to:
The ON() function returns the command that is assigned to handle the specified class of events. The ON ERROR, ON ESCAPE, ON KEY LABEL, ON PAGE, and ON READERROR commands specify the command that handles the corresponding class of events. The ON() function is new in FoxPro version 2.0 for MS-DOS.
The syntax for the ON() function is as follows
ON(<expC1> [, <expC2>])
where <expC1> specifies one of the event classes. Valid values for
<expC1> include the following:
Command <expC1>
------- -------
ON ERROR ERROR
ON ESCAPE ESCAPE
ON KEY KEY
ON KEY LABEL KEY
ON PAGE PAGE
ON READERROR READERROR
If the ON() function is used to determine which command is assigned to
a key through an ON KEY or ON KEY LABEL command, specify the desired
key in the <expC2> parameter.
The following are examples of using the ON() function:
X=ON("error") Returns the command assigned in an ON ERROR
statement.
?ON("KEY","F4") Returns the command assigned to the F4 key
in an ON KEY LABEL statement.
IF ON("PAGE")="DO MyUdf" Compares the command assigned to ON PAGE to
the character string "DO MyUdf" and returns
.T. or .F.
NOTE: The ON() function is documented in the FoxPro version 2.0
"Commands & Functions" manual after the ON SELECTION command.
Additional reference words: FoxDos FoxWin 2.00 READ ERROR PUSH POP 2.50 2.50a KBCategory: kbprg KBSubcategory: FxprgGeneral
Last Reviewed: June 27, 1995