diff options
Diffstat (limited to 'mwidget.mod/mwidget.bmx')
-rw-r--r-- | mwidget.mod/mwidget.bmx | 13 |
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
|