diff options
| author | Jeff Carr <[email protected]> | 2023-04-27 09:59:19 -0500 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2023-04-27 09:59:19 -0500 |
| commit | 6e52d306bf6fe15d00108b305b497a9722f491ca (patch) | |
| tree | fea0f4ea1dcfde8442fab2450a681638d7f5663a | |
| parent | a0d0a93f7f7131f6ef50ebbe4bad9a57f2e1245d (diff) | |
andlabs: button in binary tree
Signed-off-by: Jeff Carr <[email protected]>
| -rw-r--r-- | toolkit/andlabs/add.go | 2 | ||||
| -rw-r--r-- | toolkit/andlabs/button.go | 24 |
2 files changed, 11 insertions, 15 deletions
diff --git a/toolkit/andlabs/add.go b/toolkit/andlabs/add.go index 95a637a..bca7aa9 100644 --- a/toolkit/andlabs/add.go +++ b/toolkit/andlabs/add.go @@ -39,7 +39,7 @@ func add(a toolkit.Action) { newLabel(&a) return case toolkit.Button: - newButton(&a) + p.newButton(n) return case toolkit.Grid: newGrid(&a) diff --git a/toolkit/andlabs/button.go b/toolkit/andlabs/button.go index f4032d0..b3eae7b 100644 --- a/toolkit/andlabs/button.go +++ b/toolkit/andlabs/button.go @@ -3,34 +3,30 @@ package main import ( "github.com/andlabs/ui" _ "github.com/andlabs/ui/winmanifest" - - "git.wit.org/wit/gui/toolkit" ) -func newButton(a *toolkit.Action) { - var t, newt *andlabsT - var b *ui.Button - log(debugToolkit, "newButton()", a.Name) +func (p *node) newButton(n *node) { + log(debugToolkit, "newButton()", n.Name) - t = andlabs[a.ParentId] + t := p.tk if (t == nil) { - log(debugToolkit, "newButton() toolkit struct == nil. name=", a.Name) + log(debugToolkit, "newButton() toolkit struct == nil. name=", n.Name) return } - newt = new(andlabsT) + newt := new(andlabsT) - b = ui.NewButton(a.Text) + b := ui.NewButton(n.Text) newt.uiButton = b newt.uiControl = b - newt.wId = a.WidgetId - newt.WidgetType = a.WidgetType + newt.wId = n.WidgetId + newt.WidgetType = n.WidgetType newt.parent = t - place(a, t, newt) - b.OnClicked(func(*ui.Button) { newt.doUserEvent() }) + n.tk = newt + p.place(n) } |
