summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--gui-example/Makefile5
-rw-r--r--gui-example/main.go43
-rw-r--r--main.go1
4 files changed, 50 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index 1377554..bb1e72d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,2 @@
*.swp
+gui-example/gui-example
diff --git a/gui-example/Makefile b/gui-example/Makefile
new file mode 100644
index 0000000..b705093
--- /dev/null
+++ b/gui-example/Makefile
@@ -0,0 +1,5 @@
+run: build
+ ~/go/bin/gui-example
+
+build:
+ GO111MODULE="off" go install
diff --git a/gui-example/main.go b/gui-example/main.go
new file mode 100644
index 0000000..f3e4c48
--- /dev/null
+++ b/gui-example/main.go
@@ -0,0 +1,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 = 1000
+ gui.Config.Height = 400
+ 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(time.Second)
+ if i == 3 {
+ log.Println("Sending ExampleWindow to gui.Queue()")
+ gui.Queue(gui.ExampleWindow)
+ }
+ }
+}
diff --git a/main.go b/main.go
index 5e4d1b4..6d371a6 100644
--- a/main.go
+++ b/main.go
@@ -32,6 +32,7 @@ func ExampleWindow() {
window := box.Window
log.Println("box =", box)
log.Println("window =", window)
+ box.AddDebugTab("jcarr Debug")
window.UiWindow.Show()
}