[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gtk-app-devel
Subject:    moving rows in a TreeStore
From:       Chris Hoefler <hoeflerb () reed ! edu>
Date:       2003-07-30 2:10:22
[Download RAW message or body]

Hi,

I have a simple a TreeStore that is setup to allow selections only at
the root level (i.e: some rows have children, but the children aren't
selectable). I am trying to implement a couple of buttons that will move
a selected row up or down one row in the TreeStore. Looking at the api I
have found the functions gtk_tree_store_move_after(),
gtk_tree_store_move_before(), and gtk_tree_store_swap(), but I can't get
them to work.

I have tried...

GtkTreeIter iter;
GtkTreeStore *store;

iter = <loop to retrieve row corresponding to current selection>
gtk_tree_store_move_after(store, &iter, &iter);

...and...

GtkTreeIter iter, next_iter;
GtkTreeStore *store;

iter = <loop to retrieve row corresponding to current selection>
next_iter = iter;
gtk_tree_model_iter_next(GTK_TREE_MODEL(store), &next_iter);
gtk_tree_store_move_after(store, &iter, &next_iter);

...and...

GtkTreeIter iter, next_iter;
GtkTreeStore *store;

iter = <loop to retrieve row corresponding to current selection>
next_iter = iter;
gtk_tree_model_iter_next(GTK_TREE_MODEL(store), &next_iter);
gtk_tree_store_swap(store, &iter, &next_iter);

In the first two cases, nothing happens. In the last case I get a little
error that says the two rows are not at the same level, but I don't know
how that can be the case.

Any suggestions?

-Chris

_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic