RE: Restoring a List View's position



Is there a reason not to actually just have different tree view widgets created? You could pack them all into 
a vbox - and then call show/hide on the appropriate widgets when changing views. This is how I approach this 
type of problem. The displaying and hiding of the widgets is seamless on my system.

-----Original Message-----
From: gtk-perl-list-bounces gnome org [mailto:gtk-perl-list-
bounces gnome org] On Behalf Of Matthew Braid
Sent: Monday, March 16, 2009 2:59 AM
To: gtk-perl-list gnome org List
Subject: Restoring a List View's position

Hi all,

Been scratching my head over this too long, so I thought I'd ask the list.

I have a TreeView that is shared amongst several virtual views. If the
user changes from one virtual view to another the tree view is cleared
and shows the contents of the new virtual view. So far so good.

However, I want the tree view to act as much as possible like there
are really multiple tree views. To do this I need to store the
selection paths, sort column id etc etc and restore them again. This
has gone swimmingly except for storing and restoring the tree view's
current display position.

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.

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.

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'.

What is it that I'm missing?

Thanks in advance,
MB
_______________________________________________
gtk-perl-list mailing list
gtk-perl-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list

No virus found in this incoming message.
Checked by AVG - www.avg.com
Version: 8.0.237 / Virus Database: 270.11.13/1999 - Release Date: 03/15/09
14:07:00



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]