marz12 has asked for the wisdom of the Perl Monks concerning the following question:

Hello, I'm using tk::Tablematrix to display data from a database. it works OK, but sometimes the cells are bigger than the width of the screen. As Tablematrix horizontally scrolls only cell by cell, the data are hard to read. So I'm looking for a workaround to a custom scroll for Tablematrix. One idea could be to insert the Tablematrix into another widget, fully scrollable. I tried something like this:

... my $framebottom = $mw->Frame->pack(-side => 'bottom', -anchor => 'w', +-padx => 5, -pady => 5, -expand => 1, -fill => 'both'); my $tablecontainer = $framebottom->Scrolled('ROText', -relief=>"groove", -wrap=>"word", -cursor=>"arrow", -scrollbars=>'se' ); my $table = $tablecontainer->Scrolled( 'TableMatrix', -rows => 20, -cols => 12, -width => 5, -height => 5, -font => $font, -variable => $data, -background => "#ffffff", -titlerows => 1, -titlecols => 1, -selectmode => 'extended', -flashmode => 'on', -borderwidth => 0, -scrollbars => 'se', -anchor => 'w', -colstretchmode=> 'last', ); ...

but this doesn't display anything. Has someone an idea? Thanks.

Replies are listed 'Best First'.
Re: Tablematrix scroll
by kcott (Archbishop) on Feb 24, 2016 at 02:34 UTC

    G'day marz12,

    Welcome to the Monastery.

    You could put your Tk::TableMatrix widget inside a Tk::Pane widget, then scroll the Tk::Pane instead of the Tk::TableMatrix.

    Another option would be to run the Widget Demo (type widget on the command line) and pick something other than Tk::TableMatrix. The "7. Multicolumn listbox with individual cell styles." example (under Tix Widgets), which uses Tk::HList, appears to scroll cells the way you want.

    — Ken

Re: Tablematrix scroll
by FreeBeerReekingMonk (Deacon) on Feb 23, 2016 at 20:54 UTC
Re: Tablematrix scroll
by beech (Parson) on Feb 24, 2016 at 00:58 UTC
    Did you forget to pack the table?
      Thanks for the ideas. I'm trying and I'll give a feedback.