Normally, the tty driver buffers typed characters until a
newline or carriage return is typed. The cbreak routine
disables line buffering and erase/kill character-process-
ing (interrupt and flow control characters are unaffect-
ed), making characters typed by the user immediately
available to the program. The nocbreak routine returns
the terminal to normal (cooked) mode.
Initially the terminal may or may not be in cbreak mode,
as the mode is inherited; therefore, a program should call
cbreak or nocbreak explicitly. Most interactive programs
using curses set the cbreak mode. Note that cbreak over-
rides raw. [See curs_getch(3x) for a discussion of how
these routines interact with echo and noecho.]
The echo and noecho routines control whether characters
typed by the user are echoed by getch as they are typed.
Echoing by the tty driver is always disabled, but initial-
ly getch is in echo mode, so characters typed are echoed.
Authors of most interactive programs prefer to do their
own echoing in a controlled area of the screen, or not to
echo at all, so they disable echoing by calling noecho.
[See curs_getch(3x) for a discussion of how these routines
interact with cbreak and nocbreak.]
The halfdelay routine is used for half-delay mode, which
is similar to cbreak mode in that characters typed by the
user are immediately available to the program. However,
after blocking for tenths tenths of seconds, ERR is re-
turned if nothing has been typed. The value of tenths
must be a number between 1 and 255. Use nocbreak to leave
half-delay mode.
If the intrflush option is enabled, (bf is TRUE), when an
interrupt key is pressed on the keyboard (interrupt,
break, quit) all output in the tty driver queue will be
flushed, giving the effect of faster response to the in-
terrupt, but causing curses to have the wrong idea of what
is on the screen. Disabling (bf is FALSE), the option
prevents the flush. The default for the option is inher-
ited from the tty driver settings. The window argument is
ignored.
The keypad option enables the keypad of the user's termi-
nal. If enabled (bf is TRUE), the user can press a func-
tion key (such as an arrow key) and wgetch returns a sin-
gle value representing the function key, as in KEY_LEFT.
If disabled (bf is FALSE), curses does not treat function
keys specially and the program has to interpret the escape
sequences itself. If the keypad in the terminal can be
turned on (made to transmit) and off (made to work local-
ly), turning on this option causes the terminal keypad to
be turned on when wgetch is called. The default value for
keypad is false.
Initially, whether the terminal returns 7 or 8 significant
bits on input depends on the control mode of the tty driv-
er [see termio(7)]. To force 8 bits to be returned, in-
voke meta(win, TRUE); this is equivalent, under POSIX, to
setting the CS8 flag on the terminal. To force 7 bits to
be returned, invoke meta(win, FALSE); this is equivalent,
under POSIX, to setting the CS7 flag on the terminal. The
window argument, win, is always ignored. If the terminfo
capabilities smm (meta_on) and rmm (meta_off) are defined
for the terminal, smm is sent to the terminal when
meta(win, TRUE) is called and rmm is sent when meta(win,
FALSE) is called.
The nodelay option causes getch to be a non-blocking call.
If no input is ready, getch returns ERR. If disabled (bf
is FALSE), getch waits until a key is pressed.
While interpreting an input escape sequence, wgetch sets a
timer while waiting for the next character. If notime-out(win, TRUE) is called, then wgetch does not set a
timer. The purpose of the timeout is to differentiate be-
tween sequences received from a function key and those
typed by a user.
The raw and noraw routines place the terminal into or out
of raw mode. Raw mode is similar to cbreak mode, in that
characters typed are immediately passed through to the us-
er program. The differences are that in raw mode, the in-
terrupt, quit, suspend, and flow control characters are
all passed through uninterpreted, instead of generating a
signal. The behavior of the BREAK key depends on other
bits in the tty driver that are not set by curses.
When the noqiflush routine is used, normal flush of input
and output queues associated with the INTR, QUIT and SUSP
characters will not be done [see termio(7)]. When qiflush
is called, the queues will be flushed when these control
characters are read. You may want to call noqiflush() in
a signal handler if you want output to continue as though
the interrupt had not occurred, after the handler exits.
The timeout and wtimeout routines set blocking or non-
blocking read for a given window.STRONGprior written *
* authorization. *
****************************************************************************
* @Id: mitem_current.3x,v 1.11 2006/11/04 18:18:19 tom Exp @
-->
mitem_current 3x
#include<menu.h>
int set_current_item(MENU *menu, const ITEM *item);
ITEM *current_item(const MENU *menu);
int set_top_row(MENU *menu, int row);
int top_row(const MENU *menu);
int item_index(const ITEM *item);
DESCRIPTION
The function set_current_item sets the current item (the
item on which the menu cursor is positioned). cur-rent_item returns a pointer to the current item in the
given menu.
The function set_top_row sets the top row of the menu to
show the given row (the top row is initially 0, and is
reset to this value whenever the O_ROWMAJOR option is tog-
gled). The item leftmost on the given row becomes cur-
rent. The function top_row returns the number of the top
menu row being displayed.
The function item_index returns the (zero-origin) index of
item in the menu's item pointer list.
RETURN VALUE
current_item returns a pointer (which may be NULL). It
does not set errno.
top_row and item_index return ERR (the general curses
error value) if their menu parameter is NULL.
set_current_item and set_top_row return one of the follow-
ing:
E_OK The routine succeeded.
E_BAD_ARGUMENT
Routine detected an incorrect or out-of-range argu-
ment.
E_BAD_STATE
Routine was called from an initialization or termina-
tion function.
E_NOT_CONNECTED
No items are connected to the menu.
E_SYSTEM_ERROR
System error occurred (see errno).
The header file <menu.h> automatically includes the header
file <curses.h>.
PORTABILITY
These routines emulate the System V menu library. They
were not supported on Version 7 or BSD versions.
The SVr4 menu library documentation specifies the top_row
and index_item error value as -1 (which is the value of
ERR).
AUTHORS
Juergen Pfeifer. Manual pages and adaptation for new
curses by Eric S. Raymond.
mitem_current(3x)
Man(1) output converted with
man2html
./usr/share/doc/libncurses5-dev/html/man/curs_inopts.3x.html