NODE: climbing up the rabbit hole more

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2021-10-25 08:07:46 -05:00
parent 23e471d9c1
commit 26fba883a7
4 changed files with 24 additions and 7 deletions

View File

@ -26,13 +26,16 @@ func Queue(f func()) {
func ExampleWindow() { func ExampleWindow() {
log.Println("START gui.ExampleWindow()") log.Println("START gui.ExampleWindow()")
title := "Test Window" Config.Title = "ExampleWindow"
/*
node := InitWindow(nil, nil, title, 0) node := InitWindow(nil, nil, title, 0)
box := node.box box := node.box
window := box.Window window := box.Window
log.Println("box =", box) log.Println("box =", box)
log.Println("window =", window) log.Println("window =", window)
*/
node := NewWindow()
node.AddDebugTab("jcarr Debug") node.AddDebugTab("jcarr Debug")
window.UiWindow.Show() // window.UiWindow.Show()
} }

View File

@ -98,7 +98,9 @@ func InitColumns(mh *TableData, parts []TableColumnData) {
} }
func AddTableTab(gw *GuiWindow, name string, rowcount int, parts []TableColumnData) *TableData { func AddTableTab(gw *GuiWindow, name string, rowcount int, parts []TableColumnData) *TableData {
node := InitWindow(nil, gw, name, Yaxis) // node := InitWindow(nil, gw, name, Yaxis)
node := NewWindow()
// node.AddDebugTab("jcarr Debug")
return AddTableBox(node.box, name, rowcount, parts) return AddTableBox(node.box, name, rowcount, parts)
} }

View File

@ -14,15 +14,20 @@ var nodeNames = make([]string, 100)
func DebugWindow() { func DebugWindow() {
log.Println("START gui.DebugWindow()") log.Println("START gui.DebugWindow()")
/*
title := "WIT GUI Debug Window" title := "WIT GUI Debug Window"
node := InitWindow(nil, nil, title, 0) node := InitWindow(nil, nil, title, 0)
box := node.box box := node.box
window := box.Window window := box.Window
log.Println("box =", box) log.Println("box =", box)
log.Println("window =", window) log.Println("window =", window)
*/
Config.Title = "replace InitWindow()"
node := NewWindow()
node.AddDebugTab("WIT GUI Debug Tab") node.AddDebugTab("WIT GUI Debug Tab")
window.UiWindow.Show() // window.UiWindow.Show()
} }
// TODO: remove this crap // TODO: remove this crap

View File

@ -4,7 +4,7 @@ import (
"log" "log"
"fmt" "fmt"
"strconv" "strconv"
"time" // "time"
"github.com/andlabs/ui" "github.com/andlabs/ui"
@ -13,21 +13,25 @@ import (
_ "github.com/andlabs/ui/winmanifest" _ "github.com/andlabs/ui/winmanifest"
) )
/*
func initUI(name string, callback func(*GuiBox) *GuiBox) { func initUI(name string, callback func(*GuiBox) *GuiBox) {
ui.Main(func() { ui.Main(func() {
log.Println("gui.initUI() inside ui.Main()") log.Println("gui.initUI() inside ui.Main()")
node := InitWindow(nil, nil, "StartNewWindow"+name, 0) node := NewWindow()
// node := InitWindow(nil, nil, "StartNewWindow"+name, 0)
box := node.box box := node.box
box = callback(box) box = callback(box)
window := box.Window window := box.Window
node.window = window
log.Println("StartNewWindow() box =", box) log.Println("StartNewWindow() box =", box)
window.UiWindow.Show() window.UiWindow.Show()
}) })
} }
*/
/*
func StartNewWindow(bg bool, name string, axis int, callback func(*GuiBox) *GuiBox) { func StartNewWindow(bg bool, name string, axis int, callback func(*GuiBox) *GuiBox) {
log.Println("StartNewWindow() ui.Main() Create a new window") log.Println("StartNewWindow() ui.Main() Create a new window")
@ -38,6 +42,7 @@ func StartNewWindow(bg bool, name string, axis int, callback func(*GuiBox) *GuiB
initUI(name, callback) initUI(name, callback)
} }
} }
*/
func MessageWindow(gw *GuiWindow, msg1 string, msg2 string) { func MessageWindow(gw *GuiWindow, msg1 string, msg2 string) {
ui.MsgBox(gw.UiWindow, msg1, msg2) ui.MsgBox(gw.UiWindow, msg1, msg2)
@ -52,6 +57,7 @@ func ErrorWindow(gw *GuiWindow, msg1 string, msg2 string) {
// This is this way because on Linux you can have more than one // This is this way because on Linux you can have more than one
// actual window but that does not appear to work on the MacOS or Windows // actual window but that does not appear to work on the MacOS or Windows
// //
/*
func InitWindow(parent *Node, gw *GuiWindow, name string, axis int) *Node { func InitWindow(parent *Node, gw *GuiWindow, name string, axis int) *Node {
log.Println("gui.InitWindow() START") log.Println("gui.InitWindow() START")
@ -178,6 +184,7 @@ func InitWindow(parent *Node, gw *GuiWindow, name string, axis int) *Node {
} }
return node return node
} }
*/
func DeleteWindow(name string) { func DeleteWindow(name string) {
log.Println("gui.DeleteWindow() START name =", name) log.Println("gui.DeleteWindow() START name =", name)