The Accidental Rubyist

invalid byte sequence in UTF-8

Scrolling Form in ruby ncurses

leave a comment »

I’ve just added a Scrolling Form (class ScrollForm). This allows us to create a form that takes a lot more space than the physical screen. A multi-page data entry screen can be implemented using one ScrollForm. The user can just scroll down or right to get to other fields.

It extends Form with a couple of changes:

* Using a Pad to write on instead of Window
* Extending focusable() to include visible?(), so only visible components get focus
* Scroll Keys (M-l, h, n, p) are used to pan the screen vertically or horizontally

This component is in its infancy, need to take care of multi-line components. The demo is am working on is in examples/testscroller.rb

I think this is the last of the new components or widgets I have in mind. Now just to test out and make some more demos. And keep releasing patches or minor optimizations.
The next component will likely be the Tree Component, but that will be in another round of development perhaps 3-4 months down, not earlier.

# Instead of defining a local variable with some initial content (often just an empty hash or array), you can instead define it “on the go” so you can perform operations on it at the same time:

(z ||= []) << 'test'


Written by totalrecall

March 16, 2010 at 5:59 pm

Posted in rbcurse

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: