ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / WLanguage functions / Standard functions / Windows functions / Toast functions
  • Properties specific to Toast variables
  • WLanguage functions that use Toast variables
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
The Toast type is used to define all the advanced characteristics of a toast notification. The characteristics of this toast can be defined and changed using different WLanguage properties.
Remark: For more details on the declaration of this type of variable and the use of WLanguage properties, see Declaring a variable.
Example
MyToast is Toast
MyToast.Title = "Did you know?"
MyToast.Text = "AAFs are really cool."
MyToast.Button[1].Caption = "Learn more..."
MyToast.Button[1].ActionClick = FuncHelp
MyToast.ActionClose = clickClose
ToastDisplay(MyToast)
INTERNAL PROCÉDURE FuncHelp
Open ("WIN_Help")
END
INTERNAL PROCÉDURE clickClose(nButton)
Trace("Click to close. Button: " + nButton)
END
// Displays a toast without the product name
MyToast is Toast
MyToast.DisplayDuration = toastLong
MyToast.VerticalAlignment = vaBottom 
MyToast.HorizontalAlignment = haCenter
ToastDisplayIW(IW_TOAST_DELETE, MyToast, PRODUCT.NAME)
//------------------------------------
// Global declarations of the internal window
PROCÉDURE IW_TOAST_DELETE(ProductName)
STC_TEXT = StringBuild("The product %1 has been deleted", ProductName)
Remarks

Properties specific to Toast variables

The following properties can be used to handle a toast notification:
Property nameType usedEffect
ActionCloseAction to be performed when the toast is closed. This property corresponds to the name of the procedure to be executed when the button in the toast is clicked.
This procedure takes the number of the clicked button as an optional parameter. If no button has been clicked to close the toast (toast closed via a timer, click on the toast, parent window closed, etc.), this parameter is set to 0.
Button[n]Buttons displayed in the toast.
Button[n].ActionClickAction to perform when the button is clicked on.
This property corresponds to the name of the procedure to be executed when the button in the toast is clicked.
Button[n].CaptionButton caption.
Remark: you can use gPen to change the toast text color. For example:
MyToast.Button[3].Caption = gPen(LightYellow) + 
"Don't ask again"
HorizontalAlignmentInteger constantHorizontal alignment of the message, relative to the window:
  • haCenter (Default value): The Toast message is displayed in the center.
  • haRight: The Toast message is displayed on the right.
  • haLeft: The Toast message is displayed on the left.
VerticalAlignmentInteger constantVertical alignment of the message, relative to the window:
  • vaBottom (Default value): The Toast message is displayed at the bottom.
  • vaTop: The Toast message is displayed at the top.
  • vaMiddle: The Toast message is displayed in the middle.
BackgroundColorIntegerBackground color used to display the message. This parameter can be:
DisplayDurationInteger constantDisplay duration of toast notification:
  • toastShort (Default value): The Toast message will be displayed during a short period of time.
  • toastLong: The Toast message will be displayed during a long period of time.
Remark: The exact display duration depends on the device used.
CloseOnClickBooleanToast closing mode:
  • True: the toast closes automatically if the user clicks on it,
  • False: the toast closes after the specified display time.
OpacityIntegerOpacity level of the toast with a value between 1 and 100:
  • 1, for a toast without opacity,
  • 100, for a toast with maximum opacity.
By default, the opacity level is 0 (corresponds to an opacity of 100).
OverlayableBoolean
  • True (default value): if several toasts are displayed, they overlap each other.
  • False: if several toasts are displayed, they overlap each other (compatible version 24).
TextCharacter stringMessage to display.
TitleCharacter stringToast title.

WLanguage functions that use Toast variables

ToastDisplayDisplays a "Toast" message.
ToastDisplayIWOpens a toast whose content is based on an internal window.
Related Examples:
WD Toasts Training (WINDEV): WD Toasts
[ + ] This example shows how to use the ToastDisplay and ToastDisplayIW functions as well as Toast variables. A Toast is a temporary message used to inform the user without interrupting the application.
Minimum version required
  • Version 25
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 09/11/2023

Send a report | Local help