forrest has asked for the wisdom of the Perl Monks concerning the following question:
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?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Invoking scrolling externally on a Perl/Tk Scrolled widget
by pg (Canon) on Nov 30, 2003 at 03:17 UTC | |
by forrest (Beadle) on Nov 30, 2003 at 17:10 UTC | |
by Elijah (Hermit) on Dec 02, 2003 at 04:53 UTC | |
by forrest (Beadle) on Dec 02, 2003 at 06:24 UTC | |
by Elijah (Hermit) on Dec 02, 2003 at 20:06 UTC |