Re: How to sort a treeview?



John Spray wrote:
On Tue, 2007-05-29 at 14:37 +0200, Jef Driesen wrote:
Jef Driesen wrote:
I have a treeview that can be sorted by the user by clicking on the column headers. But how do I sort the treeview from code? When the application exits, I want to remember which column was sorted (and the sort direction) and restore them when the application is started again.

Have a look at
http://www.gtkmm.org/docs/gtkmm-2.4/docs/reference/html/classGtk_1_1TreeSortable.html

Gtk::ListStore and Gtk::TreeStore both inherit from TreeSortable

It didn't came to my mind i had to sort the model, not the treeview column. Probably because I was already using this code for the user clickable headers:

m_treeview.get_column(idx)->set_sort_column(m_column.xxxx);

But this requires user interaction (clicking on the header) to perform the sort. However, the function with the same name for the treestore sorts immediately. Thanks!





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