WXNOTIFICATIONMESSAGE(3erl)
π NAME
This is wxNotificationMessage(3erl), the Erlang module definition page for wxNotificationMessage β functions for the wxNotificationMessage class, and yes bestie, we're making it cute. π
β¨ DESCRIPTION
Okay so this class lets you show the user a message non-intrusively. It's literally the polite little notification vibe, not a whole window situation. π
Currently it is implemented natively for Windows, macOS, GTK and uses generic toast notifications under the other platforms. It's not recommended but wxGenericNotificationMessage can be used instead of the native ones. This might make sense if your application requires features not available in the native implementation.
Notice that this class is not a window and so doesn't derive from wxWindow β main character energy without being a wxWindow, periodt. π
πͺ Platform Notes
Par:Up to Windows 8 balloon notifications are displayed from an icon in the notification area of the taskbar. If your application uses awxTaskBarIconyou should calluseTaskBarIcon/1to ensure that only one icon is shown in the notification area. Windows 10 displays all notifications as popup toasts. To suppress the additional icon in the notification area on Windows 10 and for toast notification support on Windows 8 it is recommended to callmSWUseToasts/1before showing the first notification message. πͺβ¨Par:The macOS implementation uses Notification Center to display native notifications. In order to use actions your notifications must use the alert style. This can be enabled by the user in system settings or by setting theNSUserNotificationAlertStylevalue inInfo.plisttoalert. Please note that the user always has the option to change the notification style. π
Since: 2.9.0 β iconic behavior, honestly.
This class is derived (and can use functions) from: wxEvtHandler.
wxWidgets docs: wxNotificationMessage.
π£ EVENTS
Event types emitted from this class β collect them, bestie:
notification_message_clicknotification_message_dismissednotification_message_action
𧬠DATA TYPES
wxNotificationMessage() = wx:wx_object()
That's the object type. No cap. π¦
π EXPORTS
Alright bestie, here's the full menu. Every function, every type, every return β we are not skipping a single crumb. β¨
new() -> wxNotificationMessage()
Default constructor. Use setParent/2, setTitle/2 and setMessage/2 to initialize the object before showing it. That's the whole setup arc. π
new(Title) -> wxNotificationMessage()
Types:
Title = unicode:chardata()
new(Title, Options :: [Option]) -> wxNotificationMessage()
Types:
Title = unicode:chardata()
Option =
{message, unicode:chardata()} |
{parent, wxWindow:wxWindow()} |
{flags, integer()}
Create a notification object with the given attributes. See setTitle/2, setMessage/2, setParent/2 and setFlags/2 for the description of the corresponding parameters. Slay, that's your constructor. π
destroy(This :: wxNotificationMessage()) -> ok
Types:
This = wxNotificationMessage()
Destructor does not hide the notification. The notification can continue to be shown even after the C++ object was destroyed, so call close/1 explicitly if it needs to be hidden. This is the βobject gone, popup still living its truthβ situation β handle it, bestie. π
addAction(This, Actionid) -> boolean()
Types:
This = wxNotificationMessage()
Actionid = integer()
addAction(This, Actionid, Options :: [Option]) -> boolean()
Types:
This = wxNotificationMessage()
Actionid = integer()
Option = {label, unicode:chardata()}
Add an action to the notification. If supported by the implementation these are usually buttons in the notification selectable by the user.
Return: false if the current implementation or OS version does not support actions in notifications.
Since: 3.1.0 β modern era notification behavior. π₯
close(This) -> boolean()
Types:
This = wxNotificationMessage()
Hides the notification.
Returns true if it was hidden or false if it couldn't be done (e.g. on some systems automatically hidden notifications can't be hidden manually). Not me finding out some notifications have a mind of their own π
setFlags(This, Flags) -> ok
Types:
This = wxNotificationMessage()
Flags = integer()
This parameter can currently be used to specify the icon to show in the notification.
Valid values are wxICON_INFORMATION, wxICON_WARNING and wxICON_ERROR (notice that wxICON_QUESTION is not allowed here). Some implementations of this class may not support the icons.
See: setIcon/2.
setIcon(This, Icon) -> ok
Types:
This = wxNotificationMessage()
Icon = wxIcon:wxIcon()
Specify a custom icon to be displayed in the notification.
Some implementations of this class may not support custom icons.
See: setFlags/2.
Since: 3.1.0.
setMessage(This, Message) -> ok
Types:
This = wxNotificationMessage()
Message = unicode:chardata()
Set the main text of the notification.
This should be a more detailed description than the title but still limited to reasonable length (not more than 256 characters). Keep it cute but under 256, bestie. π
setParent(This, Parent) -> ok
Types:
This = wxNotificationMessage()
Parent = wxWindow:wxWindow()
Set the parent for this notification: the notification will be associated with the top level parent of this window or, if this method is not called, with the main application window by default. π«Ά
setTitle(This, Title) -> ok
Types:
This = wxNotificationMessage()
Title = unicode:chardata()
Set the title, it must be a concise string (not more than 64 characters), use setMessage/2 to give the user more details. Short title, big vibe check. β¨
show(This) -> boolean()
Types:
This = wxNotificationMessage()
show(This, Options :: [Option]) -> boolean()
Types:
This = wxNotificationMessage()
Option = {timeout, integer()}
Show the notification to the user and hides it after timeout seconds are elapsed.
Special values Timeout_Auto and Timeout_Never can be used here, notice that you shouldn't rely on timeout being exactly respected because the current platform may only support default timeout value and also because the user may be able to close the notification.
Note: When using native notifications in wxGTK, the timeout is ignored for the notifications withwxICON_WARNINGorwxICON_ERRORflags, they always remain shown unless they're explicitly hidden by the user, i.e. behave as ifTimeout_Autowere given.
Return: false if an error occurred.
useTaskBarIcon(Icon) -> wxTaskBarIcon:wxTaskBarIcon()
Types:
Icon = wxTaskBarIcon:wxTaskBarIcon()
If the application already uses a wxTaskBarIcon, it should be connected to notifications by using this method.
This has no effect if toast notifications are used.
Return: the task bar icon which was used previously (may be NULL).
Only for: wxmsw.
mSWUseToasts() -> boolean()
mSWUseToasts(Options :: [Option]) -> boolean()
Types:
Option =
{shortcutPath, unicode:chardata()} |
{appId, unicode:chardata()}
Enables toast notifications available since Windows 8 and suppresses the additional icon in the notification area on Windows 10.
Toast notifications require a shortcut to the application in the start menu. The start menu shortcut needs to contain an Application User Model ID. It is recommended that the applications setup creates the shortcut and the application specifies the setup created shortcut in shortcutPath. A call to this method will verify (and if necessary modify) the shortcut before enabling toast notifications.
Return: false if toast notifications could not be enabled.
Only for: wxmsw.
See: wxAppConsole::SetAppName() (not implemented in wx), wxAppConsole::SetVendorName() (not implemented in wx).
Since: 3.1.0.
With love from the wxWidgets team π β source/version: wx 2.2.2.1 β page: wxNotificationMessage(3erl) β and the original footer didn't print a date, so we're not inventing one, bestie π«Άβ¨
π¦ where this page comes from
- ubuntu noble: erlang-manpages 1:25.3.2.8+dfsg-1ubuntu4 Β· Apache-2.0
- ubuntu noble: erlang-manpages 1:25.3.2.8+dfsg-1ubuntu4.8 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms