From: Matthew Harrison <matth@3d-computers.co.uk>
To: "William N. Zanatta" <william@veritel.com.br>
Cc: linux-c-programming@vger.kernel.org
Subject: Re: ncurses help
Date: Thu, 11 Sep 2003 09:06:09 +0100 [thread overview]
Message-ID: <20030911080609.GB29005@3d-computers.co.uk> (raw)
In-Reply-To: <Pine.LNX.4.56.0309101206290.3269@halley.i-veritel.com.br>
[-- Attachment #1: Type: text/plain, Size: 2383 bytes --]
thanks William,
That has solved the problem totally. I know that it seems quite
simple, but I'm finding ncurses quite hard to learn the basics of because
i've never programmed any sort of gui before.
it's taking some hard work.
thanks again, I'm on my way.
On Wed, Sep 10, 2003 at 12:32:11PM -0300, William N. Zanatta wrote:
>
> 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
--
Mat Harrison
Technical Developer
3d Computer Systems Ltd.
matth@3d-computers.co.uk
[-- Attachment #2: Type: application/pgp-signature, Size: 187 bytes --]
next prev parent reply other threads:[~2003-09-11 8:06 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
2003-09-11 8:06 ` Matthew Harrison [this message]
-- 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=20030911080609.GB29005@3d-computers.co.uk \
--to=matth@3d-computers.co.uk \
--cc=linux-c-programming@vger.kernel.org \
--cc=william@veritel.com.br \
/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).