curses library - controlling cursor position with consecutive input requests

Discussion in 'C++' started by Mario Figueiredo, Nov 15, 2006.

  1. Hello everyone,

    I'm having trouble controlling the cursor position when I make two
    consecutive calls to the get family of functions. This problem does not
    happen if there is an output in between.

    The following code illustrates the problem in a simplified way:

    #include "curses.h"

    int main() {

    initscr();
    echo();

    mvaddstr(5, 5, "Option: ");
    getch(); // works ok. First call.

    mvaddstr(4, 5, "Option: ");
    getch(); // works ok. Second call after an output.

    // note how this following call gets affected by the previous
    getch().
    // The cursor is not placed at 3,5, as requested
    // It is instead waiting for input one char to the right of the
    previous getch().
    // (or the next line if your input was blank)

    mvgetch(3, 5);

    endwin();

    }

    How can I handle input calls in succession and still keep control of
    the cursor position with curses?

    Thank you in advance,
    Mario Figueiredo
    Mario Figueiredo, Nov 15, 2006
    #1
    1. Advertising

  2. Mario Figueiredo

    Jack Klein Guest

    On 15 Nov 2006 14:18:23 -0800, "Mario Figueiredo" <>
    wrote in comp.lang.c++:

    > Hello everyone,
    >
    > I'm having trouble controlling the cursor position when I make two
    > consecutive calls to the get family of functions. This problem does not
    > happen if there is an output in between.


    [snip]

    You'll need to ask this question in a group that supports your
    particular compiler, operating system, and curses library
    implementation. Curses is a non-standard extension, not part of the
    C++ language.

    --
    Jack Klein
    Home: http://JK-Technology.Com
    FAQs for
    comp.lang.c http://c-faq.com/
    comp.lang.c++ http://www.parashift.com/c -faq-lite/
    alt.comp.lang.learn.c-c++
    http://www.contrib.andrew.cmu.edu/~ajo/docs/FAQ-acllc.html
    Jack Klein, Nov 16, 2006
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jean-Paul Calderone
    Replies:
    2
    Views:
    422
    Joel Hedlund
    Feb 9, 2006
  2. JeffS
    Replies:
    25
    Views:
    1,521
    Dave Thompson
    Dec 27, 2004
  3. dmaziuk
    Replies:
    3
    Views:
    552
    Chris Gonnerman
    Jan 25, 2011
  4. Robloche
    Replies:
    4
    Views:
    121
    Robloche
    Jan 30, 2005
  5. Replies:
    1
    Views:
    198
Loading...

Share This Page