From: Ricardo Markiewicz Date: Thu, 7 Jul 2005 17:29:43 +0000 (+0000) Subject: mas orden y browse en listas X-Git-Tag: svn_import~8 X-Git-Url: https://git.llucax.com/z.facultad/75.10/miklolife.git/commitdiff_plain/8d6008b7f8ad19bb71f26f5c68b4b029de2f9c3b?ds=sidebyside mas orden y browse en listas --- diff --git a/demo/src/Vistas/EmitirHojeDeRuta.cs b/demo/src/Vistas/EmitirHojeDeRuta.cs index 46b49e0..bcd3341 100644 --- a/demo/src/Vistas/EmitirHojeDeRuta.cs +++ b/demo/src/Vistas/EmitirHojeDeRuta.cs @@ -26,8 +26,8 @@ public class VEmitirHojaDeRuta /* Creo los modelos para los TreeView y el ComboBox Tipo Doc NroDoc Apellido Nombre */ - disponibles.Model = new ListStore (typeof(string), typeof(int), typeof (string), typeof (string)); - hojaderuta.Model = new ListStore (typeof(string), typeof(int), typeof (string), typeof (string)); + disponibles.Model = new TreeModelSort (new ListStore (typeof(string), typeof(int), typeof (string), typeof (string))); + hojaderuta.Model = new TreeModelSort (new ListStore (typeof(string), typeof(int), typeof (string), typeof (string))); /* Columnas */ disponibles.HeadersVisible = true; @@ -40,13 +40,28 @@ public class VEmitirHojaDeRuta hojaderuta.AppendColumn ("Nro Doc.", new CellRendererText (), "text", 1); hojaderuta.AppendColumn ("Apellido", new CellRendererText (), "text", 2); hojaderuta.AppendColumn ("Nombre", new CellRendererText (), "text", 3); + + int i = 0; + foreach (TreeViewColumn col in disponibles.Columns) { + col.SortColumnId = i++; + } + disponibles.EnableSearch = true; + disponibles.Reorderable = true; + disponibles.HeadersClickable = true; + i = 0; + foreach (TreeViewColumn col in hojaderuta.Columns) { + col.SortColumnId = i++; + } + hojaderuta.EnableSearch = true; + hojaderuta.Reorderable = true; + hojaderuta.HeadersClickable = true; xml.GetWidget ("emitir_hoja_de_ruta").SetSizeRequest (500, 420); /* Cargo promotores */ ListStore l = (ListStore)promotores.Model; l.Clear (); - for(int i=0; i<10; i++) + for(i=0; i<10; i++) l.AppendValues (String.Format ("Promotor {0}", i)); } @@ -60,7 +75,7 @@ public class VEmitirHojaDeRuta int promotor = 0; /* Veo si hay items en la hoja de ruta */ - ListStore store = (ListStore)hojaderuta.Model; + ListStore store = (hojaderuta.Model as TreeModelSort).Model as ListStore; TreeIter iter; if (store.GetIterFirst (out iter) == false) { /* Lista vacia! .. Alarm! Alarm! :) */ @@ -97,8 +112,8 @@ public class VEmitirHojaDeRuta TreeModel model; if (fromSel.GetSelected (out model, out iter)) { - ListStore store1 = (ListStore)disponibles.Model; - ListStore store2 = (ListStore)hojaderuta.Model; + ListStore store1 = (disponibles.Model as TreeModelSort).Model as ListStore; + ListStore store2 = (hojaderuta.Model as TreeModelSort).Model as ListStore; TreeIter nuevo = store2.Append (); for(int i=0; i<4; i++) @@ -115,8 +130,8 @@ public class VEmitirHojaDeRuta TreeModel model; if (fromSel.GetSelected (out model, out iter)) { - ListStore store1 = (ListStore)hojaderuta.Model; - ListStore store2 = (ListStore)disponibles.Model; + ListStore store2 = (disponibles.Model as TreeModelSort).Model as ListStore; + ListStore store1 = (hojaderuta.Model as TreeModelSort).Model as ListStore; TreeIter nuevo = store2.Append (); for(int i=0; i<4; i++) @@ -130,7 +145,7 @@ public class VEmitirHojaDeRuta RutasController c = new RutasController (); ArrayList sols = c.ObtenerSolicitantesPendientes (); - ListStore store = (ListStore)disponibles.Model; + ListStore store = (disponibles.Model as TreeModelSort).Model as ListStore; foreach (Solicitante s in sols) { TreeIter iter = store.AppendValues (s.TipoDocumento.ToString (), s.NroDocumento, s.Nombre, s.Apellido);