debian/andlabs/button.go

29 lines
494 B
Go
Raw Normal View History

2024-01-01 16:11:54 -06:00
package main
import (
"go.wit.com/gui/toolkits/tree"
"go.wit.com/dev/andlabs/ui"
_ "go.wit.com/dev/andlabs/ui/winmanifest"
2024-01-01 16:11:54 -06:00
)
// func (p *node) newButton(n *node) {
func newButton(p *tree.Node, n *tree.Node) {
if notNew(n) { return }
var ptk *guiWidget
ptk = p.TK.(*guiWidget)
2024-01-01 16:11:54 -06:00
newt := new(guiWidget)
b := ui.NewButton(n.GetLabel())
2024-01-01 16:11:54 -06:00
newt.uiButton = b
newt.uiControl = b
newt.parent = ptk
2024-01-01 16:11:54 -06:00
b.OnClicked(func(*ui.Button) {
me.myTree.DoUserEvent(n)
2024-01-01 16:11:54 -06:00
})
n.TK = newt
place(p, n)
2024-01-01 16:11:54 -06:00
}