X-Git-Url: https://git.llucax.com/z.facultad/75.10/miklolife.git/blobdiff_plain/52dc39ea6822f9767e480581e9a59d8a7896e3a6..1a14964592379a39d96bc84c53db779507d12415:/demo/src/Vistas/EmitirHojeDeRuta.cs?ds=sidebyside diff --git a/demo/src/Vistas/EmitirHojeDeRuta.cs b/demo/src/Vistas/EmitirHojeDeRuta.cs index 46b49e0..1618646 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,13 +112,15 @@ 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++) - store2.SetValue (nuevo, i, store1.GetValue (iter, i)); - store1.Remove (ref iter); + store2.SetValue (nuevo, i, model.GetValue (iter, i)); + + TreeIter rem = (model as TreeModelSort).ConvertIterToChildIter (iter); + store1.Remove (ref rem); } } @@ -115,13 +132,15 @@ 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++) - store2.SetValue (nuevo, i, store1.GetValue (iter, i)); - store1.Remove (ref iter); + store2.SetValue (nuevo, i, model.GetValue (iter, i)); + + TreeIter rem = (model as TreeModelSort).ConvertIterToChildIter (iter); + store1.Remove (ref rem); } } @@ -130,7 +149,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);