This isn't a question, but a tip for people who run into the same problems i did. I will point out some properties of the corresponding Modules, which weren't clearly documented, or not documented at all.

I needed a tabular Tk widget to display and modify a large amount of datasets. The Standard HList widget doesn't feature resizing and sorting so i had a look on cpan.

First i found the widget MListbox which has a lot of features(resizing,sorting), but for which binding of keyboard shortcuts didn't work.

The Reason for the keyboard shortcuts not working is a simple one, but one has to be aware of it:
Even though one has clicked into the widget, or even selected some entries, the widget doesn't automatically receive the keyboard input focus (most other Tk-widgets do that for you once sbd clicks into it). This has to be done manually:
$mlistbox->bindRows( '<Button>' , sub {$mlistbox->focus();});
Afterwards binding keys worked fine, but unfortunately this widget was to slow for the 10000 records which were inserted into it.

Looking for a faster widget, i found another widget Tk::TableMatrix which is really fast, but which also had one point in which it's behaviour was less than intuitive:
Trying to left justify the text inside each box, i was tempted to use the option -justify => 'left' - which to my surprise - didn't work. After trying several options i finally found out, that left justification of text can be achieved through the use of the option -anchor => 'w'.

My guess is (to lazy to check the source), that -justify only causes justification inside some tk-widget representing a single box, but the widget itself is displayed centered, causing the impression of centered text. But when anchoring that widget to the west, the text will appear left justified even though it might be centered inside the widget ... .

Another hint: Tk::TableMatrix which comes with Active State Perl 5.8.4 seems to be compiled against a wrong Tk-version, so it doesn't work.


In reply to Some Tk::TableMatrix and Tk::MListbox excentricities by rminner

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.