summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan C <ianc@noddybox.co.uk>2020-06-12 22:04:05 +0000
committerIan C <ianc@noddybox.co.uk>2020-06-12 22:04:05 +0000
commit89a5e41d2bffe9322029168c74d973be853a3279 (patch)
treeb6e6c8a9a27e7bfc772bb0482b07839bff1c7304
parent64e351fba0f50c326bcc29ad9585a814755bfa8d (diff)
On app terminate call Close on the top window.
-rw-r--r--mwidget.mod/mwidget.bmx13
1 files changed, 12 insertions, 1 deletions
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