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 /cmds/helloworld/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 'cmds/helloworld/main.go')
| -rw-r--r-- | cmds/helloworld/main.go | 36 |
1 files changed, 8 insertions, 28 deletions
diff --git a/cmds/helloworld/main.go b/cmds/helloworld/main.go index 3ae3b07..552ecb5 100644 --- a/cmds/helloworld/main.go +++ b/cmds/helloworld/main.go @@ -1,44 +1,24 @@ -// This creates a simple hello world window +// This is a simple example package main import ( - "os" "log" "git.wit.org/wit/gui" ) func main() { - gui.Main(myGUI) + gui.Main(helloworld) } -// This initializes the first window -func myGUI() { +// This creates a window +func helloworld() { var w *gui.Node - gui.Config.Title = "Hello World golang wit/gui Window" + gui.Config.Title = "helloworld golang wit/gui window" gui.Config.Width = 640 gui.Config.Height = 480 - gui.Config.Exit = myExit w = gui.NewWindow() - addHelloWorld(w, "A Simple Tab") + w.NewButton("hello", func () { + log.Println("world") + }) } - -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) -} - |
