Linux.com

Author Message
Joined: Jun 30, 2008
Posts: 148
Other Topics
Posted Oct 12, 2008 at 12:15:25 AM
Subject: Ncurses forms
Anyone on this forum do any ncurses programming in c or c++? I'm trying to learn how to use Ncurses forms, and more specifically how one is supposed to get around a certain aspect of how they work. I tried asking about this in a mainstream c/c++ forum, but apparently ncurses programming is not as popular as it used to be. I figured out how to create a single-field form, where the field has multiple lines, using online ncurses tutorials. Then I found out (from the ncurses man pages) how to pull the data from a specific field's buffer. (I use the field_buffer function to get a char pointer, and then read for the length of the field...) However, it would seem that in a multi-line field, the data on a line is not recorded to the field buffer unless the entire line is filled up. (?) Or, at least, this is what seems to be the case, following many tests. So if the input takes up a line and a half, I only get the first line. If the input only takes up half a line, I get nothing. Is there something I'm supposed to do to a field before trying to pull the data from its buffer, so that all the data is there?

PerlCoder (http://indicium.us)

Back to top Profile Email Website
Shashank Sharma
Joined Jan 01, 1970
Posts: 1657
Location:New Delhi, India

Other Topics
Posted: Oct 19, 2008 4:18:37 PM
Subject: Ncurses forms
There's an O_STATIC field. A multi line field with O_STATIC turned off (dynamically growable field) will contain a fixed number of columns, but the number of rows can increase if the user enters more data than the initial field will hold. The number of rows displayed will remain fixed and the additional data will scroll vertically. Read section 18.3.8 http://tldp.org/HOWTO/NCURSES-Programming-HOWTO/forms.html#PLAYFIELDS Is this what you're looking for?

Coauthor of Beginning Fedora: From Novice to Professional published by Apress.

Please follow the Forum Guidelines

Back to top Profile Email Website Yahoo!
Tableless layout Validate XHTML 1.0 Strict Validate CSS Powered by Xaraya