Platforms to show: All Mac Windows Linux Cross-Platform
Required plugins for this example: MBS Win Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /Win/Win User Notification
This example is the version from Mon, 15th May 2022.
Project "Win User Notification.xojo_binary_project"
Class App Inherits Application
Const kEditClear = "&Delete"
Const kFileQuit = "&Quit"
Const kFileQuitShortcut = ""
EventHandler Sub Open()
#If TargetWin32 Then
If Not WinUserNotificationCenterMBS.Available Then
MsgBox "Not available on this Windows version."
end if
#else
MsgBox "This example is for Windows only."
#endif
End EventHandler
End Class
Class Window1 Inherits Window
Control Label1 Inherits Label
ControlInstance Label1 Inherits Label
End Control
Control ImageField Inherits TextField
ControlInstance ImageField Inherits TextField
End Control
Control Label2 Inherits Label
ControlInstance Label2 Inherits Label
End Control
Control TextField1 Inherits TextField
ControlInstance TextField1 Inherits TextField
End Control
Control Label3 Inherits Label
ControlInstance Label3 Inherits Label
End Control
Control TextField2 Inherits TextField
ControlInstance TextField2 Inherits TextField
End Control
Control Label4 Inherits Label
ControlInstance Label4 Inherits Label
End Control
Control TextField3 Inherits TextField
ControlInstance TextField3 Inherits TextField
End Control
Control OpenButton Inherits PushButton
ControlInstance OpenButton Inherits PushButton
EventHandler Sub Action()
dim f as FolderItem = GetOpenFolderItem("")
if f = nil then Return
ImageField.Text = f.NativePath
End EventHandler
End Control
Control ShowButton Inherits PushButton
ControlInstance ShowButton Inherits PushButton
EventHandler Sub Action()
If center = Nil Then
dim appName as string = "MyTestApp"
dim aumi as string = WinUserNotificationCenter.configureAUMI("MyCompany", "test", "test", "1.0")
center = new WinUserNotificationCenter(appname, aumi)
center.list = listbox1
end if
dim n as new WinUserNotificationMBS
n.Image = ImageField.Text
n.text(0) = TextField1.Text
n.text(1) = TextField2.Text
n.text(2) = TextField3.Text
currentNotification = n
n.Tag = "Hello"
// set it
Dim d As New Dictionary
d.Value("Hello") = "World"
n.DataValues = d
Dim dic As Dictionary = n.DataValues
System.DebugLog "Hello: "+dic.Lookup("Hello", "")
center.ShowNotification(n)
End EventHandler
End Control
Control Listbox1 Inherits Listbox
ControlInstance Listbox1 Inherits Listbox
End Control
Property Private Center As WinUserNotificationCenter
Property Private currentNotification As WinUserNotificationMBS
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
Class WinUserNotificationCenter Inherits WinUserNotificationCenterMBS
EventHandler Sub Activated(Notification as WinUserNotificationMBS)
list.AddRow "Activated."
list.AddRow "Tag: "+Notification.tag
End EventHandler
EventHandler Sub Dismissed(Notification as WinUserNotificationMBS, Reason as Integer)
Dim r As String
Select case reason
case me.DismissalReasonApplicationHidden
r = "Application Hidden"
case me.DismissalReasonTimedOut
r = "Time Out"
case me.DismissalReasonUserCanceled
r = "User Cancelled"
else
r = str(reason)
end Select
list.AddRow "Dismissed: "+r
list.AddRow "Tag: "+Notification.tag
End EventHandler
EventHandler Sub Failed(Notification as WinUserNotificationMBS, ErrorCode as Integer)
list.AddRow "Failed: "+Str(ErrorCode)
list.AddRow "Tag: "+Notification.tag
End EventHandler
Property list As listbox
End Class
End Project
See also:
The items on this page are in the following plugins: MBS Win Plugin.