|
|
|
|
- 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
Input (Function) In french: Saisie Displays a message allowing the user to type an information.
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.
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
PhoneNum is string
Input.InputMask = maskPhoneFrance
SWITCH Input("What is your phone number?", PhoneNum)
CASE 1: EDT_PhoneNum = PhoneNum
CASE 0: EDT_PhoneNum = "No phone"
END
Comments is string
Comments = RepeatString(CR, 10)
Input.InputMask = "regexp:.{0,140}"
SWITCH Input("Type your comments.", Comments)
CASE 1: EDT_Comment = Comments
CASE 0: EDT_Comment = "No comment"
END
DisplayInfo is boolean = False
Input.OptionalCaption = "Don't display this window anymore"
IF DisplayInfo = False THEN
SWITCH Input("Do you want to close the application?", DisplayInfo)
CASE 1: Close()
END
END
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.
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.
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.
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:
| | dlgIconError | Icon representing an error. | dlgIconInfo | Icon representing an information. | dlgIconQuestion (Default value) | Icon representing a question. |
Remarks 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.
Example of full input - Typing the question in the editor:
- Code automatically generated (only the "Recipient" variable was entered in the code editor):
Recipient is string
SWITCH Input("Specify a recipient.", Recipient)
CASE 1
CASE 2
CASE 3
END
Business / UI classification: UI Code
This page is also available for…
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|