summaryrefslogtreecommitdiff
path: root/toolkit/andlabs/button.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2022-11-06 12:59:24 -0600
committerJeff Carr <[email protected]>2022-11-06 12:59:24 -0600
commite55fb6675d692e3f44fa67b02b12661e476bd028 (patch)
treec16084dea9779f5ef244adb3937d33adb17e7bad /toolkit/andlabs/button.go
parent099efb6b24caf9eaad50d7386636a7ac23552bde (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/andlabs/button.go')
-rw-r--r--toolkit/andlabs/button.go29
1 files changed, 21 insertions, 8 deletions
diff --git a/toolkit/andlabs/button.go b/toolkit/andlabs/button.go
index 4e6ff52..e0b7d97 100644
--- a/toolkit/andlabs/button.go
+++ b/toolkit/andlabs/button.go
@@ -1,7 +1,7 @@
package toolkit
import "log"
-import "os"
+// import "os"
import "github.com/andlabs/ui"
import _ "github.com/andlabs/ui/winmanifest"
@@ -11,15 +11,12 @@ func (t Toolkit) NewButton(name string) *Toolkit {
var newt Toolkit
var b *ui.Button
- if (t.uiBox == nil) {
- log.Println("gui.ToolboxNode.NewButton() node.UiBox == nil. I can't add a range UI element without a place to put it")
- log.Println("probably could just make a box here?")
- os.Exit(0)
+ if t.broken() {
return nil
}
if (DebugToolkit) {
- log.Println("gui.Toolbox.NewGroup() create", name)
+ log.Println("gui.Toolbox.NewButton() create", name)
}
b = ui.NewButton(name)
newt.uiButton = b
@@ -40,6 +37,7 @@ func (t Toolkit) NewButton(name string) *Toolkit {
log.Println("wit/gui/toolkit NewButton() toolkit.Custom() START")
}
newt.Custom()
+ return
if (DebugToolkit) {
log.Println("wit/gui/toolkit NewButton() toolkit.Custom() END")
}
@@ -53,14 +51,29 @@ func (t Toolkit) NewButton(name string) *Toolkit {
log.Println("wit/gui/toolkit NewButton() running parent toolkit.Custom() START (IS THIS A BAD IDEA?)")
}
t.Custom()
+ return
if (DebugToolkit) {
log.Println("wit/gui/toolkit NewButton() running parent toolkit.Custom() END (IS THIS A BAD IDEA?)")
}
}
- log.Println("TODO: LEFT TOOLKIT GOROUTINE button name =", name)
+ log.Println("TODO: LEFT TOOLKIT GOROUTINE WITH NOTHING TO DO button name =", name)
})
- t.uiBox.Append(b, stretchy)
+ if (DebugToolkit) {
+ log.Println("gui.Toolbox.NewButton() about to append to Box parent t:", name)
+ t.Dump()
+ log.Println("gui.Toolbox.NewButton() about to append to Box new t:", name)
+ newt.Dump()
+ }
+ if (t.uiBox != nil) {
+ t.uiBox.Append(b, stretchy)
+ } else if (t.uiWindow != nil) {
+ t.uiWindow.SetChild(b)
+ } else {
+ log.Println("ERROR: wit/gui andlabs couldn't place this button in a box or a window")
+ log.Println("ERROR: wit/gui andlabs couldn't place this button in a box or a window")
+ return &t
+ }
return &newt
}