From 099efb6b24caf9eaad50d7386636a7ac23552bde Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Sat, 5 Nov 2022 10:19:04 -0500 Subject: v0.4.2 more code cleanups and improvements Add command line argv handling using go-arg make hello world dumb stupid simple again more swtiching to common code move debugging options to support go-args more debugging output cleanup more debugging cleanups fix null pointer crash --- toolkit/andlabs/common.go | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'toolkit/andlabs/common.go') diff --git a/toolkit/andlabs/common.go b/toolkit/andlabs/common.go index 75f7444..569621d 100644 --- a/toolkit/andlabs/common.go +++ b/toolkit/andlabs/common.go @@ -12,30 +12,38 @@ func init() { func (t Toolkit) commonChange(widget string) { s := t.String() - log.Println("gui.Toolkit.ui.OnChanged() =", s) if (DebugToolkit) { log.Println("gui.Toolkit.ui.OnChanged() =", s) } if (t.OnChanged != nil) { - log.Println("gui.Toolkit.OnChanged() trying to run toolkit.OnChanged() entered val =", s) + if (DebugToolkit) { + log.Println("gui.Toolkit.OnChanged() trying to run toolkit.OnChanged() entered val =", s) + } t.OnChanged(&t) return } if (t.Custom != nil) { - log.Println("gui.Toolkit.OnChanged() Running toolkit.Custom()") - t.Dump() + if (DebugToolkit) { + log.Println("gui.Toolkit.OnChanged() Running toolkit.Custom()") + t.Dump() + } t.Custom() return } - log.Println("gui.Toolkit.OnChanged() ENDED without finding any callback") + if (DebugToolkit) { + log.Println("gui.Toolkit.OnChanged() ENDED without finding any callback") + } } +// does some sanity checks on the internal structs of the binary tree +// TODO: probably this should not panic unless it's running in devel mode (?) func (t Toolkit) broken() bool { if (t.uiBox == nil) { log.Println("gui.Toolkit.UiBox == nil. I can't add a widget without a place to put it") // log.Println("probably could just make a box here?") // corruption or something horrible? panic("wit/gui toolkit/andlabs func broken() invalid goroutine access into this toolkit?") + panic("wit/gui toolkit/andlabs func broken() this probably should not cause the app to panic here (?)") return true } if (t.uiWindow == nil) { -- cgit v1.2.3