diff options
| author | Jeff Carr <[email protected]> | 2022-10-19 13:23:22 -0500 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2022-10-19 13:23:22 -0500 |
| commit | f3af1f5b7ff78b3f73d7510622fc9633dec36d35 (patch) | |
| tree | e4868584d5e19942938aaa122b2e1cab377db000 /toolkit/andlabs/group.go | |
| parent | f7b1036e544238d65b0e3ad46d08075aa4177032 (diff) | |
Refactor to 'gui/toolkit/'
* add a example cmds/consolemouse
uses a console button to launch the andlabs/ui
* fix wrong return value in toolkit/NewLabel()
* redirect STDIN output to a file
* wonderful fix of Window() exit
* finally remove the ancient stupid variables x & y
* phase out struct 'box' and use 'node' instead
* better names for things: use NewFoo() and NewBar()
Diffstat (limited to 'toolkit/andlabs/group.go')
| -rw-r--r-- | toolkit/andlabs/group.go | 60 |
1 files changed, 19 insertions, 41 deletions
diff --git a/toolkit/andlabs/group.go b/toolkit/andlabs/group.go index 1c3f63e..12d9206 100644 --- a/toolkit/andlabs/group.go +++ b/toolkit/andlabs/group.go @@ -1,59 +1,37 @@ package toolkit import "log" +import "os" import "github.com/andlabs/ui" import _ "github.com/andlabs/ui/winmanifest" // make new Group here -func NewGroup(b *ui.Box, title string) *Toolkit { - var t Toolkit +func (t Toolkit) NewGroup(title string) *Toolkit { + var newt Toolkit - if (b == nil) { - log.Println("gui.ToolboxNode.NewSpinbox() node.UiBox == nil. I can't add a range UI element without a place to put it") - return &t + if (t.uiBox == nil) { + log.Println("gui.ToolboxNode.NewGroup() 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) + return nil } log.Println("gui.Toolbox.NewGroup() create", title) g := ui.NewGroup(title) g.SetMargined(true) - t.uiGroup = g - t.uiBox = b - t.uiBox.Append(g, false) + t.uiBox.Append(g, streachy) - return &t -} - -// create a new box -func (t *Toolkit) GetBox() *ui.Box { - return t.uiBox -} - -// create a new box -func (t *Toolkit) NewBox() *Toolkit { - log.Println("gui.Toolbox.NewBox() START create default") - if (t.uiGroup != nil) { - log.Println("gui.Toolbox.NewBox() is a Group") - var newTK Toolkit + hbox := ui.NewVerticalBox() + hbox.SetPadded(true) + g.SetChild(hbox) - vbox := ui.NewVerticalBox() - vbox.SetPadded(true) - t.uiGroup.SetChild(vbox) - newTK.uiBox = vbox + newt.uiGroup = g + newt.uiBox = hbox + newt.Name = title - return &newTK - } - log.Println("gui.Toolbox.NewBox() FAILED") - return nil + t.Dump() + newt.Dump() + // panic("toolkit.NewGroup") + return &newt } - -/* -func (n *Node) NewGroup(title string) *Node { - group := ui.NewGroup(title) - group.SetMargined(true) - hbox.Append(group, true) - - vbox := ui.NewVerticalBox() - vbox.SetPadded(true) - group.SetChild(vbox) -*/ |
