[Gtk-sharp-list] TreeView Sorting
"patrick müller (aka elias)"
ghostwwinside at gmx.net
Wed May 25 12:07:29 EDT 2005
i'm new to mono, gtk and app programming at all (and the list, of course).
i hope someone can help me a little bit with my upcoming problems :)
i'm using the TreeView/TreeStore to render an 2 column
tree, this works fine. now i want to add sorting (for both
columns different) the cleanest way.
according to this tutorial:
(i think) it should work this way:
- set ColumnId and SortMeth with TreeStore.SetSortFunc()
- set TreeViewColumn.SortColumnId to ColumnId
if i do this with ColumnId 0 and 1 (i think again) clicking
on column header0 will sort by SortMeth0 and clicking
on header1 will sort by SortMeth1.
but currently both headers sort by SortMeth0. Where is the problem?
Here is a code snippet:
store.SetSortFunc(0, new TreeIterCompareFunc(DoSortType));
TreeView tv = new TreeView(store);
tv.HeadersVisible = true;
//... same for cola ..
TreeViewColumn colb = new TreeViewColumn("Name", new CellRendererText(), "text", 1);
colb.Clickable = true;
colb.SortColumnId = 1;
colb.SortIndicator = true;
the sort algorithms work, i've tested them with an workaround
via TreeViewColumn.Click event, but that ist not really clean.
thanks in advance,
More information about the Gtk-sharp-list