diff options
| author | Jeff Carr <[email protected]> | 2023-03-24 20:14:18 -0500 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2023-03-24 20:14:18 -0500 |
| commit | 6f91f5e080e06cdc0f34b13d23e5fd16ea37259a (patch) | |
| tree | 7037a36829c644dccc7cb78ee6f87f87f88aed21 /toolkit/andlabs/tab.go | |
| parent | d4787a1ebdd08359746516dbb72f1feaf95be5b6 (diff) | |
starting to try safe chan and goroutines
fix tab title's
right before attempting to add chan goroutines
removed "where" widget pointer
box added to tab
experiement with log as it's own repo
Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'toolkit/andlabs/tab.go')
| -rw-r--r-- | toolkit/andlabs/tab.go | 73 |
1 files changed, 33 insertions, 40 deletions
diff --git a/toolkit/andlabs/tab.go b/toolkit/andlabs/tab.go index b0920ac..c28b403 100644 --- a/toolkit/andlabs/tab.go +++ b/toolkit/andlabs/tab.go @@ -19,36 +19,43 @@ import ( once there is one. If you send a Window here, it will replace any existing tabs rather than adding a new one */ -func (t *andlabsT) newTab(name string) *andlabsT { +func (t *andlabsT) newTab(a *toolkit.Action) { // var w *ui.Window var newt *andlabsT - log(debugToolkit, "gui.toolkit.AddTab()") - - if (t.uiWindow == nil) { - log(debugToolkit, "gui.Toolkit.UiWindow == nil. I can't add a toolbar without window") - return nil - } + log(debugToolkit, "newTab() START", a.WidgetId, a.WhereId) if (t.uiTab == nil) { + if (t.uiWindow == nil) { + log(debugToolkit, "newTab() uiWindow == nil. I can't add a toolbar without window", a.WidgetId, a.WhereId) + return + } // this means you have to make a new tab - log(debugToolkit, "gui.toolkit.NewTab() GOOD. This should be the first tab:", name) - newt = rawTab(t.uiWindow, name) + log(debugToolkit, "newTab() GOOD. This should be the first tab:", a.WidgetId, a.WhereId) + newt = rawTab(t.uiWindow, a.Title) t.uiTab = newt.uiTab } else { // this means you have to append a tab - log(debugToolkit, "gui.toolkit.NewTab() GOOD. This should be an additional tab:", name) - newt = t.appendTab(name) + log(debugToolkit, "newTab() GOOD. This should be an additional tab:", a.WidgetId, a.WhereId) + newt = t.appendTab(a.Title) } - newt.Name = name + // add the structure to the array + if (andlabs[a.WidgetId] == nil) { + log(logInfo, "newTab() MAPPED", a.WidgetId, a.WhereId) + andlabs[a.WidgetId] = newt + newt.Type = a.Widget.Type + } else { + log(debugError, "newTab() DO WHAT?", a.WidgetId, a.WhereId) + log(debugError, "THIS IS BAD") + } + + newt.Name = a.Title log(debugToolkit, "t:") t.Dump(debugToolkit) log(debugToolkit, "newt:") newt.Dump(debugToolkit) - - return newt } // This sets _all_ the tabs to Margin = true @@ -64,29 +71,21 @@ func tabSetMargined(tab *ui.Tab, b bool) { func rawTab(w *ui.Window, name string) *andlabsT { var newt andlabsT - log(debugToolkit, "gui.toolkit.NewTab() ADD", name) + log(debugToolkit, "rawTab() START", name) if (w == nil) { - log(debugToolkit, "gui.toolkit.NewTab() node.UiWindow == nil. I can't add a tab without a window") - log(debugToolkit, "gui.toolkit.NewTab() node.UiWindow == nil. I can't add a tab without a window") - log(debugToolkit, "gui.toolkit.NewTab() node.UiWindow == nil. I can't add a tab without a window") + log(debugError, "UiWindow == nil. I can't add a tab without a window") + log(debugError, "UiWindow == nil. I can't add a tab without a window") + log(debugError, "UiWindow == nil. I can't add a tab without a window") sleep(1) return nil } - log(debugToolkit, "gui.toolkit.AddTab() START name =", name) - tab := ui.NewTab() - w.SetMargined(margin) - hbox := ui.NewHorizontalBox() // this makes everything go along the horizon - hbox.SetPadded(padded) - tab.Append(name, hbox) - tabSetMargined(tab, margin) // TODO: run this in the right place(?) + tab := ui.NewTab() w.SetChild(tab) - - newt.uiWindow = w newt.uiTab = tab newt.uiControl = tab - newt.uiBox = hbox + log(debugToolkit, "rawTab() END", name) return &newt } @@ -120,20 +119,14 @@ func (t *andlabsT) appendTab(name string) *andlabsT { } func newTab(a *toolkit.Action) { - parentW := a.Where - w := a.Widget - var newt *andlabsT - log(debugToolkit, "gui.andlabs.NewTab()", w.Name) + // w := a.Widget + log(debugToolkit, "newTab()", a.WhereId) - t := mapToolkits[parentW] + t := andlabs[a.WhereId] if (t == nil) { - log(debugToolkit, "go.andlabs.NewTab() toolkit struct == nil. name=", parentW.Name, w.Name) + log(debugToolkit, "newTab() parent toolkit == nil. new tab can not be made =", a.WhereId) + log(debugToolkit, "look for a window? check for an existing tab?") return } - newt = t.newTab(w.Name) - mapWidgetsToolkits(a, newt) -} - -func doTab(a *toolkit.Action) { - newTab(a) + t.newTab(a) } |
