Release 10.1A: OpenEdge Development:
Programming Interfaces

> ## Handling terminal I/O

> Character-mode systems support two basic modes of terminal I/O:

> - Raw — Terminal I/O without any operating system processing. Set your terminal to raw mode using the [-]raw option of the `stty` command.

> - Cooked — Terminal I/O that the operating system processes. Set your terminal to cooked mode using either the [-]raw or [-]cooked option of the `stty` command.

> In raw mode, the system reads input characters immediately and passes them to an application without any interpretation, and without sending them to the display as they are entered. Also, the system does no preprocessing or postprocessing of output characters.

> In cooked mode, the system interprets input characters according to the following terminal input functions that the UNIX system defines: ERASE, KILL, INTR, QUIT, SWITCH, and EOT. Also, UNIX systems provide terminal-specific postprocessing, such as defining special characters and character mapping, echoing input to the display, etc.

> ##### Using the proscopn(), prosccls(), and promsgd() functions

> In character mode, OpenEdge typically uses raw terminal I/O, but supplies HLC library functions for switching between raw and cooked mode. Ideally, leave the terminal set to raw mode and use the `promsgd()` function to display information to the user. This provides a uniform appearance for messages.

> If necessary, you can use cooked mode for handling the screen display in character mode. In this case, use the `proscopn()` function to enable cooked mode. Before returning to OpenEdge, re-enable raw mode with a call to `prosccls()`.

> In character mode, the `promsgd()` function displays up to two messages before displaying a “Press space bar to continue” status message. In raw mode, the user can press SPACEBAR as prompted. In cooked mode, the user must press RETURN after `promsgd()` displays the status message. To use `promsgd()` in cooked mode, use the Progress `PAUSE` statement to change either the status message or the way the user interacts with the display.

> For example, to change the status message to tell the user to press RETURN, place the following `PAUSE` statement anywhere before the first HLC call that invokes `promsgd()`:

>     PAUSE BEFORE-HIDE MESSAGE "Press [RETURN] to continue"
>                         .
>                         .
>                         .
>     CALL HLC-MESSAGE-ROUTINE.

> To cause the display to change two seconds after displaying a message without user input, use the following statement:

>     PAUSE 2 BEFORE-HIDE NO-MESSAGE.
>                         .
>                         .
>                         .
>     CALL HLC-MESSAGE-ROUTINE.

> In this case, you must specify the interval to pause. See the `PAUSE` Statement reference entry in OpenEdge Development: Progress 4GL Reference for more information.

> Run the HLC demo application to see examples that include a number of `promsgd()` calls illustrating these techniques.

> In graphical interfaces, `promsgd()` displays messages in an alert box. Raw and cooked terminal I/O, and the `proscopn()`, `proclear()`, and `prosccls()` functions apply only to OpenEdge running in character interfaces.

Copyright © 2005 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095