Update gtk.js

This commit is contained in:
Namhyeon Go 2020-10-26 21:35:47 +09:00
parent a6fc2347a0
commit e257414770

View File

@ -46,7 +46,7 @@ var GTKCreateWidget = function(widget) {
case "Button": case "Button":
commands.push([ commands.push([
"gtk_button_new_with_label", "gtk_button_new_with_label",
widget.text "\"" + widget.text + "\""
]); ]);
break; break;
@ -63,7 +63,7 @@ var GTKCreateWidget = function(widget) {
commands.push([ commands.push([
"gtk_radio_button_new_with_label_from_widget", "gtk_radio_button_new_with_label_from_widget",
widget.member, widget.member,
widget.text "\"" + widget.text + "\""
]); ]);
break; break;
@ -191,7 +191,7 @@ var Entry = function() {
}; };
this.empty = function() { this.empty = function() {
return GTKExecCommand([ GTKExecCommand([
"gtk_editable_delete_text", "gtk_editable_delete_text",
this.widgetID, this.widgetID,
0, 0,
@ -199,16 +199,20 @@ var Entry = function() {
]); ]);
}; };
this.getText = function() { this.getText = function() {
return GTKExecCommand([ this.text = GTKExecCommand([
"gtk_entry_get_text", "gtk_entry_get_text",
this.widgetID this.widgetID
]); ]);
return this.text;
}; };
this.setText = function(text) { this.setText = function(text) {
return GTKExecCommand([ this.text = text;
GTKExecCommand([
"gtk_entry_set_text", "gtk_entry_set_text",
this.widgetID, this.widgetID,
CHR(34) + text + CHR(10) + CHR(34) "\"" + this.text + "\""
]); ]);
}; };
@ -236,13 +240,14 @@ var TextBox = function() {
this.text = "New TextBox"; this.text = "New TextBox";
this.setText = function(text) { this.setText = function(text) {
return GTKExecCommand([ this.text = text;
GTKExecCommand([
"gtk_text_insert", "gtk_text_insert",
this.widgetID, this.widgetID,
"NULL", "NULL",
"NULL", "NULL",
"NULL", "NULL",
CHR(34) + text + CHR(10) + CHR(34), "\"" + this.text + "\""
"-1" "-1"
]); ]);
}; };