ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / WLanguage functions / Standard functions / Windows functions / Dialog Box functions
  • Characteristics of dialog box and edit control
  • Managing input masks
  • Typing multiline text
  • Input performed via a check box
  • Message database
  • Limitations
  • Example of full input
  • 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 message allowing the user to type an information.
Input
Remark: Several syntaxes are available for this function:
  • Simplified syntax, entered in the code editor directly.
  • Full syntax with the question entered via a wizard. The code editor proposes a full wizard ("<Wizard>" option proposed by the assisted input). This wizard is used to define the different elements displayed in the message and to automatically generate the corresponding code. The caption of the buttons is proposed according to the text of the question.
  • Direct syntax, typed in the code editor directly.
Example
// Example of simplified input
NbCopies is int
ReturnValue is int
ReturnValue = Input("How many copies do you want to print?", NbCopies)
SWITCH ReturnValue 
CASE 0: Info("You canceled. The default number is set to 1.")
CASE 1: Info("You requested " + NbCopies)
END
// Simplified input while using an input mask
PhoneNum is string
// Use a specific text input mask
Input.InputMask = maskPhoneFrance
SWITCH Input("What is your phone number?", PhoneNum)
// OK
CASE 1: EDT_PhoneNum = PhoneNum 
// Cancel
CASE 0: EDT_PhoneNum = "No phone"
END
Comments is string
Comments = RepeatString(CR, 10)
// Comments typed by the user in a multiline control
// Input limited to 140 characters
Input.InputMask = "regexp:.{0,140}"
SWITCH Input("Type your comments.", Comments)
// OK
CASE 1: EDT_Comment = Comments
// Cancel
CASE 0: EDT_Comment = "No comment"
END
DisplayInfo is boolean = False
// Ask the user whether he really wants to close the application
// A checkmark ("Don't display this window anymore") allows the user
// not to display this question anymore
Input.OptionalCaption = "Don't display this window anymore"
IF DisplayInfo = False THEN
SWITCH Input("Do you want to close the application?", DisplayInfo)
// Close
CASE 1: Close()
END
END
// Remember to store the value of DisplayInfo for the next time
// Direct syntax 
PhoneNum is string
IF Input("What is your phone number?", PhoneNum, ...
["Validate", "No phone", "Cancel"], 3, 3, dlgIconQuestion) = 1 THEN
Info(PhoneNum)
END
Syntax

Simplified syntax (without using the wizard) Hide the details

<Result> = Input(<Question> , <Variable to enter>)
<Result>: Integer
Identifies the answer selected by the user:
  • 0: the "Cancel" button was clicked by the user.
  • 1: the "OK" button was clicked by the user.
<Question>: Character string
Question that will be asked to the user. This question can use StringBuild.
<Variable to enter>: Any type
Variable in which the user must type the answer.
  • This variable must have been declared before the call to Input.
  • The type of variable defines the type of control where users enter the answer. For Time or Date variables, the input mask is automatically deduced from the variable.
    WINDEVAndroidiPhone/iPadJava A specific input mask can be specified (especially for the Text variables) via the Input.InputMask variable (see Notes).
  • If the variable is initialized with a value, this value corresponds to the default value.
  • After Input is called, this variable contains the user's answer (regardless of the button clicked).

Full syntax with the question entered via a wizard Hide the details

<Result> = Input(<Question> , <Variable to enter> [, <Parameter 1> [... [, <Parameter N>]]])
<Result>: Integer
Identifies the answer selected by the user (value from 1 to the number of buttons found in the edit window).
This answer depends on the number of buttons in the question description window. The different values corresponding to the different answers are automatically included in comments in the code editor when selecting the message.
<Question>: Character string
Question that will be asked to the user. This question can contain parameters identified by %1, %2, ...
<Variable to enter>: Any type
Variable in which the user must type the answer.
  • This variable must have been declared before the call to Input.
  • The type of variable defines the type of control where users enter the answer. For Time or Date variables, the input mask is automatically deduced from the variable.
    WINDEVAndroidiPhone/iPadJava A specific input mask can be specified (especially for the Text variables) via the Input.InputMask variable (see Notes).
  • If the variable is initialized with a value, this value corresponds to the default value.
  • After Input is called, this variable contains the user's answer (regardless of the button clicked).
