halfdelay() buffer disabled, 有时间限制的输入.it waits for 'X' tenths of a second for input and then returns ERR, if no input is available. 'X' is the timeout value passed to the function halfdelay(). This function is useful when you want to ask the user for input, and if he doesn't respond with in certain time, we can do some thing else. One possible example is a timeout at the password prompt.
mvaddch(row,col,ch) 移到指定位置输出字符
waddch() 在指定窗口输出字符
mvwaddch() 在指定窗口移到指定位置输出字符
mvprintw() 移到指定位置输出
wprintw() 在指定窗口输出
mvwprintw() 在指定窗口移到指定位置输出
vwprintw() 与vprintf()类似,可用于可变参数输出This can be used when variable number of arguments are to be printed.
第7章 输入
getch() 读入一个字符
scanw() 与scanf()类似,可从屏幕任意位置读入
mvscanw()
wscanw(), mvwscanw()
vwscanw() 与vscanf()类似,This can be used when a variable number of arguments are to be scanned.
getstr(str) 读入字符串,字符串存在str中
wgetstr()
attron(),attroff() 属性设置on/off
A_NORMAL Normal display (no highlight)
A_STANDOUT Best highlighting mode of the terminal.
A_UNDERLINE Underlining
A_REVERSE Reverse video
A_BLINK Blinking
A_DIM Half bright
A_BOLD Extra bright or bold
A_PROTECT Protected mode
A_INVIS Invisible or blank mode
A_ALTCHARSET Alternate character set
A_CHARTEXT Bit-mask to extract a character
COLOR_PAIR(n) Color-pair number n
ch = getch();
if(ch == KEY_MOUSE)
if(getmouse(&event) == OK)
. /* Do some thing with the event */
.
.
getmouse()把事件保存到传入的指针所指内存.指针所指类型的结构为:
typedef struct
{
short id; /* ID to distinguish multiple devices */
int x, y, z; /* event coordinates */
mmask_t bstate; /* button state bits */
}
其中bstate标示了鼠标状态.
监测鼠标事件如下:
if(event.bstate & BUTTON1_PRESSED)
printw("Left Button Pressed");
mouse_trafo() wmouse_trafo() 用来把鼠标坐标转换为屏幕相对坐标.查看curs_mouse(3X)的man文档.
mouseinterval函数 sets the maximum time (in thousands of a second) that can elapse between press and release events in order for them to be recognized as a click. This function returns the previous interval value. The default is one fifth of a second.
第13章 屏幕操纵
getyx(win, y, x) 取得window的光标当前所在
getparyx() 取得子窗口的相对主窗口的开始坐标.When designing fancy stuff like writing multiple menus, it becomes difficult to store the menu positions, their first option co-ordinates etc. A simple solution to this problem, is to create menus in sub windows and later find the starting co-ordinates of the menus by using getparyx().
getbegyx() getmaxyx() 保存当前窗口的开始和最大坐标.These functions are useful in the same way as above in managing the windows and sub windows effectively.