GtkTreeView sorting problem
- From: Robert Homann <rhomann TechFak Uni-Bielefeld DE>
- To: gtk-app-devel-list gnome org
- Subject: GtkTreeView sorting problem
- Date: Mon, 22 Jul 2002 23:21:58 +0200 (MEST)
Hello mailing list!
I have a small problem sorting a GtkTreeStore in a GtkTreeView in
GTK+ 2.0.5. I create the store with gtk_tree_store_new(), then later
a tree view with gtk_tree_view_new_with_model() and append two columns
of type G_TYPE_STRING to it. The sort column for the first view column
is set to the first data column in the GtkTreeStore, the second view
column's sort column is set to the second data column. This works
fine, populating the tree with data works fine, too, but if there is
only one top level node in the tree, the view is never sorted. An
explicit call to gtk_tree_sortable_set_sort_column_id() to set a
specific column as sort column succeeds, but changing the sort order
via mouse still won't work, and it only works for data inserted
_after_ the call (that is, the previously inserted lines are not
sorted, only the new ones).
So, is this a known bug in GTK+ 2.0.5, is it a feature, or am I doing
something wrong?
Here is the code I used in my test program to store some data inside
the tree:
void set_data(GtkTreeStore *treestore)
{
GtkTreeIter iter, iter2;
gtk_tree_store_append(treestore,&iter,NULL);
gtk_tree_store_set(treestore,&iter,0,"Treenode",1,"Z",-1);
/* Enabling these two lines enables sorting */
/* gtk_tree_store_append(treestore,&iter,NULL);
gtk_tree_store_set(treestore,&iter,
0,"Another node",1,"Z2",-1); */
gtk_tree_store_append(treestore,&iter2,&iter);
gtk_tree_store_set(treestore,&iter2,1,"C",-1);
gtk_tree_store_append(treestore,&iter2,&iter);
gtk_tree_store_set(treestore,&iter2,1,"B",-1);
gtk_tree_store_append(treestore,&iter2,&iter);
gtk_tree_store_set(treestore,&iter2,1,"D",-1);
gtk_tree_store_append(treestore,&iter2,&iter);
gtk_tree_store_set(treestore,&iter2,1,"A",-1);
}
Thanks in advance, Robert.
--
Windows is not the answer.
Windows is the question.
The answer is "No".
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]