in reply to Invoking scrolling externally on a Perl/Tk Scrolled widget
It is much simpler than this. The see() method of Listbox allows you to scroll a particular list element into the "view".
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 { $list->see('end');#make the last element viewable }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Invoking scrolling externally on a Perl/Tk Scrolled widget
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 |