This commit is contained in:
Namhyeon Go 2020-10-28 17:31:30 +09:00
parent 60cddaa05a
commit 44c55d30bf
2 changed files with 8 additions and 4 deletions

View File

@ -22,7 +22,7 @@ function main() {
button = new GTK.Button({ button = new GTK.Button({
text: "Exit" text: "Exit"
}); });
button.addEventListener('click', function() { button.addEventListener("click", function() {
GTK.exit(); GTK.exit();
}); });
table.attach(button, 41, 49, 45, 49); table.attach(button, 41, 49, 45, 49);
@ -33,7 +33,7 @@ function main() {
// create new textbox // create new textbox
text = new GTK.TextBox(); text = new GTK.TextBox();
table.attach(entry, 1, 49, 8, 44); table.attach(text, 1, 49, 8, 44);
// create new radiogroup // create new radiogroup
radiogroup = new GTK.RadioGroup(); radiogroup = new GTK.RadioGroup();

View File

@ -18,9 +18,11 @@ var GTKWidget = function(options) {
this.widgetID = "0"; this.widgetID = "0";
this.dispatchEvent = function(event) { this.dispatchEvent = function(event) {
var eventName = 'on' + event.eventName;
event.target = this; event.target = this;
if(event.eventName in this) { if(eventName in this) {
this['on' + event.eventName](event); this[eventName](event);
} }
}; };
this.addEventListener = function(eventName, fn) { this.addEventListener = function(eventName, fn) {
@ -31,6 +33,8 @@ var GTKWidget = function(options) {
} }
}; };
this.eventListener = function() { this.eventListener = function() {
console.info("eventListener");
this.dispatchEvent(new GTKEvent("wait")); this.dispatchEvent(new GTKEvent("wait"));
return GTKEventListener(this); return GTKEventListener(this);
}; };