How do I ask for the previous entry in a list store given the current selection?
Here's what I'm trying to do: I've got a list store that I want the user to be able to reorder. The list has two fields: It's ordinal rank and it's name. I'm allowing the user to sort on any field so he can peruse the list the way s/he wants. My approach is to swap neighboring rows by decrementing (to move up) or incrementing (to move down) the value of column 0 of the current selection and replace the value of column 0 of the preceding/succeeding selection, and let the treeview catch the change and re-present the list. To this end I've created a pair of buttons, one labeled 'Up' and one labeled 'Down', and in their callbacks they ask the list view for the current selection, then get the model and iter from that, then ask for the value of column 0 (the ordinal rank of the entry), decrement it (to move it up the list) or increment it (to move it down the list) the value and call model.set_value(). Since the list is sorted by the first column, the list store will inform the list view of the change, the list view re-renders, and my entry has 'moved up'. The problem is that I also need to give the old value to the neighbor I'm taking the place of, to complete the swap. But I can't find a way to ask for the entry that precedes the current selection. -- [email protected] Office: 619.278.2084 Cell: 619.990.2286 _______________________________________________ gtk-app-devel-list mailing list [email protected] http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
