gtk_tree_view_scroll_to_cell erratic
- From: "Erik Simonsen" <erik pinksheets com>
- To: <gtk-app-devel-list gnome org>
- Subject: gtk_tree_view_scroll_to_cell erratic
- Date: Tue, 17 Sep 2002 12:49:05 -0400
I am using gtk 2.0.1 on redhat 7.3
I am trying to select and scroll to a cell based on the contents of the data
column in the tree store. It seems to work perfectly for the first 20 or so
items on the list (I'm using large fonts so that represents 3-4 pages of
data). However, if I try to jump to higher-numbered rows, I will see the
screen scroll to the correct row and then scroll off again to somewhere
else on the tree--usually somewhere in the middle. If I then manually
scroll down again, I see that the correct row is selected, so I'm def. using
the correct path. Of note is that I repopulate the model right before
calling this program. I believe that scroll_to_cell is supposed to work
even if the tree is unrealized though, so I don't think that's a problem.
Any ideas?
Thanks guys!
//snippet follows
GtkWidget *ftree = lookup_widget(playa, "file_tree");
GtkTreeModel *fstore=gtk_tree_view_get_model(GTK_TREE_VIEW(ftree));
GtkTreeIter iter;
gboolean valid;
valid = gtk_tree_model_get_iter_first (fstore, &iter);
while (valid) {
gpointer finfo;
gtk_tree_model_get (fstore, &iter, FILE_TREE_DATA_COLUMN,
&finfo, -1);
if (finfo) {
if ( strcmp( ((struct file_info *) finfo)->path, path) == 0) {
GtkTreePath *treepath = gtk_tree_model_get_path (fstore,
&iter);
gtk_tree_view_set_cursor (GTK_TREE_VIEW(ftree), treepath,
NULL, 0);
gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW(ftree),
treepath, 0, TRUE, 0.3, 0);
gtk_tree_path_free(treepath);
return;
}
}
valid = gtk_tree_model_iter_next (fstore, &iter);
}
....
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]