summaryrefslogtreecommitdiff
path: root/gui-example/main.go
blob: 5f34f98afc793880c5d65d86dc80bc5b3f881d3c (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
package main

import (
	"log"
	"os"
	"time"

	"git.wit.org/wit/gui"
)

func customExit(gw *gui.GuiWindow) {
	log.Println("Should Exit Here")
	os.Exit(0)
}

func main() {
	log.Println("starting my Control Panel")

	gui.Config.Width = 800
	gui.Config.Height = 300
	gui.Config.Exit = customExit

	go gui.Main(initGUI)

	watchGUI()
}

func initGUI() {
	gui.NewWindow("jcarr start", 640, 480)
}

func watchGUI() {
	var i = 1
	for {
		log.Println("Waiting for customExit()", i)
		i += 1
		time.Sleep(3 * time.Second)
		if i == 2 {
			log.Println("Sending ExampleWindow to gui.Queue()")
			gui.Queue(gui.DebugWindow)
		}
	}
}