* ncurses problem
@ 2005-02-10 10:24 Earl R. Lapus
2005-02-10 14:28 ` Rechberger Markus
0 siblings, 1 reply; 2+ messages in thread
From: Earl R. Lapus @ 2005-02-10 10:24 UTC (permalink / raw)
To: linux-c-programming
[-- Attachment #1: Type: text/plain, Size: 453 bytes --]
hi there,
i have a problem using ncurses. i attached the source code with this email.
this program displays two text fields. my problem occurs when i add this,
`char buff[256];` after the declaration, `int ch;`.
after adding the character array declaration, the text fields won't
display anymore.
any ideas?
-earl-.
--
==========================================
There are seven words in this sentence.
==========================================
[-- Attachment #2: nform.c --]
[-- Type: text/x-csrc, Size: 1199 bytes --]
#include <form.h>
int main(void)
{
int ch;
FORM *formp;
FIELD *fields[2];
initscr();
cbreak();
noecho();
keypad(stdscr, TRUE);
fields[0] = new_field(1, 32, 4, 18, 0, 0);
fields[1] = new_field(4, 32, 6, 18, 0, 0);
set_field_back(fields[0], A_STANDOUT);
field_opts_off(fields[0], O_AUTOSKIP);
set_field_back(fields[1], A_STANDOUT);
field_opts_off(fields[1], O_AUTOSKIP);
formp = new_form(fields);
post_form(formp);
refresh();
mvprintw(4, 5, "IP Address:");
mvprintw(6, 5, "Message:");
move(4, 18);
refresh();
while( (ch = getch()) != KEY_F(1) )
{
switch(ch)
{
case KEY_DOWN:
form_driver(formp, REQ_NEXT_FIELD);
form_driver(formp, REQ_END_LINE);
break;
case KEY_UP:
form_driver(formp, REQ_PREV_FIELD);
form_driver(formp, REQ_END_LINE);
break;
default:
form_driver(formp, ch);
break;
}
}
unpost_form(formp);
free_form(formp);
free_field(fields[0]);
free_field(fields[1]);
endwin();
return 0;
}
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: ncurses problem
2005-02-10 10:24 ncurses problem Earl R. Lapus
@ 2005-02-10 14:28 ` Rechberger Markus
0 siblings, 0 replies; 2+ messages in thread
From: Rechberger Markus @ 2005-02-10 14:28 UTC (permalink / raw)
To: linux-c-programming
Hey Earl!
try
FIELD *fields[3];
and
fields[2] = NULL;
I wondered how should new_form know when the array ends..
regards,
Markus
On Thu, 10 Feb 2005 18:24:29 +0800, Earl R. Lapus <elapus@ntsp.nec.co.jp> wrote:
> hi there,
>
> i have a problem using ncurses. i attached the source code with this email.
> this program displays two text fields. my problem occurs when i add this,
> `char buff[256];` after the declaration, `int ch;`.
> after adding the character array declaration, the text fields won't
> display anymore.
> any ideas?
>
> -earl-.
>
> --
> ==========================================
> There are seven words in this sentence.
> ==========================================
>
>
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2005-02-10 14:28 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-02-10 10:24 ncurses problem Earl R. Lapus
2005-02-10 14:28 ` Rechberger Markus
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).