NewBranch.bjs
authorAlan Knowles <alan@roojs.com>
Wed, 31 Oct 2018 05:04:22 +0000 (13:04 +0800)
committerAlan Knowles <alan@roojs.com>
Wed, 31 Oct 2018 05:04:22 +0000 (13:04 +0800)
NewBranch.vala

NewBranch.bjs
NewBranch.vala

index ff3cc48..990ead6 100644 (file)
@@ -31,6 +31,7 @@
        "bool homogeneous" : false,
        "* pack" : "pack_start,false,false,0",
        "xtype" : "Table",
+       "uint column_spacing" : 2,
        "n_columns" : 2,
        "$ xns" : "Gtk",
        "n_rows" : 2,
@@ -47,6 +48,9 @@
          "$ xns" : "Gtk"
         },
         {
+         "listeners" : {
+          "changed" : "() => {\n\n\tValue val1;\n\tValue val2;\n \n\tthis.el.get_active_iter (out iter);\n\t_this.dbmodel.get_value (iter, 0, out val1);\n\t_this.dbmodellist_store.get_value (iter, 1, out val2);\n\n\tprint (\"Selection: %s, %d\\n\", (string) val1, (int) val2);\n}"
+         },
          "id" : "build_module",
          "* init" : "this.el.add_attribute(_this.dbcellrenderer.el , \"markup\", 1 );",
          "* pack" : "attach_defaults,1,2,0,1",
index a2e6011..61de69f 100644 (file)
@@ -118,6 +118,7 @@ public class NewBranch : Object
 
             // set gobject values
             this.el.margin = 2;
+            this.el.column_spacing = 2;
             var child_0 = new Xcls_Label4( _this );
             child_0.ref();
             this.el.attach_defaults (  child_0.el , 0,1,0,1 );
@@ -187,6 +188,19 @@ public class NewBranch : Object
             // init method
 
             this.el.add_attribute(_this.dbcellrenderer.el , "markup", 1 );
+
+            //listeners
+            this.el.changed.connect( () => {
+            
+               Value val1;
+               Value val2;
+             
+               this.el.get_active_iter (out iter);
+               _this.dbmodel.get_value (iter, 0, out val1);
+               _this.dbmodellist_store.get_value (iter, 1, out val2);
+            
+               print ("Selection: %s, %d\n", (string) val1, (int) val2);
+            });
         }
 
         // user defined functions