linux-c-programming.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "William N. Zanatta" <william@veritel.com.br>
To: Matthew Harrison <matth@3d-computers.co.uk>
Cc: linux-c-programming@vger.kernel.org
Subject: Re: ncurses help
Date: Wed, 10 Sep 2003 12:32:11 -0300 (BRT)	[thread overview]
Message-ID: <Pine.LNX.4.56.0309101206290.3269@halley.i-veritel.com.br> (raw)
In-Reply-To: <20030910122511.GC15788@3d-computers.co.uk>


  Try changing getstr() to wgetstr(). When doing window manipulation you
must use the functions with support to WINDOW pointers. If you don't,
you'll get the results you're experiencing, because getstr() comes into
action when it is reached while wgetstr() only comes into action after the
wrefresh().

  Also, it showed some problems with placement of the stuff.

  You have set login_window to (login_win.startx, login_win.starty) from
0,0 of the mainscreen. But, when you write stuff into that new window, you
must set the (x,y) from the login_window. iE, here I had:

  login_win.starty -> 7
  login_win.startx -> 25

  thus, after creating the window, (25,7)-terminal turns to
(0,0)-login_window.

  That's it you're working with absolute values when you should work with
relative.

  After all your code turned to...

<inventory.c>
   was
        attron(COLOR_PAIR(1));
        mvwprintw(login_window, ..., ..., "Username: ");
        mvwprintw(login_window, ..., ..., "Password: ");
        attroff(COLOR_PAIR(1));

   changed to

        wattron(login_window, COLOR_PAIR(1));
        mvwprintw(login_window, 1, 1, "Username: ");
        mvwprintw(login_window, 2, 1, "Password: ");
        wattroff(login_window, COLOR_PAIR(1));

   --------

   was
        echo();
        wmove(login_window, ..., ...);
        getstr(username);
        wmove(login_window, ..., ...);
        getstr(password);
        noecho();

   changed to

        echo();
        wmove(login_window, 1, 11);
        wgetstr(login_window,username);
        wmove(login_window, 2, 11);
        wgetstr(login_window,password);
        noecho();

</inventory.c>

  Hope I've helped... =]

  Just a note, you should use wgetnstr() to limit the length of input
data.

  william

  reply	other threads:[~2003-09-10 15:32 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-09-10 12:25 ncurses help Matthew Harrison
2003-09-10 15:32 ` William N. Zanatta [this message]
2003-09-11  8:06   ` Matthew Harrison
  -- strict thread matches above, loose matches on Subject: below --
2003-09-10 12:23 Matthew Harrison

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.4.56.0309101206290.3269@halley.i-veritel.com.br \
    --to=william@veritel.com.br \
    --cc=linux-c-programming@vger.kernel.org \
    --cc=matth@3d-computers.co.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).