Move A Window- ncurses
<p>I am making this simple program where I make a window and it using the arrow keys but cannot seem to find a solution. I am using the function mvwin() to move this window. All the inputs seem to reaching the window but there is no movement. All help would be appreciated.</p>

<p>Here is the code snippet:</p>

<pre><code>#include&lt;ncurses.h&gt;

WINDOW *create_newwin(int height, int width, int starty, int startx)
{
      WINDOW *local_win = newwin(height, width, starty, startx);
      box(local_win, 0, 0);
      wprintw(local_win, "CAN YOU SEE ME MOVE");
      wrefresh(local_win);
      return (local_win);
}

int main()
{
       char ch;
       int x= 5, y= 10, h=5, wid= 20;
       initscr();
       noecho();
       //curs_set(FALSE);
       keypad(stdscr, TRUE);
       cbreak();
       refresh();

       printw("PRINT q to EXIT\n");
       WINDOW* wn= create_newwin(h, wid, x, y);                      //tried it directly with newwin() but nothing
       //box(wn,0,0);
       //wrefresh(wn);
       //keypad(wn, TRUE);
       //mvwin(wn, LINES/2, COLS/2);
       wrefresh(wn);

       while((ch=getch())!= 'q')                                      //function to move a window
       {
             switch(ch) 
             {
                    case KEY_LEFT: if(x&gt;0)  --x;
                                    break;
                    case KEY_RIGHT: if(x&lt;(COLS-16)) ++x;
                                    break;
                    case KEY_UP: if(y&gt;0)    --y;
                                    break;
                    case KEY_DOWN: if(y&lt;(LINES-6))  ++y;
                                    break;
            }
            //wprintw(wn,"%c",ch);                                  //to check for input
            mvwin(wn, y, x);
            wrefresh(wn);
    //      wclear(wn);
    }
    //wgetch(wn);
    delwin(wn);                                                     //clean up window
    endwin();
    return 0;
 }
</code></pre>