fix andlabs.ui.NewLabel()
Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
fbf97443d5
commit
a03d2f7c97
8
entry.go
8
entry.go
|
@ -3,8 +3,12 @@ package gui
|
||||||
import "log"
|
import "log"
|
||||||
// import "fmt"
|
// import "fmt"
|
||||||
|
|
||||||
|
import toolkit "git.wit.org/wit/gui/toolkit/andlabs"
|
||||||
|
|
||||||
import "github.com/andlabs/ui"
|
import "github.com/andlabs/ui"
|
||||||
import _ "github.com/andlabs/ui/winmanifest"
|
import _ "github.com/andlabs/ui/winmanifest"
|
||||||
|
|
||||||
|
|
||||||
import "github.com/davecgh/go-spew/spew"
|
import "github.com/davecgh/go-spew/spew"
|
||||||
|
|
||||||
// functions for handling text entry boxes
|
// functions for handling text entry boxes
|
||||||
|
@ -18,7 +22,9 @@ func (n *Node) NewLabel(text string) *Node {
|
||||||
newNode := makeNode(n, text, 333, 334)
|
newNode := makeNode(n, text, 333, 334)
|
||||||
newNode.Dump()
|
newNode.Dump()
|
||||||
|
|
||||||
n.Append(newNode)
|
t := toolkit.NewLabel(n.uiBox, text)
|
||||||
|
newNode.Toolkit = t
|
||||||
|
|
||||||
return newNode
|
return newNode
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,23 @@
|
||||||
|
package toolkit
|
||||||
|
|
||||||
|
import "log"
|
||||||
|
|
||||||
|
import "github.com/andlabs/ui"
|
||||||
|
import _ "github.com/andlabs/ui/winmanifest"
|
||||||
|
|
||||||
|
func NewLabel(b *ui.Box, name string) *Toolkit {
|
||||||
|
// make new node here
|
||||||
|
log.Println("gui.Toolbox.NewLabel", name)
|
||||||
|
var t Toolkit
|
||||||
|
|
||||||
|
if (b == nil) {
|
||||||
|
log.Println("gui.ToolboxNode.NewLabel() node.UiBox == nil. I can't add a range UI element without a place to put it")
|
||||||
|
return &t
|
||||||
|
}
|
||||||
|
l := ui.NewLabel(name)
|
||||||
|
t.uiLabel = l
|
||||||
|
t.uiBox = b
|
||||||
|
t.uiBox.Append(l, false)
|
||||||
|
|
||||||
|
return &t
|
||||||
|
}
|
|
@ -19,14 +19,15 @@ type Toolkit struct {
|
||||||
|
|
||||||
OnChanged func(*Toolkit)
|
OnChanged func(*Toolkit)
|
||||||
|
|
||||||
uiControl *ui.Control
|
uiBox *ui.Box
|
||||||
uiButton *ui.Button
|
uiButton *ui.Button
|
||||||
|
uiControl *ui.Control
|
||||||
|
uiLabel *ui.Label
|
||||||
uiSlider *ui.Slider
|
uiSlider *ui.Slider
|
||||||
uiSpinbox *ui.Spinbox
|
uiSpinbox *ui.Spinbox
|
||||||
uiWindow *ui.Window
|
|
||||||
uiTab *ui.Tab
|
uiTab *ui.Tab
|
||||||
uiBox *ui.Box
|
|
||||||
uiText *ui.EditableCombobox
|
uiText *ui.EditableCombobox
|
||||||
|
uiWindow *ui.Window
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *Toolkit) Value() int {
|
func (t *Toolkit) Value() int {
|
||||||
|
|
Loading…
Reference in New Issue