From 8d5b885b3a37615c7e6d7e8acb451bb11f90db93 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Wed, 3 Nov 2021 22:41:22 -0500 Subject: [PATCH] GUI: show error windows Signed-off-by: Jeff Carr --- window.go | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/window.go b/window.go index b776ad6..f22e614 100644 --- a/window.go +++ b/window.go @@ -9,16 +9,26 @@ import ( _ "github.com/andlabs/ui/winmanifest" ) -func (n *Node) MessageWindow2(msg1 string, msg2 string) (*Node) { - ui.MsgBox(n.uiWindow, msg1, msg2) - // TODO: make new node - return n +func findUiWindow() *ui.Window { + for _, node := range Data.NodeMap { + if (node.uiWindow != nil) { + return node.uiWindow + } + } + return nil } -func (n *Node) ErrorWindow2(msg1 string, msg2 string) (*Node) { - ui.MsgBoxError(n.uiWindow, msg1, msg2) +func MessageWindow(msg1 string, msg2 string) (*Node) { + uiW := findUiWindow() + ui.MsgBox(uiW, msg1, msg2) // TODO: make new node - return n + return nil +} + +func ErrorWindow(msg1 string, msg2 string) (*Node) { + uiW := findUiWindow() + ui.MsgBoxError(uiW, msg1, msg2) + return nil } func initNode(title string, x int, y int) *Node {