NODE: still in the rabbit hole
Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
15f9f92c62
commit
c91f91b0d6
|
@ -51,7 +51,7 @@ func guiButtonClick(button *GuiButton) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *Node) CreateButton(custom func(*GuiButton), name string, values interface {}) *Node {
|
func (n *Node) CreateButton(custom func(*GuiButton), name string, values interface {}) *Node {
|
||||||
newNode := n.AddBox(Xaxis, "test")
|
newNode := n.AddBox(Xaxis, "test CreateButton")
|
||||||
box := newNode.FindBox()
|
box := newNode.FindBox()
|
||||||
if (box == nil) {
|
if (box == nil) {
|
||||||
panic("node.CreateButton().FindBox() == nil")
|
panic("node.CreateButton().FindBox() == nil")
|
||||||
|
@ -66,6 +66,9 @@ func (n *Node) CreateButton(custom func(*GuiButton), name string, values interfa
|
||||||
log.Println("CreateButton() box.Window == nil")
|
log.Println("CreateButton() box.Window == nil")
|
||||||
// ErrorWindow(box.Window, "Login Failed", msg) // can't even do this
|
// ErrorWindow(box.Window, "Login Failed", msg) // can't even do this
|
||||||
panic("maybe print an error and return nil? or make a fake button?")
|
panic("maybe print an error and return nil? or make a fake button?")
|
||||||
|
} else {
|
||||||
|
// uibox := box.UiBox
|
||||||
|
// uibox.Append(newUiB, true)
|
||||||
}
|
}
|
||||||
newB.Box = box
|
newB.Box = box
|
||||||
newB.Custom = custom
|
newB.Custom = custom
|
||||||
|
|
27
structs.go
27
structs.go
|
@ -125,23 +125,23 @@ type GuiBox struct {
|
||||||
UiBox *ui.Box
|
UiBox *ui.Box
|
||||||
}
|
}
|
||||||
|
|
||||||
func (gb *GuiBox) Dump() {
|
func (b *GuiBox) Dump() {
|
||||||
log.Println("gui.GuiBox.Dump() Name = ", gb.Name)
|
log.Println("gui.GuiBox.Dump() Name = ", b.Name)
|
||||||
log.Println("gui.GuiBox.Dump() Axis = ", gb.Axis)
|
log.Println("gui.GuiBox.Dump() Axis = ", b.Axis)
|
||||||
log.Println("gui.GuiBox.Dump() GuiWindow = ", gb.Window)
|
log.Println("gui.GuiBox.Dump() GuiWindow = ", b.Window)
|
||||||
log.Println("gui.GuiBox.Dump() node = ", gb.node)
|
log.Println("gui.GuiBox.Dump() node = ", b.node)
|
||||||
log.Println("gui.GuiBox.Dump() UiBox = ", gb.UiBox)
|
log.Println("gui.GuiBox.Dump() UiBox = ", b.UiBox)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s GuiBox) SetTitle(title string) {
|
func (b *GuiBox) SetTitle(title string) {
|
||||||
log.Println("DID IT!", title)
|
log.Println("DID IT!", title)
|
||||||
if s.Window == nil {
|
if b.Window == nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if s.Window.UiWindow == nil {
|
if b.Window.UiWindow == nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
s.Window.UiWindow.SetTitle(title)
|
b.Window.UiWindow.SetTitle(title)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -169,11 +169,12 @@ func (b *GuiBox) SetNode(n *Node) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s GuiBox) Append(child ui.Control, x bool) {
|
func (b *GuiBox) Append(child ui.Control, x bool) {
|
||||||
if s.UiBox == nil {
|
if b.UiBox == nil {
|
||||||
|
panic("GuiBox.Append() can't work. UiBox == nil")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
s.UiBox.Append(child, x)
|
b.UiBox.Append(child, x)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Note: every mouse click is handled
|
// Note: every mouse click is handled
|
||||||
|
|
29
window.go
29
window.go
|
@ -183,34 +183,6 @@ func (n *Node) uiNewWindow(title string, x int, y int) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
func CreateBlankWindow(title string, x int, y int) *Node {
|
|
||||||
node := mapWindow(nil, nil, title, x, y)
|
|
||||||
box := node.box
|
|
||||||
log.Println("gui.CreateBlankWindow() title = box.Name =", box.Name)
|
|
||||||
|
|
||||||
node.uiNewWindow(box.Name, x, y)
|
|
||||||
window := node.uiWindow
|
|
||||||
|
|
||||||
ui.OnShouldQuit(func() bool {
|
|
||||||
log.Println("createWindow().Destroy()", box.Name)
|
|
||||||
window.Destroy()
|
|
||||||
return true
|
|
||||||
})
|
|
||||||
|
|
||||||
box.Window.UiWindow = window
|
|
||||||
return node
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
func (n *Node) initBlankWindow() ui.Control {
|
|
||||||
hbox := ui.NewHorizontalBox()
|
|
||||||
hbox.SetPadded(true)
|
|
||||||
|
|
||||||
return hbox
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
func makeBlankNode(title string) *Node {
|
func makeBlankNode(title string) *Node {
|
||||||
log.Println("gui.makeBlankNode() title =", title)
|
log.Println("gui.makeBlankNode() title =", title)
|
||||||
if Data.NodeMap[title] != nil {
|
if Data.NodeMap[title] != nil {
|
||||||
|
@ -226,6 +198,7 @@ func makeBlankNode(title string) *Node {
|
||||||
node := makeNode(nil, title, x, y)
|
node := makeNode(nil, title, x, y)
|
||||||
return node
|
return node
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
func mapWindow(parent *Node, window *ui.Window, title string, x int, y int) *Node {
|
func mapWindow(parent *Node, window *ui.Window, title string, x int, y int) *Node {
|
||||||
log.Println("gui.WindowMap START title =", title)
|
log.Println("gui.WindowMap START title =", title)
|
||||||
|
|
Loading…
Reference in New Issue