When the button is pressed, The scrollbar jumps to the bottom like I want, but the visible portion of the Listbox stays the same. Playing with the thumb of the scrollbar a little will make the Listbox suddenly jump to the end where I want it.#!/usr/bin/perl -w use strict; use Tk; my $main = MainWindow->new; my $list = $main->Scrolled('Listbox', -scrollbars => 'e', -selectmode => 'single')->pack; foreach my $i (1..100) { $list->insert('end', "item $i"); } my $button = $main->Button(-text => "Scroll to Bottom of List", -command => \&scroll_to_bottom)->pack; MainLoop; sub scroll_to_bottom { my ($first, $last) = $list->Subwidget("yscrollbar")->get; # set to end of list my $winsize = $last - $first; $first = 1.0 - $winsize; $last = 1.0; $list->Subwidget("yscrollbar")->set($first, $last); }
It seems that when the scrollbar's appearance is updated, its callback (which would adjust the position of the widget it's controlling) isn't called.
I'm hoping I won't have to do my own custom scrollbar to get this functionality; the standard Scrolled is really close.
Does anyone know how I can make this work?
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |