Xojo Conferences
MBSSep2018MunichDE
XDCMay2019MiamiUSA

Platforms to show: All Mac Windows Linux Cross-Platform

/MacExtras/Growl Test
Function:
Required plugins for this example: MBS MacExtras Plugin, MBS Main Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /MacExtras/Growl Test
This example is the version from Thu, 6th Apr 2016.
Project "Growl Test.rbp"
Class App Inherits Application
Const kEditClear = "&Löschen"
Const kFileQuit = "Beenden"
Const kFileQuitShortcut = ""
EventHandler Sub Open() dim framework as FolderItem = FindFile("Growl.framework") if not GrowlApplicationBridgeMBS.LoadFramework(Framework) then MsgBox "Failed to load framework." quit end if m = new MyGrowlApplicationBridgeMBS End EventHandler
Function FindFile(name as string) As FolderItem // Look for file in parent folders from executable on dim parent as FolderItem = app.ExecutableFile.Parent while parent<>Nil dim file as FolderItem = parent.Child(name) if file<>Nil and file.Exists then Return file end if parent = parent.Parent wend End Function
Property m As MyGrowlApplicationBridgeMBS
End Class
Class MainWindow Inherits Window
Control List Inherits Listbox
ControlInstance List Inherits Listbox
End Control
Control PushButton1 Inherits PushButton
ControlInstance PushButton1 Inherits PushButton
EventHandler Sub Action() // send a notification GrowlApplicationBridgeMBS.notifyWithTitle("Hello World", "Some test notification", "Test Notification", nil, 0, false, "HelloNormal") End EventHandler
End Control
Control PushButton2 Inherits PushButton
ControlInstance PushButton2 Inherits PushButton
EventHandler Sub Action() // send a sticky notification GrowlApplicationBridgeMBS.notifyWithTitle("Hello World Sticky", "Some test notification", "Test Notification Sticky", nil, 0, true, "HelloSticky") End EventHandler
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 MyGrowlApplicationBridgeMBS Inherits GrowlApplicationBridgeMBS
EventHandler Function applicationNameForGrowl() As string MainWindow.List.AddRow CurrentMethodName Return "TestApp" End EventHandler
EventHandler Sub growlIsReady() MainWindow.List.AddRow CurrentMethodName End EventHandler
EventHandler Sub growlNotificationTimedOut(clickContext as variant) MainWindow.List.AddRow CurrentMethodName+": "+clickContext.StringValue End EventHandler
EventHandler Sub growlNotificationWasClicked(clickContext as variant) MainWindow.List.AddRow CurrentMethodName+": "+clickContext.StringValue End EventHandler
EventHandler Function hasNetworkClientEntitlement() As boolean MainWindow.List.AddRow CurrentMethodName Return false End EventHandler
EventHandler Function registrationDictionaryForGrowl() As dictionary MainWindow.List.AddRow CurrentMethodName dim regDic as new Dictionary regdic.Value(GrowlApplicationBridgeMBS.kApplicationName) = "TestApp" dim notifications() as string = array("Test Notification", "Test Notification Sticky") regdic.Value(GrowlApplicationBridgeMBS.kNotificationsAll) = Notifications regdic.Value(GrowlApplicationBridgeMBS.kNotificationsDefault) = Notifications Return regdic End EventHandler
End Class
End Project

Feedback, Comments & Corrections

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





Links
MBS Xojo Plugins