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

View File

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