/* 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;
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));
}
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! :) */
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);
}
}
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);
}
}
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);