diff options
| author | Jeff Carr <[email protected]> | 2021-10-05 07:13:24 -0500 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2021-10-05 07:13:24 -0500 |
| commit | b036f9fccbf6b20ec510a54c892c3ee2a166b6f1 (patch) | |
| tree | 063c92906ce5c3d784115739f8127daad472ffb7 | |
| parent | fe29a06f3b81b573905da65737b33e6515558211 (diff) | |
DEBUG: added button to SetMargin() by name
Signed-off-by: Jeff Carr <[email protected]>
| -rw-r--r-- | debug.go | 1 | ||||
| -rw-r--r-- | structs.go | 2 | ||||
| -rw-r--r-- | window-debug.go | 34 |
3 files changed, 34 insertions, 3 deletions
@@ -41,6 +41,7 @@ func DumpBoxes() { log.Println("gui.DumpBoxes()\tWindow.name =", window.Name) // log.Println("gui.DumpBoxes()\tWindow.UiWindow type =", reflect.TypeOf(window.UiWindow)) log.Println("gui.DumpBoxes()\tWindow.UiWindow =", window.UiWindow) + log.Println("gui.DumpBoxes()\tWindow.UiTab =", window.UiTab) for name, abox := range window.BoxMap { log.Printf("gui.DumpBoxes() \tBOX mapname=%-12s abox.Name=%-12s", name, abox.Name) if (name == "MAINBOX") { @@ -177,7 +177,7 @@ func tabSetMargined(tab *ui.Tab) { c := tab.NumPages() for i := 0; i < c; i++ { log.Println("tabSetMargined() i =", i) - tab.SetMargined(i, true) + // tab.SetMargined(i, true) } } diff --git a/window-debug.go b/window-debug.go index 553d74c..7702da3 100644 --- a/window-debug.go +++ b/window-debug.go @@ -37,6 +37,7 @@ func makeWindowDebug() ui.Control { ///////////////////////////////////////////////////// vbox = addGroup(hbox, "Buttons") + b1 := addButton(vbox, "dumpBox(name)") b1.OnClicked(func(*ui.Button) { x := cbox.Selected() @@ -44,9 +45,28 @@ func makeWindowDebug() ui.Control { log.Println("names[x] =", names[x]) dumpBox(names[x]) }) - b2 := addButton(vbox, "something 2") + + b2 := addButton(vbox, "SetMargined()") b2.OnClicked(func(*ui.Button) { - log.Println("Should do something here b2") + x := cbox.Selected() + log.Println("x =", x) + log.Println("findBox; names[x] =", names[x]) + findBox(names[x]) + gw := findBox(names[x]) + if (gw == nil) { + return + } + if (gw.UiTab == nil) { + return + } + if (gw.TabNumber == nil) { + return + } + scs := spew.ConfigState{MaxDepth: 1} + scs.Dump(gw) + log.Println("gui.DumpBoxes()\tWindow.UiTab =", gw.UiTab) + log.Println("gui.DumpBoxes()\tWindow.TabNumber =", *gw.TabNumber) + gw.UiTab.SetMargined(*gw.TabNumber, true) }) return hbox @@ -72,6 +92,15 @@ func addGroup(b *ui.Box, name string) *ui.Box { return vbox } +func findBox(s string) *GuiWindow { + for name, window := range Data.WindowMap { + if (name == s) { + return window + } + } + return nil +} + func dumpBox(s string) { for name, window := range Data.WindowMap { if (name != s) { @@ -86,6 +115,7 @@ func dumpBox(s string) { log.Println("gui.DumpBoxes()\tWindow.name =", window.Name) // log.Println("gui.DumpBoxes()\tWindow.UiWindow type =", reflect.TypeOf(window.UiWindow)) log.Println("gui.DumpBoxes()\tWindow.UiWindow =", window.UiWindow) + log.Println("gui.DumpBoxes()\tWindow.UiTab =", window.UiTab) for name, abox := range window.BoxMap { log.Printf("gui.DumpBoxes() \tBOX mapname=%-12s abox.Name=%-12s", name, abox.Name) if (name == "MAINBOX") { |
