The Accidental Rubyist

invalid byte sequence in UTF-8

ruby TabbedPane new features – unlimited tabs

leave a comment »

ruby rbcurse now has a slightly better tabbedpane. Essentially, one can add as many Tabs as one needs.
Traversal will only take focus to visible tab buttons. While on the button form, M-l and M-h will scroll horizontally and being other tabs (buttons) in to view and focus. The test program examples/testtpane.rb can be tried out. While on the button form, press M-x several times. This is bound to a block that opens a new tab with a text object inside.
(for the moment, just press a left or right key to repaint the form). If you’ve got more buttons that can be displayed test out traversal with the TAB key. Now use M-l to bring the off-screen buttons into view.

Backtabbing from a form will bring focus onto the last visible button. Similarly, tabbing off the last field of a form will take focus to the first visible button of the button panel.

To make this possible, I’ve extended the old Form class and made a ScrollForm that contains a Pad instead of an Ncurses::Window. This class extends some methods of form to check for whether a field is visible or not. It also resizes the Pad, if a widget is created that falls outside the width or height. This new class has only been tested with the button panel which has a height of 1, and no rows. So it’s not tested with a form that contains many rows! I need to separate it and start testing it in various situations, so we can have multi-page forms in curses using only one form.

Advertisements

Written by totalrecall

March 4, 2010 at 12:17 pm

Posted in rbcurse

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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: