Re: Unable To Keep Showing Last Item In Gtk2::TreeView
- From: Marius Feraru <altblue gmail com>
- To: Gtk Perl <gtk-perl-list gnome org>
- Subject: Re: Unable To Keep Showing Last Item In Gtk2::TreeView
- Date: Tue, 10 Apr 2012 06:02:45 +0300
Williams, James P2 <james p2 williams lmco com> wrote:
How can I keep my automatic scrolling, even after these kinds of events?
Iâve tried reacting to various signals, but the tree view seems too stale
for $tree->get_visible_range() or $tree->scroll_to_cell() to work.
You might react to "size-allocate" events, but a slightly different approach
is necessary. Here's a hack around your test code:
#Glib::Timeout->add( 1000, sub { tickCB($tree) } );
my $mustScroll = 0;
Glib::Timeout->add( 1000, sub { addWord( $tree->get_model ); 1 } );
$tree->signal_connect( size_allocate => sub { showLast($tree) if
$mustScroll } );
$tree->get_model->signal_connect(
row_inserted => sub {
my $lastVis = ( $tree->get_visible_range )[1];
$mustScroll = $lastVis
&& $lastVis->get_indices == $tree->get_model->iter_n_children - 2;
}
);
'HTH
-ab
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]