- Using syntax with the wizard
- Features of the dialog box
- Application in the background: Specific case from Android 10
In french: DialogueAsynchrone
Displays a non-blocking message box and calls a WLanguage procedure with the value of the button clicked by the user.
- 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 allows you to apply the skin template of your project to this dialog box. For more details, see Customizing dialog boxes.
// 1: Save
// 2: Do not save
DialogAsynchronous("Do you want to save the changes made to %1?", ...
INTERNAL PROCEDURE MyProcedure_Dialog(nResult)
IF nResult = 1 THEN
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 WLangage 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.
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:
- In the code editor, type "DialogAsynchronous(".
- Click "Wizard". The wizard starts. Go to the next step.
- Choose an existing question or create a new question (<Click here to create a new question>). Go to the next step.
- 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.
- 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.
- 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
- 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.
- This function must not be used:
- in the event "Resizing" of the window. Otherwise, the application will be locked.
- in the event "Changing the orientation" of the window.
- in the event "Move to the foreground" associated with the project.
Remark: However, the function can be used in the event "Move to the foreground" of a window.
- in a thread.
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.
- 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.
This page is also available for…