How to make listview scroll to active position?

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

 



The application uses a listview and works out current position in it, but the list does not scroll to it. The user have to do this manually, which is tedious if the active position is far down the list, say at position 5000.  

I am using the following fragment to set the selection at pos:

[code]
   GtkTreeView * tv = ...
   GtkTreeSelection * tsel = gtk_tree_view_get_selection (tv);
   GtkTreeIter iter ;
   GtkListStore * store = (GtkListStore *)gtk_tree_view_get_model ( tv ) ;
   if ( gtk_tree_model_iter_nth_child ( (GtkTreeModel *)store ,
                                                      &iter , NULL , pos ) )
      {
      gtk_tree_selection_select_iter ( tsel , &iter ) ;
      }
[/code]

How can I make the list scroll to the current selection?

Are there better ways of doing this?


_______________________________________________
gtk-list mailing list
gtk-list@xxxxxxxxx
http://mail.gnome.org/mailman/listinfo/gtk-list

[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux