summaryrefslogtreecommitdiff
path: root/cmds/textbox
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2023-03-01 11:35:36 -0600
committerJeff Carr <[email protected]>2023-03-01 11:35:36 -0600
commit8dbf5a09097b7868e9218bf98716c57eac998a10 (patch)
treeab3bdfeaf5a59a55de9d2a6661d2d824090491e5 /cmds/textbox
parentf3bb68396afa7452ecf1c8d4744c825a9d81057c (diff)
lots cleaner code between the pluginv0.6.1
Queue() around SetText is helping userspace crashing merge forceDump(bool) into Dump() debugging output configuration is pretty clean keep cutting down duplicate things --gui-verbose flag works make label "standard" code add debug.FreeOSMemory() move the GO language internals to display in the GUI update push to do tags and go to github.com/wit-go/ remove the other license file it might be confusing golang.org and github proper WidgetType added a Quit() button Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'cmds/textbox')
-rw-r--r--cmds/textbox/main.go26
1 files changed, 16 insertions, 10 deletions
diff --git a/cmds/textbox/main.go b/cmds/textbox/main.go
index b260681..44431b7 100644
--- a/cmds/textbox/main.go
+++ b/cmds/textbox/main.go
@@ -11,8 +11,6 @@ import (
type LogOptions struct {
LogFile string
Verbose bool
- // GuiDebug bool `help:"open up the wit/gui Debugging Window"`
- // GuiDemo bool `help:"open the wit/gui Demo Window"`
User string `arg:"env:USER"`
}
@@ -45,11 +43,15 @@ func main() {
func initGUI() {
var w *gui.Node
gui.Config.Title = "Hello World"
- gui.Config.Width = 640
- gui.Config.Height = 480
+ gui.Config.Width = 642
+ gui.Config.Height = 481
gui.Config.Exit = myDefaultExit
w = gui.NewWindow()
+ w.Custom = func () {
+ log.Println("myDefaultExit(w)")
+ myDefaultExit(w)
+ }
w.Dump()
addDemoTab(w, "A Simple Tab Demo")
addDemoTab(w, "A Second Tab")
@@ -57,6 +59,9 @@ func initGUI() {
if (args.GuiDebug) {
gui.DebugWindow()
}
+ if (args.GuiVerbose) {
+ gui.SetDebug(true)
+ }
}
func addDemoTab(window *gui.Node, title string) {
@@ -71,18 +76,19 @@ func addDemoTab(window *gui.Node, title string) {
dd.AddDropdownName("more 1")
dd.AddDropdownName("more 2")
dd.AddDropdownName("more 3")
- dd.OnChanged = func(*gui.Node) {
- s := dd.GetText()
- tb.SetText("hello world " + args.User + "\n" + s)
- }
-
g2 = newNode.NewGroup("group 2")
tb = g2.NewTextbox("tb")
log.Println("tb =", tb.GetText())
- tb.OnChanged = func(*gui.Node) {
+ tb.Custom = func() {
s := tb.GetText()
log.Println("text =", s)
}
+
+ dd.Custom = func() {
+ s := dd.GetText()
+ log.Println("hello world " + args.User + "\n" + s + "\n")
+ tb.SetText("hello world " + args.User + "\n" + s + "\n")
+ }
}
func myDefaultExit(n *gui.Node) {