- How to?
- Click on a notification or a button of a notification
- Functions and types of variables associated with interactive notifications
A notification is a small window that appears at the bottom right of the screen, and that can be viewed at any time in the Windows notification area.
This type of window has been standardized by Windows (using XML).
In version 27, you can easily create notifications to be displayed in Windows.
A notification can contain:
- edit controls,
- combo boxes.
WINDEV includes multiple functions and WLanguage types to create these notifications.
To create and display a notification:
- Check if the user's system supports interactive notifications using SysNotificationCompatible.
- Create a variable of type sysNotification. This variable contains the full description of the notification.
- To add input areas to the notification, create one or more variables of type sysNotificationInput. The Type property of this variable type determines whether the input area is a combo box or a text area.
- To add buttons to the notification, create one or more variables of type sysNotificationButton. The Type property of this type of variable determines the type and position of the button to be created.
- Define the actions to be performed when the user clicks the notification or a button of the notification (see next paragraph). These actions can correspond to:
- a specific global procedure.
- the "Receive a notification" optional project event (this event is called if the procedure does not exist or has not been specified in the Action property).
- Send the notification to the system with SysNotificationSend.
Click on a notification or a button of a notification
The information about the user's interaction with a notification is retrieved through a system of Callback procedures.
You can associate a specific procedure to each action performed on a notification (either on the notification itself or on its buttons). However, since a notification can reopen an application, a GLOBAL procedure must be used because it must be accessible from the moment the application is opened.
The name of the procedure to be executed is contained in the notification via the Action property. If no name is specified (e.g. a user-customized XML file is used), or the procedure is not found, the "Receive a notification" optional project event is executed.
Both the procedure and the "Receive a notification" optional project event should be in the following format:
PROCEDURE ProcedureName(arguments is string, data is array of string)
- <arguments> contains the arguments associated with the action (via the Note property of the sysNotification variable for a click on the notification, or via the Note property of the sysNotificationButton variable for a click on a button).
- <data> contains the data entered by users in the controls of the notification (edit control or combo box). Each string has the following format:
<Control name> + TAB + <Control value>
Remark: The procedures and the optional event are executed in the main thread of the application (direct access to the controls).
Functions and types of variables associated with interactive notifications
The following functions are used to handle interactive notifications:
The following types of variables are used to handle interactive notifications:
|sysNotification||The sysNotification type is used to define all the advanced characteristics of an interactive system notification.|
|sysNotificationButton||The sysNotificationButton type is used to define all the advanced characteristics of Button control in an interactive notification.|
|sysNotificationInput||The sysNotificationInput type is used to define all the advanced features of an input control, such as a text input or combo box control, in an interactive notification.|
Training (WINDEV): WD Windows Notification Management