diff options
| author | Jeff Carr <[email protected]> | 2021-10-28 04:10:48 -0500 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2021-10-28 04:10:48 -0500 |
| commit | 983a60903badac53d1418065843e0d814eb2cb67 (patch) | |
| tree | 81d70db3abe591f3dfbff8dfbe91440d549a88d9 /gui-example | |
| parent | 81c44bce5313d4415a0fa062ececc4547832d66d (diff) | |
NODE: almost out of the rabbit hole
Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'gui-example')
| -rw-r--r-- | gui-example/Makefile | 5 | ||||
| -rw-r--r-- | gui-example/main.go | 68 |
2 files changed, 0 insertions, 73 deletions
diff --git a/gui-example/Makefile b/gui-example/Makefile deleted file mode 100644 index 5028ebd..0000000 --- a/gui-example/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -run: build - ./gui-example - -build: - GO111MODULE="off" go build diff --git a/gui-example/main.go b/gui-example/main.go deleted file mode 100644 index 9fcb971..0000000 --- a/gui-example/main.go +++ /dev/null @@ -1,68 +0,0 @@ -package main - -import ( - "log" - "os" - "time" - - "git.wit.org/wit/gui" -) - -// This initializes the first window -// -// Then starts a goroutine to demonstrate how to -// inject things into the GUI -func main() { - log.Println("Starting my Control Panel") - - go gui.Main(initGUI) - - watchGUI() -} - -// This initializes the first window -func initGUI() { - gui.Config.Title = "WIT GUI Window Demo 1" - gui.Config.Width = 640 - gui.Config.Height = 480 - gui.Config.Exit = myExit - node1 := gui.NewWindow() - node1.AddDemoTab("A Simple Tab Demo") - - gui.Config.Title = "WIT GUI Window Demo 2" - gui.Config.Width = 640 - gui.Config.Height = 240 - gui.Config.Exit = myExit - node2 := gui.NewWindow() - node2.AddDemoAndlabsUiTab("A Simple andlabs/ui Tab Demo") -} - -// This demonstrates how to properly interact with the GUI -// You can not involke the GUI from external goroutines in most cases. -func watchGUI() { - var i = 1 - for { - log.Println("Waiting", i, "seconds") - i += 1 - time.Sleep(1 * time.Second) - if i == 4 { - log.Println("Opening a Debug Window via the gui.Queue()") - gui.Config.Width = 800 - gui.Config.Height = 300 - gui.Config.Exit = myDebugExit - gui.Queue(gui.DebugWindow) - } - } -} - -func myExit(n *gui.Node) { - log.Println() - log.Println("Entered myExit() on node.Name =", n.Name) - log.Println() - os.Exit(0) -} - -func myDebugExit(n *gui.Node) { - log.Println("Entered myDebugExit() on node.Name =", n.Name) - log.Println("Don't actually os.Exit()") -} |
