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



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