diff options
| author | Jeff Carr <[email protected]> | 2022-11-06 12:59:24 -0600 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2022-11-06 12:59:24 -0600 |
| commit | e55fb6675d692e3f44fa67b02b12661e476bd028 (patch) | |
| tree | c16084dea9779f5ef244adb3937d33adb17e7bad /toolkit/hello/main.go | |
| parent | 099efb6b24caf9eaad50d7386636a7ac23552bde (diff) | |
start trying to make the tookits pluginsv0.4.3
totally minimize helloworld demo
try to make a button plugin example
debug changes
final changes before attempting to use a golang plugin
actually running gocui as a plugin
add gocli-as-plugin example
try to convert the go-cui toolkit into a plugin
doc updates
make a minimal console gui
Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'toolkit/hello/main.go')
| -rw-r--r-- | toolkit/hello/main.go | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/toolkit/hello/main.go b/toolkit/hello/main.go new file mode 100644 index 0000000..3a72d1f --- /dev/null +++ b/toolkit/hello/main.go @@ -0,0 +1,44 @@ +// This creates a simple hello world window +package main + +import ( + "os" + "log" + "git.wit.org/wit/gui" +) + +func Init() { + gui.Main(myGUI) +} + +// This initializes the first window +func myGUI() { + var w *gui.Node + gui.Config.Title = "Hello World golang wit/gui Window" + gui.Config.Width = 640 + gui.Config.Height = 480 + gui.Config.Exit = myExit + + w = gui.NewWindow() + addHelloWorld(w, "A Simple Tab") +} + +func addHelloWorld(window *gui.Node, title string) { + var newNode, g, tb *gui.Node + + newNode = window.NewTab(title) + + g = newNode.NewGroup("hello") + tb = g.NewTextbox("hello world box") // when debugging, this string will be used + tb.OnChanged = func(*gui.Node) { + s := tb.GetText() + log.Println("text box =", s) + } + tb.SetText("world") +} + +func myExit(n *gui.Node) { + log.Println("exit() here") + os.Exit(0) +} + |
