blob: 69a90027565db1560c0bcc8ff012f0091d94dafc (
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
33
34
35
36
37
38
39
40
|
package gui
import "log"
import "errors"
// import toolkit "git.wit.org/wit/gui/toolkit/andlabs"
// functions for handling text related GUI elements
func (n *Node) NewLabel(text string) *Node {
// make new node here
newNode := n.New(text)
newNode.Dump()
t := n.Toolkit.NewLabel(text)
newNode.Toolkit = t
return newNode
}
func (n *Node) SetText(value string) error {
log.Println("gui.SetText() value =", value)
if (n.Toolkit != nil) {
n.Toolkit.SetText(value)
return nil
}
if (n.uiText != nil) {
n.uiText.SetText(value)
return nil
}
if (n.uiButton != nil) {
n.uiButton.SetText(value)
return nil
}
if (n.uiWindow != nil) {
n.uiWindow.SetTitle(value)
return nil
}
return errors.New("nothing found for gui.Node.SetText()")
}
|