|
|
Another feature available on most terminals is a set of soft labels across the bottom of their screens. A terminal's soft labels are usually matched with a set of hard function keys on the keyboard. There are usually eight of these labels, each of which is usually eight characters wide and one or two lines high.
The ETI library has routines that provide a uniform model of eight soft labels on the screen. If a terminal does not have soft labels, the bottom line of its screen is converted into a soft label area. It is not necessary for the keyboard to have hard function keys to match the soft labels for an ETI program to make use of them.
Let us briefly discuss most of the ETI routines needed to use soft labels: slk_init, slk_set, slk_refresh, and slk_noutrefresh, slk_clear, and slk_restore.
When you use soft labels in an ETI program, you have to call the routine slk_init before initscr. This sets an internal flag for initscr to look at that says to use the soft labels. If initscr discovers that there are fewer than eight soft labels on the screen, that they are smaller than eight characters in size, or that there is no way to program them, then it will remove a line from the bottom of stdscr to use for the soft labels. The size of stdscr and the LINES variable will be reduced by one to reflect this change. A properly written program, one that is written to use the LINES and COLS variables, will continue to run as if the line had never existed on the screen.
slk_init takes a single argument. It determines how the labels are grouped on the screen should a line get removed from stdscr. The choices are between a 3-2-3 arrangement as appears on AT&T® terminals, or a 4-4 arrangement as appears on Hewlett-Packard terminals. The ETI routines adjust the width and placement of the labels to maintain the pattern. The widest label generated is eight characters.
The routine slk_set takes three arguments, the label number (1-8), the string to go on the label (up to eight characters), and the justification within the label (0 = left justified, 1 = centered, and 2 = right justified).
The routine slk_noutrefresh is comparable to wnoutrefresh in that it copies the label information onto the internal screen image, but it does not cause the screen to be updated. Since a slk_refresh commonly follows, slk_noutrefresh is the function that is most commonly used to output the labels.
Just as wrefresh is equivalent to a wnoutrefresh followed by a doupdate, so too the function slk_refresh is equivalent to a slk_noutrefresh followed by a doupdate.
To prevent the soft labels from getting in the way of a shell escape, slk_clear may be called before doing the endwin. This clears the soft labels off the screen and does a doupdate. The function slk_restore may be used to restore them to the screen. See the curses(3ocurses) manual pages for more information about the routines for using soft labels.