ncurses_wgetch

(PHP 4 >= 4.2.0, PHP 5)

ncurses_wgetch --  Reads a character from keyboard (window)

Description

int ncurses_wgetch ( resource window )

警告

本函数暂无文档,仅有参数列表。


add a note add a note User Contributed Notes
john at bowlingball dot com
23-Feb-2006 12:19
By default ncurses_wgetch does not return keypad keys.  If you need to use function or arrow keys in a sub window, simply do this first.

ncurses_keypad($win, TRUE);
gf3 dot bm3 at gmail dot com
09-Oct-2004 07:41
Heres a function to get a string from a specific window and return it on ENTER.

// Dynamic String Input (converts INT ASCII to CHAR)
function ncurses_wgetstr($win){
   $strlen = 1;
   for ($sx=0;$sx<$strlen;$sx++){
       $strlen++;
       $ch = ncurses_wgetch($win);
       if ($ch == 13){
           return $str;
           break 2;
       }
       $str .= chr($ch);
   }
}

Example:

$ncurse = ncurses_init();
$fullscreen = ncurses_newwin (0,0,  0,0);
ncurses_border(0,0,  0,0,  0,0,  0,0);
ncurses_refresh();

while (1){
   $keyPressed = ncurses_wgetstr($fullscreen);
   ncurses_wrefresh($fullscreen);
}