Platforms to show: All Mac Windows Linux Cross-Platform

/MacBase/NSProcessInfo Notifications


You find this example project in your Plugins Download as a Xojo project file within the examples folder: /MacBase/NSProcessInfo Notifications

This example is the version from Tue, 29th Jan 2024.

Project "NSProcessInfo Notifications.xojo_binary_project"
Class App Inherits Application
Const kEditClear = "&Löschen"
Const kFileQuit = "Beenden"
Const kFileQuitShortcut = ""
EventHandler Sub Close() End EventHandler
EventHandler Sub Open() ' Get the default notification center notificationObserver = NSNotificationCenterMBS.defaultCenter ' Access thermalState to comply with Apple's requirement 'Apple DEV says : "To receive NSProcessInfoThermalStateDidChangeNotification, you must access the thermalState before subscribing to the notification". processInfo = NSProcessInfoMBS.processInfo dim thermalState as Integer = processInfo.thermalState Dim lowPower As Boolean = processInfo.isLowPowerModeEnabled ' Create an instance of MyObserver Dim o As New MyObserver notificationObserver.addObserver o, NSProcessInfoMBS.NSProcessInfoThermalStateDidChangeNotification observers.append o o = New MyObserver notificationObserver.addObserver o, NSProcessInfoMBS.NSProcessInfoPowerStateDidChangeNotification observers.append o End EventHandler
Property notificationObserver As NSNotificationCenterMBS
Property observers() As MyObserver
Property processInfo As NSProcessInfoMBS
End Class
Class MainWindow Inherits Window
Control List Inherits Listbox
ControlInstance List Inherits Listbox
End Control
End Class
MenuBar MenuBar1
MenuItem FileMenu = "&Ablage"
MenuItem FileQuit = "#App.kFileQuit"
MenuItem EditMenu = "&Bearbeiten"
MenuItem EditUndo = "&Rückgängig"
MenuItem UntitledMenu1 = "-"
MenuItem EditCut = "&Ausschneiden"
MenuItem EditCopy = "&Kopieren"
MenuItem EditPaste = "&Einfügen"
MenuItem EditClear = "#App.kEditClear"
MenuItem UntitledMenu0 = "-"
MenuItem EditSelectAll = "&Alles auswählen"
End MenuBar
Class MyObserver Inherits NSNotificationObserverMBS
EventHandler Sub GotNotification(notification as NSNotificationMBS) dim l as listbox = MainWindow.List l.AddRow "Notification recue : "+notification.name End EventHandler
End Class
Sign
End Sign
End Project

The items on this page are in the following plugins: MBS MacBase Plugin.


The biggest plugin in space...