Next: , Previous: , Up: Curses Reference   [Contents][Index]


5.3 The Function Key Label Library: (ncurses slk)

The slk functions in the (ncurses slk) library manipulate the set of soft function-key labels that exist on many terminals. For those terminals that do not have soft labels, curses takes over the bottom line of stdscr, reducing the size of stdscr (and thus the return value of the procedure lines). curses standardizes on eight labels of up to eight characters each. In addition to this, the ncurses implementation supports a mode where it simulates 12 labels of up to five characters each. This is most common for today’s PC like end-user devices. Please note that ncurses simulates this mode by taking over up to two lines at the bottom of the screen, it doesn’t try to use any hardware support for this mode.

This API is definitely in flux.

Procedure: slk-init fmt

The slk-init routine must be called before initscr or newterm is called. If initscr eventually uses a line from stdscr to emulate the soft labels, then fmt determines how the labels are arranged on the screen. Setting fmt to 0 indicates a 3-2-3 arrangement of the labels, 1 indicates a 4-4 arrangement and 2 indicates the PC-like 4-4-4 mode. If fmt is set to 3, it is again the PC like 4-4-4 mode, but in addition an index line is generated, helping the user to identify the key numbers easily.

It returns #t if fmt is a valid value, or #f otherwise.

Procedure: slk-set labnum label fmt

The slk-set routine requires labnum to be a label number, from 1 to 8 (resp. 12); label must be the string to be put on the label, up to eight (resp. five) characters in length. fmt is either 0, 1, or 2, indicating whether the label is to be left-justified, centered, or right-justified, respectively, within the label.

The procedure returns #f if the terminal or the softkeys were not initialized, or the labnum parameter is outside the range of label counts, or if the format parameter is outside the range 0..2, or if memory for the labels cannot be allocated. Otherwise it return #t

Procedure: slk-refresh
Procedure: slk-noutrefresh

These procedure do a refresh or noutrefresh operation on the slk window.

Procedure: slk-label labnum

The slk-label routine returns the current label for label number labnum, with leading and trailing blanks stripped.

Procedure: slk-clear

This routine clears the soft labels from the screen.

Procedure: slk-restore

This procedure restores the soft labels after an slk-clear has been performed.

Procedure: slk-touch

This routine forces all the soft labels to be output next time slk-noutrefresh is performed.

Procedure: slk-attr-on! attrs
Procedure: slk-attr-off! attrs
Procedure: slk-attr-set! attrs color-pair
Procedure: slk-color! color-pair
Procedure: slk-attr

The slk-attr-on!, slk-attr-set!, and slk-attr-off! routines correspond to attr-on!, attr-set!, attr-off!. They have an effect only if soft labels are simulated on the bottom line of the screen. The default highlight for soft keys is A_STANDOUT.

The slk-color! routine corresponds to color-set!. It has an effect only if soft labels are simulated on the bottom line of the screen.

The procedure slk-attr returns the attributes and color pair currently set for the soft keys. They are returned as a list of two elements. The first element is a bitmap of attributes; the second element is a color pair number.


Next: , Previous: , Up: Curses Reference   [Contents][Index]