curses library - controlling cursor position with consecutive input requests

M

Mario Figueiredo

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
 
J

Jack Klein

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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,050
Latest member
AngelS122

Latest Threads

Top