From 89a5e41d2bffe9322029168c74d973be853a3279 Mon Sep 17 00:00:00 2001 From: Ian C Date: Fri, 12 Jun 2020 22:04:05 +0000 Subject: On app terminate call Close on the top window. --- mwidget.mod/mwidget.bmx | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/mwidget.mod/mwidget.bmx b/mwidget.mod/mwidget.bmx index 88487f9..f2858e0 100644 --- a/mwidget.mod/mwidget.bmx +++ b/mwidget.mod/mwidget.bmx @@ -2722,6 +2722,7 @@ Your code can do it's own event loop if required -- all this function does is co a basic main loop. EndRem Function MWidgetMainLoop(top:TMWindow) + Static.SetTop(top) While Not top.closed WaitEvent() Wend @@ -2742,14 +2743,20 @@ Type Static Global list:TList Global menu:TList Global menuid:Int + Global top:TMWindow Function Init() list=CreateList() menu=CreateList() menuid=0 + top = Null AddHook(EmitEventHook,EventHandler) End Function + Function SetTop(w:TMWindow) + top = w + End Function + Function EventHandler:Object(id:Int, data:Object, context:Object) Local e:TEvent=TEvent(data) @@ -2779,7 +2786,11 @@ Type Static If Not handled If e.id = 259 - End + If top + top.Close() + Else + End + EndIf EndIf EndIf EndIf -- cgit v1.2.3