Crap, I ALWAYS miss something when i hit send. All the "2nd" are really "3rd" >.>
On Thu, Jul 29, 2010 at 2:05 PM, David S <butt...@gmail.com> wrote: > All you really need to do is call SetSortFunc and then SetSortColumnId like > so. I will say my sort is a bit complicated so if you need more help go > here<http://www.go-mono.com/docs/index.aspx?link=M:Gtk.ListStore.SetSortFunc(System.Int32,Gtk.TreeIterCompareFunc)> > . > > // set sort function for 2nd column > diffStore.SetSortFunc( 2, (TreeModel model, TreeIter a, TreeIter b) => { > RegexMove commandA = model.GetValue( a, 0 ) as RegexMove; RegexMove commandB > = model.GetValue( b, 0 ) as RegexMove; string seasonStringA; int seasonA = > -1; string seasonStringB; int seasonB = -1; string episodeStringA; int > episodeA = -1; string episodeStringB; int episodeB = -1; > commandA.Match.NamedGroups.TryGetValue( "season", out seasonStringA ); > commandB.Match.NamedGroups.TryGetValue( "season", out seasonStringB ); > commandA.Match.NamedGroups.TryGetValue( "episode", out episodeStringA ); > commandB.Match.NamedGroups.TryGetValue( "episode", out episodeStringB ); > int.TryParse(seasonStringA, out seasonA); int.TryParse(seasonStringB, out > seasonB); int.TryParse(episodeStringA, out episodeA); > int.TryParse(episodeStringB, out episodeB); if ( seasonA.CompareTo( seasonB > ) == 0 ) return episodeA.CompareTo( episodeB ); else return > seasonA.CompareTo( seasonB ); }); > // set the sort column to the 2nd diffStore.SetSortColumnId( 2, > SortType.Ascending ); > > On Thu, Jul 29, 2010 at 7:05 AM, Tensai Cirno <ten...@cirno.in> wrote: > >> I've got treeview with complex liststore. >> >> Treeview has only 1 column with 2 cellrenderers (pixbuf and text) and >> liststore 3 fields (pixbuf, text and internal bool). >> >> I've written SortFunc and set liststore.DefaultSortFunc = SortFunc. What >> i should do to perform sorting itself? Not just Ascending/Descending >> sort of 1 column, but complex sort with SortFunc. >> _______________________________________________ >> Gtk-sharp-list maillist - Gtk-sharp-list@lists.ximian.com >> http://lists.ximian.com/mailman/listinfo/gtk-sharp-list >> > >
_______________________________________________ Gtk-sharp-list maillist - Gtk-sharp-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/gtk-sharp-list