next up previous contents index
Next: Miscellaneous CCATSL routines Up: Getting input from the Previous: Entering and Editing arrays   Contents   Index


The Escape key

Another type of input which is occasionally useful to detect is the hitting of the Escape. This is generally interpreted as some form of `quitting'. A good place to check for Escape is inside a long loop, such as an iteration which may take a long time to converge. The user may decide that the iteration is not going to give a useful result and would like to restart it with different parameters. Good style would be to use StatusCL to tell the user that something is running and MessageCL to tell the user how to stop it. You can then test to see if Escape has been hit at some point in the loop:

  
StatusCL("Running...");
MessageCL("Hit Escape to quit")
do {
..
} while (fabs(err)>eps || EscapeCL());
Another useful routine is PauseCL, which simply waits until a key is pressed.

  
PauseCL();   /* Wait until a key is pressed */


EscapeCL

This function returns true if the user has hit the Escape key since the last time EscapeCL was called.

  
StatusCL("Running...");
MessageCL("Hit  to quit")
do {
..
} while (fabs(err)>eps || EscapeCL());


PauseCL

This routine displays a message to the user and waits for a key to be pressed.

  
PauseCL();   /* Wait until a key is pressed */


next up previous contents index
Next: Miscellaneous CCATSL routines Up: Getting input from the Previous: Entering and Editing arrays   Contents   Index
CATAM admin 2010-02-23