note 46379 added to function.ncurses-wgetch
| From: | gf3 dot bm3 at gmail dot com | Date: | Fri, 08 Oct 2004 23:41:06 +0000 |
| Subject: | note 46379 added to function.ncurses-wgetch | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-78203@lists.php.net to get a copy of this message | ||
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($mWin);
ncurses_wrefresh($fullscreen);
}
----
Manual Page -- http://www.php.net/manual/en/function.ncurses-wgetch.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+46379
Delete -- http://master.php.net/manage/user-notes.php?action=delete+46379&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+46379&report=yes
Search -- http://master.php.net/manage/user-notes.php