[Top][All Lists]

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

Re: ncurses applications: best practices

From: Sentinel
Subject: Re: ncurses applications: best practices
Date: Thu, 25 Sep 2008 10:56:41 +0530 (IST)
User-agent: Alpine 1.10 (OSX 962 2008-03-14)

The way to do this, IMO, is to quit using WINDOWs for layout and to
use PANELs instead. Create only stdscr, then use panels to manage your
main layout. You can create screen-sized panels and bring each one to
the top as you go to the next page. You could also have a tab bar (or
similar) across the top and catch click events to trigger a certain
panel coming to the top. If you have overlapping windows, DON'T use
the WINDOW class directly - use a PANEL instead. PANELs have
advantages over WINDOWs, mainly in that they handle overlapping
content predictably. Within a given PANEL you would use subwindows to
manage the layout (you cannot have embedded panels, though you can
simulate a similar effect if you use screen-sized panels for pages and
show only the applicable "child" panels when that page comes to the

----- stephan beal

Your advice has been great. Sadly, all the examples one gets use stdscr for writing. I was able to easily link my application files with my main menu thanks to your advice.

Now each file has a class with a run(). I can instantiate it from my menu. There is also a main() which initializes stdscr so i can call the file directly.

However, what is written to stdscr does not get cleaned off. Do confirm this: I should *NEVER* write to stdscr. Currently, my main menu is passing stdscr to the constructor of the called programs. I think this should NOT happen.

You advised a bottom panel for messages etc. Sounds great - I have to make that change.

* Defining colors on the fly *

It seems to me that the init_pair way of defining a color_pair with a running number disallows me from allowing my user to just say something like: "label => "Hello", foreground => Color.blue" in a definition file. Has anyone faced this issue? Any thoughts on this. I think most programs like mutt/alpine etc allow users to define colors in a user-friendly manner.


reply via email to

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