2022-10-16 10:09:16 -05:00
|
|
|
package toolkit
|
|
|
|
|
|
|
|
import "log"
|
2022-10-19 13:23:22 -05:00
|
|
|
import "os"
|
2022-10-16 10:09:16 -05:00
|
|
|
|
|
|
|
import "github.com/andlabs/ui"
|
|
|
|
import _ "github.com/andlabs/ui/winmanifest"
|
|
|
|
|
2022-10-19 13:23:22 -05:00
|
|
|
// func NewLabel(b *ui.Box, name string) *Toolkit {
|
|
|
|
|
|
|
|
func (t *Toolkit) NewLabel(name string) *Toolkit {
|
2022-10-16 10:09:16 -05:00
|
|
|
// make new node here
|
|
|
|
log.Println("gui.Toolbox.NewLabel", name)
|
|
|
|
|
2022-10-19 13:23:22 -05:00
|
|
|
if (t.uiBox == nil) {
|
2022-10-16 10:09:16 -05:00
|
|
|
log.Println("gui.ToolboxNode.NewLabel() node.UiBox == nil. I can't add a range UI element without a place to put it")
|
2022-10-19 13:23:22 -05:00
|
|
|
os.Exit(0)
|
|
|
|
return nil
|
2022-10-16 10:09:16 -05:00
|
|
|
}
|
2022-10-19 13:23:22 -05:00
|
|
|
var newt Toolkit
|
|
|
|
newt.uiLabel = ui.NewLabel(name)
|
|
|
|
newt.uiBox = t.uiBox
|
|
|
|
t.uiBox.Append(newt.uiLabel, false)
|
|
|
|
log.Println("parent toolkit")
|
|
|
|
t.Dump()
|
|
|
|
log.Println("newt toolkit")
|
|
|
|
newt.Dump()
|
|
|
|
// panic("got here")
|
2022-10-16 10:09:16 -05:00
|
|
|
|
2022-10-19 13:23:22 -05:00
|
|
|
return &newt
|
2022-10-16 10:09:16 -05:00
|
|
|
}
|