Re: [gtkmm] Treeview help needed



bart wrote:

if i'm not mistaken you cna use Gtk::TreeViewColumn::signal_clicked() to
get a clicked signal from the headers.

No need to handle that signal is all you want is beeing able to control the sorting by clicking on the column headers, though. That is handled automatically by the TreeView once you activate sorting.

For sorting use something like this:

treestore->set_sort_column_id(<your column to sort>,
Gtk::SORT_ASCENDING);


In addition, you may want to add a sort function on your date column with TreeSortable::set_sort_func(), as sorting will be done in "alphabetic" order, which, depending on your date format, may not be the order you want. Alternatively, store the date in numeric format and add a data_func to convert it into a string in which case the default sorting order would be what you want.

--
Christer




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