[ Previous | Next | Contents | Glossary | Home | Search ]
AIX Version 4.3 General Programming Concepts: Writing and Debugging Programs

Manipulating Soft Labels

Curses provides subroutines for manipulating soft function-key labels. These labels appear at the bottom of the screen and give applications, such as editors, a more user-friendly look. To use soft labels, you must call the slk_init subroutine before calling the initscr or newterm subroutines.

To manage soft labels, curses reduces the size of the default screen (stdscr) by one line. It reserves this line for use by the soft-label functions. This reservation means that the environment variable LINES is also reduced. Many terminals support built-in soft labels. If built-in soft labels are supported, curses uses them. Otherwise, curses simulates the soft-labels with software.

Because many terminals that support soft labels have 8 labels, curses follows the same standard. A label string is restricted to 8 characters. Curses arranges labels in one of two patterns:  3-2-3 (3 left, 2 center, 3 right) or 4-4 (4 left, 4 right).

To specify a string for a particular label, call the slk_set subroutine. This subroutine also instructs curses as to left-justify, right-justify, or center the string on the label. If you wish to obtain a label name before it was justified by the slk_set subroutine, use the slk_label subroutine. The slk_clear and slk_restore subroutines clear and restore soft labels respectively. Normally, to update soft labels, your program should call the slk_noutrefresh subroutine for each label and then use a single call to the slk_refresh subroutine to perform the actual output. To output all the soft labels on the next call to the slk_noutrefresh subroutine, use the slk_touch subroutine.

Related Information

Curses Overview for Programming

List of Curses Subroutines

[ Previous | Next | Contents | Glossary | Home | Search ]