help-ncurses
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Help-ncurses digest, Vol 1 #27 - 1 msg


From: Andrzej Roszkowski
Subject: Re: Help-ncurses digest, Vol 1 #27 - 1 msg
Date: Thu, 4 Oct 2001 08:04:30 +0200 (CEST)

On Wed, 3 Oct 2001 address@hidden wrote:

HI!

>
> (Please forgive mi english)
>
> I am porting a program builded for DOS to Linux.
>
> I am using Ncurses 5 weeks ago.
>
> Now I have a big trouble writing a module:
>
> An order checker:
>
> You can se in window these columns
>
> PRODUCT CODE   -  HOW MANY - PRODUCT  DETAILS - VALUE
>
>
> The user input a code, then the program update product
> details and value.
>
> But I am writing it as follow:
>
>
> int sale(void)
> {
> ..
>
> ....
> WINDOW *pad;
>
> pad = newpad(cols, rows, begin_y, begin_x); /* I think
> */
>
>
> mvprintw(pad, 9, 2," PRODUCT CODE   -  HOW MANY -
> PRODUCT  DETAILS - VALUE");
>
> prefresh(...);
>
> echo();
> mvscanw(pad, 10, 2, "%d", &code);
>
> ... search routine
> ...
>
> mvscanw(pad, 10, 2, "%d", &many);
>
> ...
> }
>
>
> I don´t know why the screen can be updated, the input
> do not appear, the cursor can be moved, etc...
>
> The only way I found to make it work is to apply
> scanw();  instead wscanw();
>
> And When I call a subpad to output an alert the input
> dissapear too.
>
>
> ---żI have to use the window *WIN of main() to can use
> wscanw?
>
> ---żIs better to user a pannel, form library?
>
> Thanks for your reply..


YES, better try to use panel and form library, it is designed to help with such
things.

But if you can, try to verify termcap library and terminal definitions. btw.
which version of ncurses You are using? Try the newest 5.2.

Look, input is produced by user, not code so when You are updating screen, your
window doesn't know anything about it, and repaints this place with background
character, so try something like this:

blah blah print the screen

noecho(); don't display keyboard input to the screen
keypad(); this routine enables all keys handler (CTRL etc)

 or outines that You would like and something like this:

input = getch();
..... input validation routine
yourstring= add here memory manager for adding characters
printw(x,y,"%s",yourstring);
refresh();

this should work ... and ... is able to search on-time while you are typing data
;)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]