The Accidental Rubyist

invalid byte sequence in UTF-8

Dividers in rbcurse 1.2.0

leave a comment »

Like a Vim screen, rbcurse has controls that permit creation of multiple panes or windows containing lists, tables, and textareas. These may be resized using keys such as "Ctrl-W + – =" etc. However, there are complex cases where its not possible for the widget to know what all to resize and in what direction. The attached image shows the mbox email client demo with 2 Dividers between the panes of a MasterDetail object. Now these dividers could have been made focusable, but that becomes a pain for the user since they will take focus every time user tabs through.

Pressing F3 (can be configured), makes all such widgets focusable (toggle) such that arrow keys can be used for resizing adjacent widgets. However, pressing arrow keys on these widgets fires an event so the user can do custom resizing. Objects such as VimSplit also fire events for maximizing the current component in one keystroke, which can be bound by the app so custom resizing can be done.

In this version of the demo, i’ve moved to a TabularWidget, and allow the user to press Enter on the header row, so that column sorting can be done. I’ve done some crude sorting, whereas in reality the real data will be sorted from source.

Divider and Master Detail

In the image, when focus falls on the Divider (horizontal one on right middle), it becomes yellow, and displays up and down arrow keys. Similarly, when focus falls on the vertical one, it will light up and show left and right arrow keys. Pressing F3 will toggle focusability to make traversal easy.


Written by totalrecall

October 10, 2010 at 7:56 pm

Posted in ruby

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 )

Google+ photo

You are commenting using your Google+ 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 )


Connecting to %s

%d bloggers like this: