parent
a941c5a0f1
commit
6a0467f5a8
4
area.go
4
area.go
|
@ -119,8 +119,8 @@ func ShowTextBox(gw *GuiWindow, newText *ui.AttributedString) *GuiBox {
|
||||||
var gb *GuiBox
|
var gb *GuiBox
|
||||||
gb = new(GuiBox)
|
gb = new(GuiBox)
|
||||||
|
|
||||||
gb.EntryMap = make(map[string]*GuiEntry)
|
// gw.EntryMap = make(map[string]*GuiEntry)
|
||||||
gb.EntryMap["test"] = nil
|
// gw.EntryMap["test"] = nil
|
||||||
|
|
||||||
newbox := ui.NewVerticalBox()
|
newbox := ui.NewVerticalBox()
|
||||||
newbox.SetPadded(true)
|
newbox.SetPadded(true)
|
||||||
|
|
40
gui.go
40
gui.go
|
@ -84,8 +84,8 @@ func AddTableTab(gw *GuiWindow, name string, rowcount int, parts []TableColumnDa
|
||||||
var gb *GuiBox
|
var gb *GuiBox
|
||||||
gb = new(GuiBox)
|
gb = new(GuiBox)
|
||||||
|
|
||||||
gb.EntryMap = make(map[string]*GuiEntry)
|
// gb.EntryMap = make(map[string]*GuiEntry)
|
||||||
gb.EntryMap["test"] = nil
|
// gb.EntryMap["test"] = nil
|
||||||
|
|
||||||
vbox := ui.NewVerticalBox()
|
vbox := ui.NewVerticalBox()
|
||||||
vbox.SetPadded(true)
|
vbox.SetPadded(true)
|
||||||
|
@ -214,17 +214,17 @@ func GetText(box *GuiBox, name string) string {
|
||||||
log.Println("gui.GetText() ERROR box == nil")
|
log.Println("gui.GetText() ERROR box == nil")
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
if (box.EntryMap == nil) {
|
if (box.Window.EntryMap == nil) {
|
||||||
log.Println("gui.GetText() ERROR b.Box.EntryMap == nil")
|
log.Println("gui.GetText() ERROR b.Box.Window.EntryMap == nil")
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
spew.Dump(box.EntryMap)
|
spew.Dump(box.Window.EntryMap)
|
||||||
if (box.EntryMap[name] == nil) {
|
if (box.Window.EntryMap[name] == nil) {
|
||||||
log.Println("gui.GetText() ERROR box.EntryMap[", name, "] == nil ")
|
log.Println("gui.GetText() ERROR box.Window.EntryMap[", name, "] == nil ")
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
e := box.EntryMap[name]
|
e := box.Window.EntryMap[name]
|
||||||
log.Println("gui.GetText() box.EntryMap[", name, "] = ", e.UiEntry.Text())
|
log.Println("gui.GetText() box.Window.EntryMap[", name, "] = ", e.UiEntry.Text())
|
||||||
log.Println("gui.GetText() END")
|
log.Println("gui.GetText() END")
|
||||||
return e.UiEntry.Text()
|
return e.UiEntry.Text()
|
||||||
}
|
}
|
||||||
|
@ -233,17 +233,17 @@ func SetText(box *GuiBox, name string, value string) error {
|
||||||
if (box == nil) {
|
if (box == nil) {
|
||||||
return fmt.Errorf("gui.SetText() ERROR box == nil")
|
return fmt.Errorf("gui.SetText() ERROR box == nil")
|
||||||
}
|
}
|
||||||
if (box.EntryMap == nil) {
|
if (box.Window.EntryMap == nil) {
|
||||||
return fmt.Errorf("gui.SetText() ERROR b.Box.EntryMap == nil")
|
return fmt.Errorf("gui.SetText() ERROR b.Box.Window.EntryMap == nil")
|
||||||
}
|
}
|
||||||
spew.Dump(box.EntryMap)
|
spew.Dump(box.Window.EntryMap)
|
||||||
if (box.EntryMap[name] == nil) {
|
if (box.Window.EntryMap[name] == nil) {
|
||||||
return fmt.Errorf("gui.SetText() ERROR box.EntryMap[", name, "] == nil ")
|
return fmt.Errorf("gui.SetText() ERROR box.Window.EntryMap[", name, "] == nil ")
|
||||||
}
|
}
|
||||||
e := box.EntryMap[name]
|
e := box.Window.EntryMap[name]
|
||||||
log.Println("gui.SetText() box.EntryMap[", name, "] = ", e.UiEntry.Text())
|
log.Println("gui.SetText() box.Window.EntryMap[", name, "] = ", e.UiEntry.Text())
|
||||||
e.UiEntry.SetText(value)
|
e.UiEntry.SetText(value)
|
||||||
log.Println("gui.SetText() box.EntryMap[", name, "] = ", e.UiEntry.Text())
|
log.Println("gui.SetText() box.Window.EntryMap[", name, "] = ", e.UiEntry.Text())
|
||||||
log.Println("gui.SetText() END")
|
log.Println("gui.SetText() END")
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -295,7 +295,7 @@ func AddEntry(box *GuiBox, name string) *GuiEntry {
|
||||||
box.UiBox.Append(ue, false)
|
box.UiBox.Append(ue, false)
|
||||||
|
|
||||||
ge.UiEntry = ue
|
ge.UiEntry = ue
|
||||||
box.EntryMap[name] = ge
|
box.Window.EntryMap[name] = ge
|
||||||
|
|
||||||
return ge
|
return ge
|
||||||
}
|
}
|
||||||
|
@ -344,8 +344,8 @@ func AddGenericBox(gw *GuiWindow) *GuiBox {
|
||||||
var gb *GuiBox
|
var gb *GuiBox
|
||||||
gb = new(GuiBox)
|
gb = new(GuiBox)
|
||||||
|
|
||||||
gb.EntryMap = make(map[string]*GuiEntry)
|
// gb.EntryMap = make(map[string]*GuiEntry)
|
||||||
gb.EntryMap["test"] = nil
|
// gb.EntryMap["test"] = nil
|
||||||
|
|
||||||
vbox := ui.NewVerticalBox()
|
vbox := ui.NewVerticalBox()
|
||||||
vbox.SetPadded(true)
|
vbox.SetPadded(true)
|
||||||
|
|
54
misc.go
54
misc.go
|
@ -40,16 +40,17 @@ func AddMainTab(gw *GuiWindow) *GuiBox {
|
||||||
log.Println("ShowMainTab() gw =", gw)
|
log.Println("ShowMainTab() gw =", gw)
|
||||||
log.Println("ShowMainTab() gw.UiTab =", gw.UiTab)
|
log.Println("ShowMainTab() gw.UiTab =", gw.UiTab)
|
||||||
|
|
||||||
newWindow := new(GuiWindow)
|
window := InitGuiWindow(Data.Config, "MAIN", nil, gw.UiWindow, gw.UiTab)
|
||||||
newWindow.UiWindow = gw.UiWindow
|
// newWindow := new(GuiWindow)
|
||||||
Data.Windows = append(Data.Windows, newWindow)
|
// newWindow.UiWindow = gw.UiWindow
|
||||||
|
// Data.Windows = append(Data.Windows, newWindow)
|
||||||
|
|
||||||
var box *GuiBox
|
var box *GuiBox
|
||||||
box = new(GuiBox)
|
box = new(GuiBox)
|
||||||
box.Window = gw
|
box.Window = window
|
||||||
|
|
||||||
box.EntryMap = make(map[string]*GuiEntry)
|
// box.EntryMap = make(map[string]*GuiEntry)
|
||||||
box.EntryMap["test"] = nil
|
// box.EntryMap["test"] = nil
|
||||||
|
|
||||||
hbox := ui.NewHorizontalBox()
|
hbox := ui.NewHorizontalBox()
|
||||||
hbox.SetPadded(true)
|
hbox.SetPadded(true)
|
||||||
|
@ -75,28 +76,49 @@ func ShowMainTabShowBox(gw *GuiWindow, box *GuiBox) {
|
||||||
gw.UiTab.SetMargined(0, true)
|
gw.UiTab.SetMargined(0, true)
|
||||||
}
|
}
|
||||||
|
|
||||||
func StartNewWindow(c *pb.Config, bg bool, action string, maketab func(*GuiWindow) *GuiBox) {
|
func InitGuiWindow(c *pb.Config, action string, maketab func(*GuiWindow) *GuiBox, uiW *ui.Window, uiT *ui.Tab) *GuiWindow {
|
||||||
log.Println("InitNewWindow() Create a new window")
|
log.Println("InitGuiWindow() START")
|
||||||
var newGuiWindow GuiWindow
|
var newGuiWindow GuiWindow
|
||||||
newGuiWindow.Width = int(c.Width)
|
newGuiWindow.Width = int(c.Width)
|
||||||
newGuiWindow.Height = int(c.Height)
|
newGuiWindow.Height = int(c.Height)
|
||||||
newGuiWindow.Action = action
|
newGuiWindow.Action = action
|
||||||
newGuiWindow.MakeWindow = maketab
|
newGuiWindow.MakeWindow = maketab
|
||||||
newGuiWindow.BoxMap = make(map[string]*GuiBox)
|
newGuiWindow.UiWindow = uiW
|
||||||
|
newGuiWindow.UiTab = uiT
|
||||||
|
newGuiWindow.BoxMap = make(map[string]*GuiBox)
|
||||||
|
newGuiWindow.EntryMap = make(map[string]*GuiEntry)
|
||||||
|
newGuiWindow.EntryMap["test"] = nil
|
||||||
Data.Windows = append(Data.Windows, &newGuiWindow)
|
Data.Windows = append(Data.Windows, &newGuiWindow)
|
||||||
|
|
||||||
// make(newGuiWindow.BoxMap)
|
log.Println("InitGuiWindow() END *GuiWindow =", &newGuiWindow)
|
||||||
|
return &newGuiWindow
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
func StartNewWindow(c *pb.Config, bg bool, action string, maketab func(*GuiWindow) *GuiBox) {
|
||||||
|
log.Println("InitNewWindow() Create a new window")
|
||||||
|
window := InitGuiWindow(c, action, maketab, nil, nil)
|
||||||
|
/*
|
||||||
|
newGuiWindow.Width = int(c.Width)
|
||||||
|
newGuiWindow.Height = int(c.Height)
|
||||||
|
newGuiWindow.Action = action
|
||||||
|
newGuiWindow.MakeWindow = maketab
|
||||||
|
newGuiWindow.BoxMap = make(map[string]*GuiBox)
|
||||||
|
newGuiWindow.EntryMap = make(map[string]*GuiEntry)
|
||||||
|
newGuiWindow.EntryMap["test"] = nil
|
||||||
|
Data.Windows = append(Data.Windows, &newGuiWindow)
|
||||||
|
*/
|
||||||
|
|
||||||
if (bg) {
|
if (bg) {
|
||||||
log.Println("ShowWindow() IN NEW GOROUTINE")
|
log.Println("ShowWindow() IN NEW GOROUTINE")
|
||||||
go ui.Main(func() {
|
go ui.Main(func() {
|
||||||
InitTabWindow(&newGuiWindow)
|
InitTabWindow(window)
|
||||||
})
|
})
|
||||||
time.Sleep(2000 * time.Millisecond)
|
time.Sleep(2000 * time.Millisecond)
|
||||||
} else {
|
} else {
|
||||||
log.Println("ShowWindow() WAITING for ui.Main()")
|
log.Println("ShowWindow() WAITING for ui.Main()")
|
||||||
ui.Main(func() {
|
ui.Main(func() {
|
||||||
InitTabWindow(&newGuiWindow)
|
InitTabWindow(window)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -119,9 +119,11 @@ type GuiButton struct {
|
||||||
FB *ui.FontButton
|
FB *ui.FontButton
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GuiBox is any type of ui.Hbox or ui.Vbox
|
||||||
|
// There can be lots of these for each GuiWindow
|
||||||
type GuiBox struct {
|
type GuiBox struct {
|
||||||
Window *GuiWindow
|
Window *GuiWindow
|
||||||
EntryMap map[string]*GuiEntry
|
// EntryMap map[string]*GuiEntry
|
||||||
|
|
||||||
// andlabs/ui abstraction mapping
|
// andlabs/ui abstraction mapping
|
||||||
UiBox *ui.Box
|
UiBox *ui.Box
|
||||||
|
|
Loading…
Reference in New Issue