Re: Restoring a List View's position
- From: muppet <scott asofyet org>
- To: Matthew Braid <ptkperl mdb id au>
- Cc: "gtk-perl-list gnome org List" <gtk-perl-list gnome org>
- Subject: Re: Restoring a List View's position
- Date: Mon, 16 Mar 2009 19:57:44 -0400
On Mar 16, 2009, at 2:59 AM, Matthew Braid wrote:
I initially tried using $treeview->get_visible_range and
$treeview->scroll_to_cell, but get_visible_range seems to be a little
flakey on my system and often aborts with a message about some
assertion failing (something != nil I think). So after realising that
eval {} over a failed Gtk assertion just doesn't work (yay), I tried
directly manipulating the scrollbars instead.
Were you asking for the visible range after having removed the model?
On store, I do this:
$store{POS} = $list->get_vadjustment->get_value;
and on restore I:
$list->get_vadjustment->set_value($store{POS});
This doesn't error, but it also doesn't do anything - scrollbar
steadfastly stays where it is.
You may need to wait for the adjustment change to take effect. Try
setting the new scrollbar positions in an idle handler. This may
result in undesirable flicker, in which case, your next idea isn't
terribly inappropriate.
I starting looking into storing the coords of the currently visible
cells and using scroll_to_point, but now I'm dealing with screen
coordinates and that seems a bit low level for what should simply be
'scroll to this entry in the list'.
Well, if you want it to look to the user as though the view is just as
he left it, then simply scrolling a certain row onscreen may not be
sufficient. If i understand correctly, when you scroll to the list
item, it's somewhat random as to where it will be (depends on your
parameters). So, scroll to point isn't that bad of a compromise.
What is it that I'm missing?
You might try asking on gtk-app-devel-list, as this is a general gtk+
question, not restricted to perl.
--
Sallah! I said no camels! That's five camels! Can't you count?
-- Indiana Jones
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]