[Top][All Lists]

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

ncurses applications: best practices

From: Sentinel
Subject: ncurses applications: best practices
Date: Tue, 23 Sep 2008 10:19:29 +0530 (IST)
User-agent: Alpine 1.10 (OSX 962 2008-03-14)

Just one more for today. (Apologies for using the bugs forum for this question).

I wish to know if there are some "best practices" for writing ncurses apps. The applications need to be configurable by users, say like pine/alpine.

Some example questions are:

1. Do you implement help messages, error messages etc as fields or do you just mvwaddstr them? In the latter case, often the previous value can be seen. I first implemented a help line as a field. That was great, it was part of the form. Later i removed it, since whenever I looped through "fields" i would have to ignore the help field.

But now I am wondering whether all labels, message fields etc should be form fields for better manageability.

2. Multi-line field handing. I am slowly learning things here -- it wuld really help if there is some place where someone has documented this.

e.g. I have already mentioned the point of newlines in another mail.

How do you implement navigation. I was unhappy using KEY_UP and DOWN for navigation across fields, and using something else for lines. So i use the same for lines as well, checking for an error. I first try to move to prev/next line, if that fails then i move to next/prev field.

3. Saving. Unless I tab out of a field, the value is not stored. On pressing the save key, i tried getting the formdriver to move to next field but that did not result in the field value being set.

4. the "field" object does not take a label or id of any kind. Do you maintain another array of fieldnames to map a fieldname to a field object?

If there is some other forum appropriate for my questions, pls let me know. I am really enjoying ncurses, thanks a lot for your efforts in maintaining the package.

ruby 1.8.7  | os x 10.5.4 |  vim 7

reply via email to

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