summaryrefslogtreecommitdiff
path: root/toolkit/andlabs/button.go
blob: b3eae7b3fb3c48acae2f6364f951e60dcd5028fc (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
32
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.wId = n.WidgetId
	newt.WidgetType = n.WidgetType
	newt.parent = t

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

	n.tk = newt
	p.place(n)
}