diff options
| author | Jeff Carr <[email protected]> | 2022-11-14 14:30:28 -0600 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2022-11-14 14:30:28 -0600 |
| commit | 355e5ec968427c2b07b78fec12224f31a65df740 (patch) | |
| tree | 99754f9f6888c166a435d14e3a71cc9304f14970 /toolkit/andlabs-direct/button.go | |
| parent | 207cf7ea16f1da8fa9f893504d77a2856298cc22 (diff) | |
setup building without plugins on windowsv0.5.1
notes from github remote
keep removing os.Exit()
rename from andlabs2 back to andlabs
rename files for windows andlabs/ui
gocui always sets STDOUT a file in /tmp/
Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'toolkit/andlabs-direct/button.go')
| -rw-r--r-- | toolkit/andlabs-direct/button.go | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/toolkit/andlabs-direct/button.go b/toolkit/andlabs-direct/button.go new file mode 100644 index 0000000..e0b7d97 --- /dev/null +++ b/toolkit/andlabs-direct/button.go @@ -0,0 +1,79 @@ +package toolkit + +import "log" +// import "os" + +import "github.com/andlabs/ui" +import _ "github.com/andlabs/ui/winmanifest" + +// make new Group here +func (t Toolkit) NewButton(name string) *Toolkit { + var newt Toolkit + var b *ui.Button + + if t.broken() { + return nil + } + + if (DebugToolkit) { + log.Println("gui.Toolbox.NewButton() create", name) + } + b = ui.NewButton(name) + newt.uiButton = b + + b.OnClicked(func(*ui.Button) { + log.Println("TODO: IN TOOLKIT GOROUTINE. SHOULD LEAVE HERE VIA channels. button name =", name) + t.Dump() + newt.Dump() + if (DebugToolkit) { + log.Println("wit/gui/toolkit NewButton() Should do something here") + } + if (newt.Custom == nil) { + if (DebugToolkit) { + log.Println("wit/gui/toolkit NewButton() toolkit.Custom == nil") + } + } else { + if (DebugToolkit) { + log.Println("wit/gui/toolkit NewButton() toolkit.Custom() START") + } + newt.Custom() + return + if (DebugToolkit) { + log.Println("wit/gui/toolkit NewButton() toolkit.Custom() END") + } + } + if (t.Custom == nil) { + if (DebugToolkit) { + log.Println("wit/gui/toolkit NewButton() parent toolkit.Custom == nil") + } + } else { + if (DebugToolkit) { + 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 WITH NOTHING TO DO button name =", name) + }) + + 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 +} |
