Platforms to show: All Mac Windows Linux Cross-Platform
Required plugins for this example: MBS MacOSX Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /MacOSX/Sleep Notification
This example is the version from Mon, 18th Mar 2012.
Project "Sleep Notification.xojo_binary_project"
FileTypes
Filetype text
End FileTypes
Class Window1 Inherits Window
Control ListBox1 Inherits ListBox
ControlInstance ListBox1 Inherits ListBox
End Control
EventHandler Sub Open()
if TargetMachO then
s=new SleepNotification
else
MsgBox "Please use a MachO target!"
end if
End EventHandler
Property Protected s As sleepNotification
End Class
MenuBar MenuBar1
MenuItem UntitledMenu1 = ""
MenuItem FileMenu = "&File"
MenuItem FileQuit = "Quit"
MenuItem EditMenu = "&Edit"
MenuItem EditUndo = "&Undo"
MenuItem UntitledMenu0 = "-"
MenuItem EditCut = "Cu&t"
MenuItem EditCopy = "&Copy"
MenuItem EditPaste = "&Paste"
MenuItem EditClear = "Clear"
End MenuBar
Class App Inherits Application
End Class
Class SleepNotification Inherits SleepNotificationMBS
EventHandler Function Sleep(message as int64) As boolean
dim s as string
Select case message
case kIOMessageCanSystemPowerOff
s="CanSystemPowerOff"
case kIOMessageCanSystemSleep
s="CanSystemSleep"
case kIOMessageSystemHasPoweredOn
s="SystemHasPoweredOn"
case kIOMessageSystemWillNotPowerOff
s="SystemWillNotPowerOff"
case kIOMessageSystemWillPowerOff
s="SystemWillPowerOff"
case kIOMessageSystemWillNotSleep
s="SystemWillNotSleep"
case kIOMessageSystemWillPowerOn
s="SystemWillPowerOn"
case kIOMessageSystemWillRestart
s="SystemWillRestart"
case kIOMessageSystemWillSleep
s="SystemWillSleep"
else
s=hex(message)
end Select
window1.ListBox1.AddRow s
Return true // deny request
End EventHandler
End Class
End Project
The items on this page are in the following plugins: MBS MacOSX Plugin.