The Accidental Rubyist

invalid byte sequence in UTF-8

Multiple object containers in ruby rbcurse

leave a comment »

I’ve introduced a simple container called MultiContainer. One can add multiple components to it, and it displays on component at a time. One can then cycle through components, add and delete components etc.
These components could be different widgets such as textareas, tables, lists etc.

An example of where one might use this is again a kind of SQL client in which there are several resultsets. One can create a TabbedPane with tabs for each resultset, or a MultiContainer with textviews. Currently, since the components can be editable, I’ve mapped M-: to the menu which gives options for iterating, listing, deleting components. M-: is a little cumbersome, so I might change it later.

I find MultiContainer and MultiTextView to be simple containers unlike TabbedPane which is quite involved. So its light, simple to setup and easy to maintain. These 2 containers allow us to save a lot of screen space.
For a demo of this, please see examples/testmulticomp.rb


Written by totalrecall

March 15, 2010 at 9:51 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 )

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: