Martin DeMello wrote:
On Fri, Oct 10, 2008 at 12:05 PM, Nit K. firstname.lastname@example.org
some smallish projects that solve this kind of problem?
Could you paste in some of your switch/case code? It would suggest
what bits of it want to be object oriented. Some nice high level
projects atop C-ish bindings are WxSugar and RubyGame. Also look at
STFL for an existing high level layer atop ncurses, complete with ruby
Another neat but sadly abandoned TUI project is jttuii:
Have been checking a lot of ncurses wrappers. Sadly, many ruby projects
that have not released any files, or seem abandoned. I am currently
installing a newt-ruby binding released in 2002. No activity since. No
writeup, screenshots etc.
e.g Yesterday I wrote a file pager with an OK Cancel button. This is a
tiny example compared to FIELD or FORM. Now I would like to be able to
just add a button in a few lines of code, and not have to cut-paste into
3 places and change names of form or window variables etc.
So when i am creating all the fields, prior to the form being created I
have these lines:
# create the Ok field
label = "OK"
width = label.length+2
field = FIELD.new(1, width, @footer_row, @cols-20, 0, 0)
field.user_object = label
Later, in my getch() loop I have this:
if name == "OK"
return multiline_format(@content, @fieldwidth)
elsif name == "Cancel"
In my field_init_hook, I check for field. When the button gets the
focus, I make it reverse video:
if ix != 0
When you tab out, (in the field_term_hook):
I have vague/distant memories of Swing programming, so I was having
thoughts that each field should have a handler installed in some array
for each event. The field_init and term hook just call that handler with
field and value, and the handler invokes the handler of that field, if
When i create a FIELD, it (should) installs its handlers. This includes
on_enter, on_exit, on_selection and should also wrap the label (in
ncurses printing a fields label is totally unrelated to the field, and
happens after the form and window is created). Now I don’t want to get
overly complex and slow, for then one purpose of using text UI is
So i really want to study a well-designed wrapper and see how the pros
I did look at wxSugar last night. Thanks for sharing your thoughts.