blob: 3ae3b07825936c7504d75108a2e7d377c909f2a6 (
plain)
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
|
// This creates a simple hello world window
package main
import (
"os"
"log"
"git.wit.org/wit/gui"
)
func main() {
gui.Main(myGUI)
}
// This initializes the first window
func myGUI() {
var w *gui.Node
gui.Config.Title = "Hello World golang wit/gui Window"
gui.Config.Width = 640
gui.Config.Height = 480
gui.Config.Exit = myExit
w = gui.NewWindow()
addHelloWorld(w, "A Simple Tab")
}
func addHelloWorld(window *gui.Node, title string) {
var newNode, g, tb *gui.Node
newNode = window.NewTab(title)
g = newNode.NewGroup("hello")
tb = g.NewTextbox("hello world box") // when debugging, this string will be used
tb.OnChanged = func(*gui.Node) {
s := tb.GetText()
log.Println("text box =", s)
}
tb.SetText("world")
}
func myExit(n *gui.Node) {
log.Println("exit() here")
os.Exit(0)
}
|