<Parameter 1>: Character string
If the question contains configurable elements (identified by %1, %2, ...), this parameter is used to give the desired value. Therefore, <Parameter 1> will replace %1.
<Parameter N>: Character string
If the selected message contains elements with parameters (identified by %1, %2, ...), this parameter is used to give the desired value. Therefore, <Parameter 2> will replace %2.

Direct syntax Hide the details

<Result> = Input(<Question> , <Variable to enter> , <Captions of buttons> [, <Default button> [, <Cancellation button> [, <Icon>]]])
<Result>: Integer
Identifies the answer selected by the user. This answer depends on the selected message.
<Question>: Character string
Question asked to the user.
<Variable to enter>: Any type
Variable in which the user must type the answer.
  • This variable must have been declared before the call to Input.
  • The type of variable defines the type of control where users enter the answer. For Time or Date variables, the input mask is automatically deduced from the variable.
    WINDEVAndroidiPhone/iPadJava A specific input mask can be specified (especially for the Text variables) via the Input.InputMask variable (see Notes).
  • If the variable is initialized with a value, this value corresponds to the default value.
  • After Input is called, this variable contains the user's answer (regardless of the button clicked).
<Captions of buttons>: Array
Name of the Array variable containing the captions of the buttons.
<Default button>: Integer
Index of the button selected by default. This parameter is set to 1 by default.
<Cancellation button>: Integer
Index of the cancellation button. By default, this parameter corresponds to the index of the last button.
<Icon>: Character string or Integer constant
Displayed icon. This parameter can correspond to:
  • the path of file corresponding to the displayed icon.
  • one of the following constants:
    dlgIconErrorIcon representing an error.
    dlgIconInfoIcon representing an information.
    dlgIconQuestion
    (Default value)
    Icon representing a question.
Remarks

Characteristics of dialog box and edit control

  • 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.
  • The skin template of current project is automatically applied to the dialog box.
    AndroidJava The skin template of the application is not applied to the input window.
  • WINDEVAndroidiPhone/iPadJava To modify the characteristics of the edit control (e.g. to modify the alignment or to replace the characters typed in the control with asterisks), display the question edit wizard (Input in the syntax of Input) and click Editing the parameters of Input.
WINDEVAndroidiPhone/iPadJava

Managing input masks

By default, the input mask is automatically defined from the project information.
However, the Input.InputMask variable allows you to modify the input mask.
This variable can take one of the following values:
maskAAlphaNumLetter, then letters + digits
maskAAlphaNumUpperUppercase letter, then uppercase letters + digits
maskAlphaLetters
maskAlphaNumLetters + digits
maskAlphaNumUpperLetters in uppercase characters + digits
maskAlphaUpperLetters in uppercase characters
maskEmailEmail address
maskFileNameFile name and path
maskFileNoFolderFile name (without its directories)
maskFileSizeNumeric mask for file and disk sizes
maskFUpperFirst letter in uppercase character
maskINSEEINSEE number
maskINSEEKeyINSEE number + key
maskLowerAll in lowercase letters
maskNoneNo input mask
maskNumDigits
maskNumPlusDigits, '+', ' ', '.', '-', ','
maskPatronymicLetters + Digits + Space + Apostrophe + Dash
maskPatronymicUpperCaps + Digits + Space + Quote + Dash
maskPhonePhone number
maskPhoneFrancePhone number in French format
maskUpperAll in uppercase letters

You also have the assign a regular expression as input mask. For more details, see the help on the InputMask (Property) property.

Typing multiline text

The multiline input will be allowed in the associated control if <Variable to Enter> is initialized with a character string containing CR characters.

Input performed via a check box

The input is performed in a check box if the variable is a boolean. The caption of the check box is defined by the Input.OptionalCaption variable.

Message database

