[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: Tue, 23 Sep 2008 20:44:27 +0530 (IST)
User-agent: Alpine 1.10 (OSX 962 2008-03-14)

On Tue, 23 Sep 2008, Craig Forbes wrote:

--On Tuesday, September 23, 2008 10:19:29 AM +0530 Sentinel <address@hidden> wrote:
But now I am wondering whether all labels, message fields etc should be
form fields for better manageability.

I use Fields (with the O_EDIT and O_ACTIVE options off) for labels in my forms but for a help messages I split the screen into 2 panels one for the form covering all but the bottom 2 lines and a second panel for messages covering the bottom 2 lines of the screen.

I am thinking of going back to that. Only issue is that while looping through fields I have to keep ignoring some. Since mine is a generic app, (I am generating code based on a user defined DSL,there are plenty of such iterations.)

 > > I can then clear the lower panel independent of the form.

Thats interesting, will look into that. I was wondering how exactly to use panels. I just tried creating 2 forms on my screen, but the second form is just not displaying, although it does block off another field. So its there!
2. >> 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.

I call form_driver(FORM,REQ_VALIDATION) which saves the buffers for the current field and then validates the value before calling my save function.

Actually, i did this too. I called REQ_VAL and moved to the first field, but still the changed data in current field is not stored in field_buffer.

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?

I have used the C++ bindings and subclassed formfields to give them additional attributes but you could also use the field_userptr to store arbitrary data in the field. I just loop through the fields searching for the one with the right attributes.


I just discovered a user_object (I am using the ruby wrapper, btw). That really makes my work MUCH more manageable. I now can move those hashes and arrays into each field.


Have any of you created multi-page apps. Like a menu page which calls various screens etc. (Think pine/alpine). Can someone give me a quick pointer on doing this. Do i do this within the same curses session, or do an endwin for page 1, and then start again for page 2.

Thanks a lot for your inputs.

reply via email to

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