ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / WLanguage functions / Standard functions / Windows functions / Dialog Box functions
  • Using syntax with the wizard
  • Features of the dialog box
  • Miscellaneous
  • Application in the background: Specific case from Android 10
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
Displays a non-blocking message box and calls a WLanguage procedure with the value of the button clicked by the user.
Remarks:
  • This is a non-blocking dialog box. The WLanguage code that follows the call to DialogAsynchronous continues to run. To close the window, the user must validate one of the buttons. When the user clicks one of the buttons, the code of a WLanguage procedure is run.
  • In the WLanguage code following the call to the function, another modal window cannot be opened before closing the dialog box.
  • WINDEV WINDEV allows you to apply the skin template of your project to this dialog box. For more details, see Customizing dialog boxes.
Example
// 1: Save
// 2: Do not save
DialogAsynchronous("Do you want to save the changes made to %1?", ...
MyProcedure_Dialog, sFile)
 
INTERNAL PROCEDURE MyProcedure_Dialog(nResult)
IF nResult = 1 THEN
ToastDisplay("save")
END
END
Syntax

Syntax using the wizard Hide the details

DialogAsynchronous(<Message ID> , <WLanguage procedure> [, <Parameter 1> [... [, <Parameter N>]]])
<Message ID>: Integer
Identifies the question asked to the user as well as the different possible answers.
<WLanguage procedure>: Name of the procedure or lambda procedure
Name of the WLanguage procedure ("callback") called when the user clicks one of the buttons in the dialog window. This procedure is used to find out the value of the button that was clicked, and to run a specific process if necessary.
For more details on this procedure, see Parameters of the procedure used by DialogAsynchronous.
This WLanguage procedure can correspond to:
  • a name of a global or local procedure,
  • a name of an internal procedure,
  • a lambda procedure.
<Parameter 1>: Optional character string
If the selected message contains elements with parameters (identified by %1, %2, etc.), this parameter is used to give the desired value to the first element. Thus, the value of <Parameter 1> will replace %1.
<Parameter N>: Optional character string
If the selected message contains elements with parameters (identified by %1, %2, etc.), this parameter is used to give the Nth desired value to element N. Thus, the value of <Parameter N> will replace %N.
Remarks

Using syntax with the wizard

To use this syntax, you must use the wizard proposed when writing the function name in the code editor ("<Wizard>" option proposed by the assisted input). This wizard allows you to specify the different parameters of the dialog box that will be used. This function cannot be used if the dialog window is not created by the wizard.
To start the wizard:
  1. In the code editor, type "DialogAsynchronous(".
  2. Click "Wizard". The wizard starts. Go to the next step.
  3. Choose an existing question or create a new question (<Click here to create a new question>). Go to the next step.
  4. If you have chosen to create a question, a screen is displayed. This screen allows you to enter the different parameters of the dialog box used to ask the question. You can specify:
    • The text of the question,
    • The image of dialog box,
    • The different buttons allowing the user to answer.
  5. Validate the screen for defining the question. The corresponding code is automatically inserted into the code editor. Press the ENTER key again. The entire code is added in the code editor. The characteristics of dialog box can be modified via the icon found beside the question text.
  6. Enter the name of the WLanguage procedure used.
Remark: To write the WLanguage code corresponding to the WLanguage procedure, the different options corresponding to the buttons of the dialog box are indicated as comment before the call to DialogAsynchronous.

Features of the dialog box

  • The title of the dialog box corresponds to the title of the current window (or page).
    AndroidiPhone/iPad To comply with the system specifications, the title of dialog box is empty by default. To define this title, use NextTitle.
  • To modify or define the title of dialog box, use NextTitle.
  • WINDEVWINDEV Mobile The skin template of current project is automatically applied to the dialog box.
  • Android The characteristics of dialog box are as follows:
    • The displayed dialog box uses the system style.
    • The dialog box must not contain more than 3 buttons. The additional buttons will not be displayed.
    • The position of the buttons varies according to the Android version. By default, the validation button is on the right. To change the order of the buttons, open the question edit wizard and uncheck "Use the order defined by the system for the validation/cancellation buttons".
  • iPhone/iPad The displayed dialog box is a native iPhone/iPad dialog box.

Miscellaneous

  • WINDEV DelayBeforeClosing limits how long the message is displayed. The dialog box is automatically closed. For question or confirmation dialog boxes, the default button corresponds to the expected answer.
  • iPhone/iPad This function must not be used:
    • in the "Resizing" event of the window. Otherwise, the application will be locked.
    • in the "Changing the orientation" event of the window.
    • in the "Move to the foreground" event associated with the project.
      Remark: However, the function can be used in the "Move to the foreground" event of a window.
    • in a thread.
Android

Application in the background: Specific case from Android 10

From Android 10, it is no longer possible to open a window when the application is in the background.
DialogAsynchronous can open a window. If this function is used while the application is in the background, a fatal error will occur.
Tips:
  • It is possible to determine if the application is in the background using InBackgroundMode.
  • If an application needs to interact with the user while it is in the background, the solution is to display a notification (via the Notification type). The application will be brought back to the foreground when the notification is clicked, if the ActivateApplication property is set to True. You can also open a window from the procedure passed to the ActionClick property.
Component: wd290obj.dll
Minimum version required
  • Version 25
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 06/21/2023

Send a report | Local help