2024-01-16 16:37:43 -06:00
|
|
|
// This creates a simple hello world window
|
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"go.wit.com/log"
|
|
|
|
"go.wit.com/gui/gui"
|
|
|
|
)
|
|
|
|
|
|
|
|
var myGui *gui.Node // This is the beginning of the binary tree of widgets
|
|
|
|
|
|
|
|
// go will sit here until the window exits
|
|
|
|
func main() {
|
|
|
|
myGui = gui.New().Default()
|
2024-01-16 18:53:11 -06:00
|
|
|
myGui.LoadToolkit("nocui")
|
2024-01-16 16:37:43 -06:00
|
|
|
|
|
|
|
helloworld()
|
|
|
|
gui.Watchdog()
|
|
|
|
}
|
|
|
|
|
|
|
|
// This initializes the first window, a group and a button
|
|
|
|
func helloworld() {
|
|
|
|
window := myGui.NewWindow("hello world")
|
|
|
|
|
2024-01-16 21:00:04 -06:00
|
|
|
box := window.NewBox("vbox", false)
|
|
|
|
group := box.NewGroup("groupy")
|
|
|
|
grid := group.NewGrid("gridiron", 2, 1)
|
|
|
|
grid.NewButton("hello", func() {
|
2024-01-16 16:37:43 -06:00
|
|
|
log.Println("world")
|
|
|
|
})
|
2024-01-16 21:00:04 -06:00
|
|
|
grid.NewButton("in", func() {
|
|
|
|
log.Println("out")
|
|
|
|
})
|
|
|
|
grid.NewLabel("apple")
|
|
|
|
|
|
|
|
dd := grid.NewDropdown().SetProgName("COMPUTERS")
|
|
|
|
dd.AddText("Atari 500")
|
|
|
|
dd.AddText("Beagleboard")
|
|
|
|
dd.AddText("Unmatched Rev B")
|
|
|
|
dd.AddText("asldjf")
|
|
|
|
dd.AddText("asdjf")
|
|
|
|
dd.AddText("a1jf")
|
|
|
|
dd.AddText("jf")
|
|
|
|
|
|
|
|
cb := grid.NewCombobox().SetProgName("COLORS")
|
|
|
|
cb.AddText("Cyan")
|
|
|
|
cb.AddText("Magenta")
|
|
|
|
cb.AddText("Yellow")
|
2024-01-16 16:37:43 -06:00
|
|
|
}
|