From: Alan Knowles Date: Wed, 31 Oct 2018 05:04:22 +0000 (+0800) Subject: NewBranch.bjs X-Git-Url: http://git.roojs.org/?p=gitlive;a=commitdiff_plain;h=3d941e7d76503299cc6ed555c66985ae62330718 NewBranch.bjs NewBranch.vala --- diff --git a/NewBranch.bjs b/NewBranch.bjs index ff3cc485..990ead6b 100644 --- a/NewBranch.bjs +++ b/NewBranch.bjs @@ -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", diff --git a/NewBranch.vala b/NewBranch.vala index a2e60118..61de69f6 100644 --- a/NewBranch.vala +++ b/NewBranch.vala @@ -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