new-gui/cmds/helloworld/main.go

39 lines
730 B
Go
Raw Normal View History

2022-10-11 11:25:46 -05:00
// This creates a simple hello world window
package main
import (
"os"
"log"
2022-10-11 11:25:46 -05:00
"git.wit.org/wit/gui"
)
func main() {
gui.Main(initGUI)
}
// This initializes the first window
func initGUI() {
gui.Config.Title = "Hello World golang wit/gui Window"
gui.Config.Width = 640
gui.Config.Height = 480
gui.Config.Exit = myDefaultExit
2022-10-11 11:25:46 -05:00
node1 := gui.NewWindow()
addDemoTab(node1, "A Simple Tab Demo")
addDemoTab(node1, "A Second Tab")
}
func addDemoTab(n *gui.Node, title string) {
newNode := n.AddTab(title, nil)
g := newNode.NewGroup("group 1")
// g.Dump()
g.AddComboBox("demoCombo2", "more 1", "more 2", "more 3")
2022-10-11 11:25:46 -05:00
}
func myDefaultExit(n *gui.Node) {
log.Println("You can Do exit() things here")
os.Exit(0)
}