2022-11-14 14:30:28 -06:00
|
|
|
package main
|
2022-10-19 13:23:22 -05:00
|
|
|
|
2023-02-25 14:05:25 -06:00
|
|
|
import (
|
|
|
|
"github.com/andlabs/ui"
|
|
|
|
_ "github.com/andlabs/ui/winmanifest"
|
|
|
|
)
|
2022-11-14 14:30:28 -06:00
|
|
|
|
2023-04-27 09:59:19 -05:00
|
|
|
func (p *node) newButton(n *node) {
|
|
|
|
log(debugToolkit, "newButton()", n.Name)
|
2022-10-19 13:23:22 -05:00
|
|
|
|
2023-04-27 09:59:19 -05:00
|
|
|
t := p.tk
|
2022-11-14 14:30:28 -06:00
|
|
|
if (t == nil) {
|
2023-04-27 09:59:19 -05:00
|
|
|
log(debugToolkit, "newButton() toolkit struct == nil. name=", n.Name)
|
2022-11-14 14:30:28 -06:00
|
|
|
return
|
2022-10-19 13:23:22 -05:00
|
|
|
}
|
|
|
|
|
2023-04-27 09:59:19 -05:00
|
|
|
newt := new(andlabsT)
|
2022-11-14 14:30:28 -06:00
|
|
|
|
2023-04-27 09:59:19 -05:00
|
|
|
b := ui.NewButton(n.Text)
|
2022-10-19 13:23:22 -05:00
|
|
|
newt.uiButton = b
|
2023-03-23 12:35:12 -05:00
|
|
|
newt.uiControl = b
|
2023-04-27 09:59:19 -05:00
|
|
|
newt.wId = n.WidgetId
|
|
|
|
newt.WidgetType = n.WidgetType
|
2023-03-01 11:35:36 -06:00
|
|
|
newt.parent = t
|
2022-10-19 13:23:22 -05:00
|
|
|
|
|
|
|
b.OnClicked(func(*ui.Button) {
|
2023-04-06 20:25:14 -05:00
|
|
|
newt.doUserEvent()
|
2022-10-19 13:23:22 -05:00
|
|
|
})
|
|
|
|
|
2023-04-27 09:59:19 -05:00
|
|
|
n.tk = newt
|
|
|
|
p.place(n)
|
2023-03-01 11:35:36 -06:00
|
|
|
}
|