3 using System.Reflection;
4 using System.Collections;
8 public class ABMGenerico
14 public ABMGenerico (Type objectType)
16 PropertyInfo[] properties = objectType.GetProperties ();
19 xml = new Glade.XML (null, "abm_generico.glade", "abm_one", null);
20 xml.Autoconnect (this);
23 foreach( PropertyInfo mf in properties ) {
24 Widget l = GetWidget (mf);
26 tabla.Attach (l, 0, 1, i, i+1);
27 Entry e = new Entry ();
28 tabla.Attach (e, 1, 2, i, i+1);
36 private Widget GetWidget (PropertyInfo mf)
39 if (mf.PropertyType.Equals (typeof(string))
40 || mf.PropertyType.Equals (typeof(int))
41 || mf.PropertyType.Equals (typeof(float))) {
42 Label l = new Label (GetLabel (mf.Name) + " : ");
43 l.Justify = Justification.Left;
51 private string GetLabel (string name)
54 string s = (string)name.Clone ();
55 while (i < s.Length) {
56 if (Char.IsUpper(s[i]) && (i>0)) {
57 s = s.Insert (i, " ");
65 public void OnDialogResponse (object o, ResponseArgs args)
67 if (args.ResponseId == ResponseType.Cancel)
73 Dialog w = (Dialog)xml.GetWidget ("abm_one");