|
ncurses_wrefresh
Refresh window on terminal screen
(PHP 4 >= 4.2.0, PHP 5, PECL ncurses:1.0.0)
Code Examples / Notes » ncurses_wrefreshphp
Keep in mind, you need to do a ncurses_refresh before any window drawing options to display the window correctly. for example ncurses_wclear($window); ncurses_wborder($window, 0, 0, 0, 0, 0, 0, 0, 0); ncurses_wrefresh($window); won't work correctly the first time though the loop (not sure why), but throw on a ncruses_refresh at the top and it displays correctly joeldegan
Here is a functional example of drawing dynamic windows and refreshing them using ncurses_wrefresh. This draws the main window, borders it, creates a small window borders it, creates a lower window and borders it as well. it also shows an example of doing a little backgrounding.. <?php /* the window will look somewhat like this... +--------------------------------------+ |+---+ | || | | |+---+ | | | |+------------------------------------+| || || |+------------------------------------+| +--------------------------------------+ */ $n=0; $a = ncurses_init(); ncurses_border(0,0, 0,0, 0,0, 0,0); $z = ncurses_newwin ( 15, 15, 10, 10); if(ncurses_has_colors()){ ncurses_start_color(); ncurses_init_pair(1,NCURSES_COLOR_RED,NCURSES_COLOR_BLACK); ncurses_init_pair(2,NCURSES_COLOR_BLUE,NCURSES_COLOR_BLACK); ncurses_init_pair(3,NCURSES_COLOR_YELLOW,NCURSES_COLOR_BLACK); ncurses_init_pair(4,NCURSES_COLOR_BLUE,NCURSES_COLOR_BLACK); ncurses_init_pair(5,NCURSES_COLOR_MAGENTA,NCURSES_COLOR_BLACK); ncurses_init_pair(6,NCURSES_COLOR_CYAN,NCURSES_COLOR_BLACK); ncurses_init_pair(7,NCURSES_COLOR_WHITE,NCURSES_COLOR_BLACK); }//fi while(1){ for ($x=1; $x<80; $x++) { for ($y=1; $y<24; $y++) { $n++; ncurses_move($y,$x); ncurses_addch($n+64); ncurses_color_set($n%8); if($n>26)$n=0; }//rof }//rof // border the main window ncurses_border(0,0, 0,0, 0,0, 0,0); ncurses_refresh(); // create a new little window and border it. $z = ncurses_newwin ( 10, 10, 2, 2); ncurses_wborder($z,0,0, 0,0, 0,0, 0,0); // undocumented function, border the window ncurses_wrefresh($z); // show it // get our maximum y and x values $current = getmaxxy(); $lines = $current[1]; $cols = $current[0]; // create a lower window which is dynamically sized... $c = ncurses_newwin (10, $cols-4, $lines-11, 2); ncurses_wborder($c,0,0, 0,0, 0,0, 0,0); // border it ncurses_wrefresh($c); // show it ncurses_getch(); // wait for user to press key ncurses_clear();// clear and then redraw.. }//wend function getmaxxy(){ $rez = `/usr/X11R6/bin/resize`; $rez = explode("\n",$rez); while(list($key,$val)=each($rez)){ $a=explode("=",$val); if(trim($a[0])=="COLUMNS"){ $COLUMNS = $a[1]; } if(trim($a[0])=="LINES"){ $LINES = $a[1]; } }// $retval[0]=$COLUMNS; $retval[1]=$LINES; return $retval; } ?> |
Change Languagencurses_addch ncurses_addchnstr ncurses_addchstr ncurses_addnstr ncurses_addstr ncurses_assume_default_colors ncurses_attroff ncurses_attron ncurses_attrset ncurses_baudrate ncurses_beep ncurses_bkgd ncurses_bkgdset ncurses_border ncurses_bottom_panel ncurses_can_change_color ncurses_cbreak ncurses_clear ncurses_clrtobot ncurses_clrtoeol ncurses_color_content ncurses_color_set ncurses_curs_set ncurses_def_prog_mode ncurses_def_shell_mode ncurses_define_key ncurses_del_panel ncurses_delay_output ncurses_delch ncurses_deleteln ncurses_delwin ncurses_doupdate ncurses_echo ncurses_echochar ncurses_end ncurses_erase ncurses_erasechar ncurses_filter ncurses_flash ncurses_flushinp ncurses_getch ncurses_getmaxyx ncurses_getmouse ncurses_getyx ncurses_halfdelay ncurses_has_colors ncurses_has_ic ncurses_has_il ncurses_has_key ncurses_hide_panel ncurses_hline ncurses_inch ncurses_init_color ncurses_init_pair ncurses_init ncurses_insch ncurses_insdelln ncurses_insertln ncurses_insstr ncurses_instr ncurses_isendwin ncurses_keyok ncurses_keypad ncurses_killchar ncurses_longname ncurses_meta ncurses_mouse_trafo ncurses_mouseinterval ncurses_mousemask ncurses_move_panel ncurses_move ncurses_mvaddch ncurses_mvaddchnstr ncurses_mvaddchstr ncurses_mvaddnstr ncurses_mvaddstr ncurses_mvcur ncurses_mvdelch ncurses_mvgetch ncurses_mvhline ncurses_mvinch ncurses_mvvline ncurses_mvwaddstr ncurses_napms ncurses_new_panel ncurses_newpad ncurses_newwin ncurses_nl ncurses_nocbreak ncurses_noecho ncurses_nonl ncurses_noqiflush ncurses_noraw ncurses_pair_content ncurses_panel_above ncurses_panel_below ncurses_panel_window ncurses_pnoutrefresh ncurses_prefresh ncurses_putp ncurses_qiflush ncurses_raw ncurses_refresh ncurses_replace_panel ncurses_reset_prog_mode ncurses_reset_shell_mode ncurses_resetty ncurses_savetty ncurses_scr_dump ncurses_scr_init ncurses_scr_restore ncurses_scr_set ncurses_scrl ncurses_show_panel ncurses_slk_attr ncurses_slk_attroff ncurses_slk_attron ncurses_slk_attrset ncurses_slk_clear ncurses_slk_color ncurses_slk_init ncurses_slk_noutrefresh ncurses_slk_refresh ncurses_slk_restore ncurses_slk_set ncurses_slk_touch ncurses_standend ncurses_standout ncurses_start_color ncurses_termattrs ncurses_termname ncurses_timeout ncurses_top_panel ncurses_typeahead ncurses_ungetch ncurses_ungetmouse ncurses_update_panels ncurses_use_default_colors ncurses_use_env ncurses_use_extended_names ncurses_vidattr ncurses_vline ncurses_waddch ncurses_waddstr ncurses_wattroff ncurses_wattron ncurses_wattrset ncurses_wborder ncurses_wclear ncurses_wcolor_set ncurses_werase ncurses_wgetch ncurses_whline ncurses_wmouse_trafo ncurses_wmove ncurses_wnoutrefresh ncurses_wrefresh ncurses_wstandend ncurses_wstandout ncurses_wvline |