The Accidental Rubyist

invalid byte sequence in UTF-8

tabular data in listboxes and textviews

leave a comment »

I’ve done a retake on tables or tabular data. The Table class with its MVC architecture and editability is a huge class. I wanted something small and simple. A tiny code base for just printing tables, no editing. No moving, hiding etc. Just simple throwing tabular data, letting a user scroll, select a row…

First I integrated the excellent terminal-table. However, I had to make changes to that gem, and that meant installation issues and keeping it up-to-date. So i’ve hacked a simple table display in a small file, which i can use for most table data. Easy to maintain, and easy to debug or modify!

I’ve attached it to a listbox and to a textview. I might give it its own simple widget which is aware of columns without getting into models, renderers etc. The syntax from terminal-table is supported, I’ve used their examples. It does not do colspan, and center alignment. Enjoy. Ruby rocks!

Advertisements

Written by totalrecall

September 25, 2010 at 11:16 pm

Posted in ruby

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: