pdcurses wmove not positioning cursor in window but rather in the stdscr

60 views Asked by At

I have a C program written on MINGW. It creates 2 windows and then associates them with 2 panels as follows.

   ptr_wpaint      = newwin(paint_row_max, paint_col_max, 5, 5);
   ptr_wform       = newwin(form_row, form_col, 10, 10);

   clearok(ptr_wpaint, FALSE);
   immedok(ptr_wpaint, FALSE);
   leaveok(ptr_wpaint, FALSE );

   clearok(ptr_wform, FALSE);
   immedok(ptr_wform, FALSE);
   leaveok(ptr_wform, FALSE );

   curs_set(1);

   mvwprintw(ptr_wpaint,1,1, "Paint window at 1,1 ");
   mvwprintw(ptr_wform ,1,1, "Form  window at 1,1 ");

   wmove(ptr_wpaint, 1, 1);
   wmove(ptr_wform , 1, 1);

   wnoutrefresh(ptr_wpaint);
   wnoutrefresh(ptr_wform);
   update_panels();
   doupdate();


however the cursor remains at position 0,0 in the stdscr which is outside of the current window.

how do I position the cursor in each window ?

I can post the complete code if that would be helpful. I assume that it would be best to put the code on my google drive and then post a link to it.

if there is better way to share the code, please let me know.

1

There are 1 answers

0
Chuck H. On

The issue was that I needed to add the following statement

   leaveok(stdscr, TRUE  );

before creating the other windows. After that it appears to be working.