All new messages are automatically added to the message database.
By default, the message database is in the "Personal\Message" directory of WINDEV, WEBDEV and WINDEV Mobile. This directory can be modified in the options of WINDEV/WEBDEV/WINDEV Mobile:
  • On the "Home" tab, in the "Environment" group, expand "Options" and select "General options of WINDEV/WEBDEV/WINDEV Mobile".
  • Display the "Directory" tab.
For more details, see question edit wizard.
WEBDEV - Server codeAndroidiPhone/iPadJava

Limitations

  • AndroidJava The skin template of the application is not applied to the input window.
  • The variable to input cannot be initialized with CR characters. The edit control will be a single-line edit control.
    iPhone/iPad No multiline edit control can be used.
  • AndroidJava If the variable is a Boolean, the input will be performed in an edit control (and not in a check box like in WINDEV).
  • AndroidJava The input mask is not supported.
  • iPhone/iPad This function must not be used:
    • in the "Resize" event of the window. Otherwise, the application will be locked.
    • in the "Change 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.
  • WEBDEV - Server code Special cases:
    • If your project uses pre-launched sessions, this function must not be used in the project initialization event. It must be used in the "Initialize project after connecting to the site" event.
    • This function must not be used in a scheduled WEBDEV task.

Example of full input

  1. Typing the question in the editor:
    Typing the question
  2. Code automatically generated (only the "Recipient" variable was entered in the code editor):
Recipient is string
//1: Create a follow-up
//0: Don't create a follow-up
//1: OK
SWITCH Input("Specify a recipient.", Recipient)
// Validate the recipient
CASE 1

// Display the list
CASE 2

// Cancel
CASE 3

END
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.
Input 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.
Business / UI classification: UI Code
Component: wd290obj.dll
Minimum version required
  • Version 10
This page is also available for…
Comments
Video Input Webdev
https://youtu.be/omAQf0idVeA

https://windevdesenvolvimento.blogspot.com/2019/07/dicas-2201-windev-webdev-mobile-dicas.html
//
DIGITE_EMAIL IS STRING=""
INPUT("DIGITE EMAIL:",DIGITE_EMAIL)
amarildo
16 Jul. 2019
Examples
IF RADIO_T007_TIPO_TELEFONE = "C" THEN
EDT_T007_TELEFONE..InputMask = "(99)99999-9999"
EDT_T007_TELEFONE..Caption = "Celular"
END

IF RADIO_T007_TIPO_TELEFONE = "R" OR RADIO_T007_TIPO_TELEFONE = "B" THEN
EDT_T007_TELEFONE..InputMask = "(99)9999-9999"
EDT_T007_TELEFONE..Caption = "Residencial"
END

IF RADIO_T007_TIPO_TELEFONE = "B" THEN
EDT_T007_TELEFONE..InputMask = "(99)9999-9999"
EDT_T007_TELEFONE..Caption = "Comercial"
END
BOLLER
02 Apr. 2019
Exemplo Mascara Input
Input.InputMask=empresa_parametro.casas_mascara_quantidade

Input("Digite Quantidade:",_quantidade_nota)

// Blog com video e Exemplo

http://windevdesenvolvimento.blogspot.com.br/2018/01/aula-1357-de-1631-videos-windev-dicas.html

https://www.youtube.com/watch?v=KDnpqox7gu0

De matos
15 Jan. 2018
Exemplo Input
Exemplo Input

n_numero_copias is int
Input("Quantas Copias",n_numero_copias)
s_telefone is string=""
Input.InputMask=maskPhone
Input("Telefone",s_telefone)
s_observacao is string=""
s_observacao=RepeatString(CR,10)
Input.InputMask="regexp:.{0,140}"
Input("Observacao",s_observacao)
b_pergunta is boolean=False
Input.OptionalCaption="Deseja Gravar"
Input("pergunta",b_pergunta)

//blog com Video e exemplo
http://windevdesenvolvimento.blogspot.com.br/2016/07/curso-windev-funcoes-dialogo-6-input.html
https://www.youtube.com/watch?v=FQisG32jR74
De matos AMARILDO
14 Jul. 2016

Last update: 02/28/2024

Send a report | Local help