c++consolencursespdcurses

PDCurses getmaxxy function always returns the same values


Environment:

Problem

PDCurses provides a function getmaxxy to get the maximum x and y coordinates of the screen. This returns correct values on startup, but if I resize the window with the mouse and then call getmaxxy again, I get back the same values.

Is this a bug/limitation in pdcurses? Is there a windows specific way to get this information instead?

I have also tried this windows specific solution and it too, always returns the startup values: Getting terminal size in c for windows?


Solution

  • Reading the source,

    If you have resized the screen, then you should tell PDCurses about the new size, using resize_term (a function adapted from ncurses), e.g.,

    resize_term(new_lines, new_cols);
    

    and that recreates the standard windows such as stdscr.

    For what it's worth, PDCurses provides these functions for compatibility with ncurses: