[Gtk#] TreeModelFilter - it not filter at all.



public class Kategorie : VBox {
        public Kategorie() {
                //...
                
                PackStart(szukaj = new Entry(), false, false, 0); {
                        szukaj.Changed += delegate {filter.Refilter();};
                } szukaj.Show();
                        
                PackStart(tv = new TreeViewPopup(menu)); {
                        TreeViewColumn kategorie = new TreeViewColumn(); {
                                //...
                        } tv.AppendColumn(kategorie);
                        ls = new ListStore(new Type[]{typeof(Kategoria)}); {
                                //Adds content
                        } filter = new TreeModelFilter(ls, null); {
                                filter.VisibleFunc = new TreeModelFilterVisibleFunc(Kat_Find);
                        } tv.Model = filter;
                        tv.HeadersVisible = true;
                } tv.Show();
        }
        
        private bool Kat_Find(TreeModel model, TreeIter iter) {
                String nazwa = (model.GetValue(iter, 0) as Kategoria).Nazwa;
                
                if(szukaj.Text == "")
                        return true;
                return (nazwa.IndexOf(nazwa) > -1);
        }
        //Some functions
                
        private TreeView tv;
        private ListStore ls;
        private Menu menu;
        private Entry szukaj;
        private TreeModelFilter filter;
}

I use http://www.mono-project.com/GtkSharp_TreeView_Tutorial.

What's wrong?




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