ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

This content has been translated automatically.  Click here  to view the French version.
Help / WLanguage / WLanguage functions / Standard functions / Windows functions / Toast functions
  • Properties specific to Toast variables
  • WLanguage functions that use Toast variables
WINDEV
WindowsLinuxJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac Catalyst
Others
Stored procedures
The Toast type is used to define all the advanced characteristics of a toast notification. You can define and change the characteristics of this toast using different WLanguage properties.
Note: For more details on the declaration of this type of variable and the use of WLanguage properties, see Declaring a variable.
Example
MonToast is Toast
MonToast.Title = "Le saviez-vous?"
MonToast.Text = "Les FAA sont un truc génial."
MonToast.Button[1].Libellé = "En savoir plus..."
MonToast.Button[1].ActionClic = FoncAide
MonToast.ActionClose = clicFerme
ToastDisplay(MonToast)
INTERNAL PROCEDURE FoncAide
	Open("FEN_Aide")
END
INTERNAL PROCEDURE clicFerme(nBouton)
	Trace("Clic fermeture, bouton " + nBouton)
END
// Affiche un toast avec le nom produit supprimé
MonToast is Toast
MonToast.DisplayDuration = toastLong
MonToast.VerticalAlignment = vaBottom 
MonToast.HorizontalAlignment = haCenter
ToastDisplayIW(FI_TOAST_SUPPR, MonToast, PRODUIT.NOM)
//------------------------------------
// Déclarations globales de la fenêtre interne
PROCEDURE FI_TOAST_SUPPR(nomProduit)
LIB_TEXTE = StringBuild("Le produit %1 a été supprimé", nomProduit)
Properties

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.
Android Only one button can be added to a 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.
Note: you can use the gPen function to change the color of the text displayed on the toast.. For example:
MonToast.Button[3].Libellé = gPen(LightYellow) + 
	"Ne plus demander"
HorizontalAlignmentInteger constantHorizontal alignment of the toast, relative to the window:
  • chCentre (Default): Display the toast in the center of the window.
  • chRight: Display toast on the right of the window.
  • chLeft: Toast displayed on the left of the window.
Android Not available.
VerticalAlignmentInteger constantVertical toast alignment, relative to the window:
  • cvBas (Default): Display toast at the bottom of the window.
  • cvHaut: Toast displayed at the top of the window.
  • cvMilieu: Toast displayed in the middle of the window.
Android Not available.
BackgroundColorIntegerBackground color used for toast display. This parameter can correspond to:
DisplayDurationInteger constantToast display time:
  • toastCourt (Default): Toast will be displayed for a short period of time.
  • toastLong: Toast will be displayed for a long period of time.
Note: The exact display time depends on the device used.
CloseOnClickBooleanToast closing mode:
  • Vrai: The toast closes automatically if the user clicks on it,
  • Faux: Toast closes after specified display time.
Android Not available.
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): If several toasts are displayed, the toasts are stacked..
  • Faux: If several toasts are displayed, the toasts are displayed one below the other (version 24 compatibility)..
AndroidiPhone/iPad Not available.
TextCharacter stringText displayed in the toast.
TitleCharacter stringToast title.
AndroidiPhone/iPad Not available.
Remarks

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/21/2024

Send a report | Local help