Platforms to show: All Mac Windows Linux Cross-Platform
/Util/SignalHandler/Signal Handler Flag Test
Required plugins for this example: MBS Util Plugin
Last modified Sat, 2nd May 2014.
You find this example project in your MBS Xojo Plugin download as a Xojo project file within the examples folder: /Util/SignalHandler/Signal Handler Flag Test
Download this example: Signal Handler Flag Test.zip
Project "Signal Handler Flag Test.xojo_binary_project"
Class App Inherits Application
Const kEditClear = "&Delete"
Const kFileQuit = "&Quit"
Const kFileQuitShortcut = ""
End Class
Class MainWindow Inherits Window
Const SIGABRT = 6
Const SIGILL = 4
Const SIGKILL = 9
Const SIGQUIT = 3
Control List Inherits Listbox
ControlInstance List Inherits Listbox
End Control
Control Label1 Inherits Label
ControlInstance Label1 Inherits Label
End Control
Control Timer1 Inherits Timer
ControlInstance Timer1 Inherits Timer
EventHandler Sub Action()
if SignalHandlerMBS.IsFlagSet(SIGQUIT) then
dim stack() as string = SignalHandlerMBS.QueryStacktrace(SIGQUIT)
SignalHandlerMBS.ClearFlag(SIGQUIT)
SignalHandlerMBS.ClearStacktrace(SIGQUIT)
List.DeleteAllRows
List.AddRow "Got Kill signal..."
for each s as string in stack
List.AddRow s
next
end if
End EventHandler
End Control
Control TextField1 Inherits TextField
ControlInstance TextField1 Inherits TextField
EventHandler Sub Open()
me.Text = "kill -QUIT "+str(ProcessMBS.CurrentProcessID)
End EventHandler
End Control
EventHandler Sub Open()
if SignalHandlerMBS.SetFlagHandler(SIGQUIT, true) then
// ok
else
MsgBox "Failed to set signal handler!"
end if
End EventHandler
End Class
MenuBar MainMenuBar
MenuItem FileMenu = "&File"
MenuItem FileQuit = "#App.kFileQuit"
MenuItem EditMenu = "&Edit"
MenuItem EditUndo = "&Undo"
MenuItem EditSeparator1 = "-"
MenuItem EditCut = "Cu&t"
MenuItem EditCopy = "&Copy"
MenuItem EditPaste = "&Paste"
MenuItem EditClear = "#App.kEditClear"
MenuItem EditSeparator2 = "-"
MenuItem EditSelectAll = "Select &All"
End MenuBar
End Project
Download this example: Signal Handler Flag Test.zip
The items on this page are in the following plugins: MBS Util Plugin.