Terminal output control subroutines.
Curses Library (libcurses.a)
#include <curses.h>
int clearok(WINDOW *win,
bool bf);
int idlok(WINDOW *win,
bool bf);
int leaveok(WINDOW *win,
bool bf);
int scrollok(WINDOW *win,
bool bf);
int setscrreg(int top,
int bot);
int wsetscrreg(WINDOW *win,
int top,
int bot);
These subroutines set options that deal with output within Curses.
The clearok subroutine assigns the value of bf to an internal flag in the specified window that governs clearing of the screen during a refresh. If, during a refresh operation on the specified window, the flag in curscr is TRUE or the flag in the specified window is TRUE, then the implementation clears the screen, redraws it in its entirety, and sets the flag to FALSE in curscr and in the specified window. The initial state is unspecified.
The idlok subroutine specifies whether the implementation may use the hardware insert-line, delete-line, and scroll features of terminals so equIpped. If bf is TRUE, use of these features is enabled. If bf is FALSE, use of these features is disabled and lines are instead redrawn as required. The initial state is FALSE.
The leaveok subroutine controls the cursor position after a refresh operation. If bf is TRUE, refresh operations on the specified window may leave the terminal's cursor at an arbitrary position. If bf is FALSE, then at the end of any refresh operation, the terminal's cursor is positioned at the cursor position contained in the specified window. The initial state is FALSE.
The scrollok subroutine controls the use of scrolling. If bf is TRUE, then scrolling is enabled for the specified window, with the consequences discussed in Truncation, Wrapping and Scrolling on page 28. If bf is FALSE, scrolling is disabled for the specified window. The initial state is FALSE.
The setscrreg and wsetscrreg subroutines define a software scrolling region in the current or specified window. The top and bot arguments are the line numbers of the first and last line defining the scrolling region. (Line 0 is the top line of the window.) If this option and the scrollok subroutine are enabled, an attempt to move off the last line of the margin causes all lines in the scrolling region to scroll one line in the direction of the first line. Only characters in the window are scrolled. If a software scrolling region is set and the scrollok subroutine is not enabled, an attempt to move off the last line of the margin does not reposition any lines in the scrolling region.
The parameters for the clearok subroutine are:
Item | Description |
---|---|
Flag | Sets the window clear flag. If TRUE, curses clears the window on the next call to the wrefresh or refresh subroutines. If FALSE, curses does not clear the window. |
Window | Specifies the window to clear. |
The parameters for the idlok subroutine are:
Item | Description |
---|---|
Flag | Specifies whether to enable curses to use the hardware insert/delete line feature (TRUE) or not (FALSE). |
Window | Specifies the window it will affect. |
The parameters for the leaveok subroutine are:
Item | Description |
---|---|
Flag | Specifies whether to leave the physical cursor alone after a refresh (TRUE) or to move the physical cursor to the logical cursor after a refresh (FALSE). |
Window | Specifies the window for which to set the Flag parameter. |
The parameters for the scrollok subroutine are:
Item | Description |
---|---|
Flag | Enables scrolling when set to TRUE. Otherwise, set the Flag parameter to FALSE to disable scrolling. |
Window | Identifies the window in which to enable or disable scrolling. |
The parameters for the setscrreg and wsetscrreg subroutines are:
Item | Description |
---|---|
Bmargin | Specifies the last line number in the scrolling region. |
Tmargin | Specifies the first line number in the scrolling region (0 is the top line of the window.). |
Window | Specifies the window in which to place the scrolling region. You specify this parameter only with the wsetscrreg subroutine. |
Upon successful completion, the setscrreg and wsetscrreg subroutines return OK. Otherwise, they return ERR.
The other subroutines always return OK.
Examples for the clearok subroutine are:
WINDOW *my_screen;
clearok(my_screen, TRUE);
clearok(stdscr, TRUE);
Examples for the idlok subroutine are:
idlok(stdscr, TRUE);
idlok(my_window, FALSE);
Examples for the leaveok subroutine are:
WINDOW *my_window;
leaveok(my_window, FALSE);
WINDOW *my_window;
leaveok(my_window, TRUE);
Examples for the scrollok subroutine are:
WINDOW *my_window;
scrollok(my_window, TRUE);
WINDOW *my_window;
scrollok(my_window, FALSE);
Examples for the setscrreg or wsetscrreg subroutine are:
setscrreg(9, 29);
WINDOW *my_window;
wsetscrreg(my_window, 9, 29);