c++ - Unable to associate an ncurses form with a window -
i trying associate ncurses
form window. here complete code of trial:
#include <form.h> #include <vector> #include <string> int main() { initscr(); cbreak(); noecho(); keypad(stdscr, true); form *myform; std::vector<field *> fields; fields.push_back(new_field(1, 10, 0, 0, 0, 0)); set_field_back(fields[0], a_underline); fields.push_back(nullptr); myform = new_form(fields.data()); window *mypad = newpad(5, 20); set_form_win(myform, mypad); // no effect? post_form(myform); prefresh(mypad, 0, 0, 10, 10, 20, 20); // no effect... getch(); unpost_form(myform); free_form(myform); free_field(fields[0]); endwin(); return 0; }
as comments indicate, calling set_form_win
not seem have effect. form displayed in top left corner regardless of arguments supply prefresh
. similar code worked menus fine, not work form. missing?
as additional detail, form gets magically displayed without call prefresh
or other function refresh
family.
windows , pads similar, not same. set_form_win
function expects window.
the newpad
manual page notes:
it not legal call wrefresh pad argument; routines prefresh or pnoutrefresh should called instead.
the form library use pads — internally, fields — windows (no pads). relevant functions wcursyncup , wsyncup (it relies on wgetch
application actual wrefresh
calls).
Comments
Post a Comment