RE: gtk_tree_view_scroll_to_cell erratic



I've upgraded to 2.0.6 and I'm pretty sure now that this is a bug.  I've
been able to duplicate the problem in gtk-demo.  If you add rows and then
try to scroll to a cell a few pages down, the treeview will scroll to
somewhere between where you were and where you want to scroll.  Can anyone
think of a workaround or know of a patch? I couldn't find one

Thanks

-----Original Message-----
From: gtk-app-devel-list-admin gnome org
[mailto:gtk-app-devel-list-admin gnome org]On Behalf Of Erik Simonsen
Sent: Tuesday, September 17, 2002 12:49 PM
To: gtk-app-devel-list gnome org
Subject: gtk_tree_view_scroll_to_cell erratic


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);
   }

        ....

_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list




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