in reply to misplaced scroll bar with Tk::Table

You need to create the cells using $table rather than $mw:

my $cell = $table->Entry (-width => 1);

Perl is Huffman encoded by design.

Replies are listed 'Best First'.
Re^2: misplaced scroll bar with Tk::Table
by pg (Canon) on Aug 12, 2005 at 07:19 UTC

    Still there is a problem. The scrollbar is now at the top right corner, however it is a tiny one. The expectation is for the scrollbar to go across the entire width of the table.

    On the other hand, even with my original code, it is still a bug in Tk::Table. If what I did was wrong, Tk::Table should throw error or warning, not to accept it quietly and screw things up.

      What do you actually want to achieve? The sample code below may give a better feel for what is going on. Note that the columns are not fixed and that the width of the entries is enough that not all the columns are visible.

      The key point is that the scroll bars only scroll non-fixed columns.

      use Tk; use Tk::Table; use strict; use warnings; my $mw = MainWindow->new; $mw->geometry("200x200"); my $table = $mw->Table (-rows => 9, -columns => 9, -fixedrows => 9)->pack; foreach my $row (0 .. 8) { foreach my $col (0 .. 8) { my $cell = $table->Entry (-width => 4, -text => "$col, $row"); $table->put ($row, $col, $cell); } } MainLoop;

      Perl is Huffman encoded by design.
        "What do you actually want to achieve?"

        I want to demo a bug ;-) I think you misunderstood my point. Whether there was a better way is not important here. The point is that Tk::Table should not display that scrollbar in that strange way regardless.

        But thanks for your kindness and the sample code!