summaryrefslogtreecommitdiff
path: root/toolkit/andlabs/button.go
blob: a6260b5e6b45411f81ae1783f4a9a18e27d17510 (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
package main

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

func (p *node) newButton(n *node) {
	log(debugToolkit, "newButton()", 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)
}