From c55a039042b74cce6abf6a300f38c6bc3f4aaef6 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Mon, 17 Jun 2019 08:09:28 -0700 Subject: [PATCH] allow a custom Exit() Signed-off-by: Jeff Carr --- structs.go | 1 + window.go | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/structs.go b/structs.go index 90a674b..514febe 100644 --- a/structs.go +++ b/structs.go @@ -19,6 +19,7 @@ type GuiConfig struct { Height int Debug bool DebugTable bool + Exit func(*GuiWindow) } type GuiData struct { diff --git a/window.go b/window.go index 6a4c26f..80f9908 100644 --- a/window.go +++ b/window.go @@ -83,7 +83,13 @@ func InitWindow(gw *GuiWindow, name string, axis int) *GuiBox { newGuiWindow.UiWindow.OnClosing(func(*ui.Window) bool { log.Println("initTabWindow() OnClosing() THIS WINDOW IS CLOSING newGuiWindow=", newGuiWindow) - ui.Quit() + // newGuiWindow.UiWindow.Destroy() + if (Config.Exit == nil) { + ui.Quit() + } else { + // allow a custom exit function + Config.Exit(&newGuiWindow) + } return true })