forked from gnh1201/welsonjs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgtk.demo.js
68 lines (55 loc) · 1.62 KB
/
gtk.demo.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
var GTK = require("lib/gtk");
function main() {
GTK.init(function() {
var win, table, button, entry, text, radiogroup, radio1, radio2;
// create new window
win = new GTK.Window({
title: "WelsonJS GTK GUI Demo Application",
width: 450,
height: 400
});
// create new table
table = new GTK.Table({
rows: 50,
columns: 50
});
win.setContainer(table);
// create new button
button = new GTK.Button({
text: "Exit"
});
button.addEventListener("click", function() {
GTK.exit();
});
table.attach(button, 41, 49, 45, 49);
// create new entry
entry = new GTK.Entry();
table.attach(entry, 1, 40, 45, 49);
entry.addEventListener("enter", function(event) {
console.info(event.target.getText());
});
// create new textbox
text = new GTK.TextBox();
table.attach(text, 1, 49, 8, 44);
// create new radiogroup
radiogroup = new GTK.RadioGroup();
// create new radio (Radio 1)
radio1 = new GTK.RadioBox({
text: "Yes",
group: radiogroup
});
table.attach(radio1, 1, 10, 1, 4);
// create new radio (Radio 2)
radio2 = new GTK.RadioBox({
text: "No",
group: radiogroup
});
table.attach(radio2, 1, 10, 4, 7);
// showing window
win.show();
// focusing entry
entry.focus();
});
GTK.wait();
}
exports.main = main;