summaryrefslogtreecommitdiff
path: root/toolkit/andlabs/button.go
blob: d61c0ea4e00ca3bcbdf8773e2c1857b7a17c4009 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package main

import (
	"github.com/andlabs/ui"
	_ "github.com/andlabs/ui/winmanifest"
)

func (p *node) newButton(n *node) {
	log(debugToolkit, "newButton() START", n.Name)

	t := p.tk
	if (t == nil) {
		log(debugToolkit, "newButton() toolkit struct == nil. name=", n.Name)
		return
	}

	newt := new(andlabsT)

	b := ui.NewButton(n.Text)
	newt.uiButton = b
	newt.uiControl = b
	newt.parent = t

	b.OnClicked(func(*ui.Button) {
		n.doUserEvent()
	})

	n.tk = newt
	p.place(n)
	log(debugToolkit, "newButton() END", n.Name)
}