Hi,
I'm hitting a mental block today.
I wanted to add a SimpleList to a ScrolledWindow,
then auto scroll to the end.
What is the best way to force the scrollbar to the end?
I have a bad hack that works below, but I'm sure I'm
overlooking something. :-)
#!/usr/bin/perl
use warnings;
use strict;
use Gtk2 qw/-init/;
use Gtk2::SimpleList;
my $count = 0;
my $win = Gtk2::Window->new;
$win->signal_connect( 'destroy' => sub{exit} );
$win->set_size_request(300,200);
$win->set_position('center');
my $sw = Gtk2::ScrolledWindow->new (undef, undef);
$sw->set_policy ('automatic', 'automatic');
my $ha1 = $sw->get_vadjustment;
my $list = Gtk2::SimpleList->new('test' => 'int',);
$sw->add($list);
$win->add($sw);
$win->show_all;
Glib::Timeout->add(500, \&update, $list);
Gtk2->main;
sub update{
my $list = shift;
push @{$list->{data}},rand $count++;
# bad hack
$list->scroll_to_point(0,1000);
return 1;
}
__END__
Thanks,
zentara
--
I'm not really a human, but I play one on earth.
http://zentara.net/japh.html
_______________________________________________
gtk-perl-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/gtk-perl-list