- Edit control overview
- Create an "Edit" control
- Main characteristics of an Edit control
- Type of an Edit control
- Types and masks
- Displaying a hint text in an Edit control
- Other important characteristics
- Edit control style
- Customizing the alphanumeric keypad
- Validation of Edit controls via the Enter key
- Specific HTML 5 features
- Converting an Edit control to a Static control
The Edit control allows users to enter data. This control can also be used to view information.
Create an "Edit" control
To create an "Edit" control:
- On the "Creation" tab, in the "Usual controls" group, click .
- Click where the control will be created in the window or page. The control appears in the editor.
Remark: You can also choose an Edit control from a list of preset controls by expanding "Edit". The list of available controls is displayed with the project skin template. Simply click the control you want to create in the editor.
To view the control characteristics, select "Description" in the context menu.
: You also have the ability to create an edit control in a report. For more details, see Input in the reports
Main characteristics of an Edit control
Type of an Edit control
The format of an Edit control depends on the type of information displayed or entered. The following types of edit controls can be created:
- Text to display or enter a character string (name, address, etc.).
- Multiline text to display or enter several lines separated by a "Carriage Return".
- RTF text to enter and display information in RTF.
- HTML text to enter and format rich text.
- Password: when typing information, all characters will be replaced with asterisks on the screen.
- Numeric to display or enter a numeric value (weight, etc.). The "+++" characters are displayed if the control is not large enough to display the entire number.
- Currency to display or enter monetary values.
- Currency + Euro to manage prices for example
- Date to display or enter dates.
- Time to enter or display times.
- Duration to enter or display durations.
- Text tokens to manage an input with tokens.
- Upload to manage the file upload.
Types and masks
- Input mask: Several input masks can be used for each type of Edit control.
These input masks are multilingual: different input masks can be selected according to the runtime language of the project. For more details, see Multiple languages in the controls.
These input masks can be modified programmatically with the InputMask property.
The keyboard displayed when entering data in the control automatically adapts to the selected input mask. For example, the numeric keyboard will be automatically displayed to enter values in a control using a numeric input mask.
- Display mask: You can also define display masks for some types of controls (Currency, Currency + Euro, Date, Time and Duration). These display masks are used to define the characteristics of the control when it is not in edit.
For example, a Date control can have:
- the input mask: "MM/DD/YYYY".
- the display mask: "DDDD DD MMMM YYYY" (long date format).
Display masks can be multilingual and can be modified programmatically with the DisplayMask
Displaying a hint text in an Edit control
The hint text is used to display a help text in the empty edit control. This help text disappears automatically as soon as the user enters the first character in the control.
This hint text is available for:
- Text Edit controls.
- Numeric, Currency and Currency + Euro Edit controls.
To show the hint text in Numeric, Currency or Currency + Euro edit controls, the option "Blank if zero" must be checked ("Details" tab of the control description).
You can also display the lower bound and the upper bound of the numeric edit control:
- in the hint text ("Display the bounds in the hint text" in the "Details" tab of the control description).
- in the control tooltip ("Display the bounds in the tooltip" in the "Details" tab of the control description).
The help text can be typed:
- in the Edit control description window ("Help" tab in WINDEV/WINDEV Mobile and "Content" tab in WEBDEV).
- programmatically with the Hint property.
The style of the hint text displayed in the control can be configured in the "Style" tab. By default, it corresponds to the style of the input area, in gray and italic. To modify it, simply select "Hint text" and check "Customize the style of the hint text".
The HintTextColor property is used to get and change the color of the hint text programmatically.
The hint text uses the same style as the input area, in italic and gray.
Edit control style
The "Style" tab allows you to customize the appearance of all the elements in the Edit control. You can apply styles to different elements:
- The control caption: You can define the text font, position, color, etc.
- The outside border.
- The text in the input area.
- The input area: For example, you can define the background color, border color, ...
Remark: The "Margins" button allows you to set the margins between the text and the border of of the input area.
- The hint text.
- The tokens (if any).
- Invalid or required input indicators.
Customizing the alphanumeric keypad
In Android and iOS applications, an on-screen keyboard appears automatically when a text input control receives the focus. This keyboard allows the user to enter the desired text.
This keyboard includes a button (bottom right) that can be customized:
To configure this button:
- Go to the "Details" tab of the Edit control description window.
- In the "Keyboard button" option, select the desired type of button. Depending on the selected type, the system will display the corresponding button in the current language on the device.
Remark: The "Custom" button can only be added in Android.
The event associated with this button can be entered in the code editor. It corresponds to the optional event "Validation via keyboard". For more details, see Events associated with the Edit control
Validation of Edit controls via the Enter key
For each Edit control in a page, you can specify the action that will be run when the user presses the Enter key.
This allows, for example, to improve the default events in a page. For instance, there can be several search controls can in the same page, and each control can be validated by pressing the Enter key. The action performed will be the one associated with the Edit control that has focus.
To define the action associated with an Edit control:
- Create a button in your page containing the desired code.
- Open the Edit control description. In the "UI" tab, select the desired button in the " Action on 'Enter' " option.
Specific HTML 5 features
Some characteristics of Edit controls use HTML 5 features:
- Input masks. By choosing an HTML 5 input mask, the site lets the browser handle and check the input. It is not the page (the site) that performs the checks, but the browser itself. In any case, you can run WLanguage code when exiting a control, which allows for additional checks on the data entered. These features are available only for some browsers, from the following versions: Firefox 5, Chrome 12, Opera 11, Safari 5, ...
For more details, see the help about the input masks of text, numeric, date and time controls.
- HTML 5 search control: If this option is selected for a text control, the browser will display an "X" on the right of the control. This X allows the user to clear the control content.
This option is available in the "General" tab of the control description window.
Caution: This option is taken into account only on browsers supporting HTML 5, notably Chrome 12 and Safari 5.
- Automatic completion: This option (located in the "Details" tab of the control description window) is used to enable or disable automatic completion on Edit controls. Automatic completion is enabled by default. When the user starts typing information in a form, all the page controls are immediately and automatically filled with the data previously typed on this computer.
Autocomplete is a dangerous feature. It must be disabled when processing confidential data.
Most browsers that support HTML 5 (Firefox, Chrome, Safari, Opera, etc.) support this feature as well.
Converting an Edit control to a Static control
Unit examples (WINDEV): The edit control
Unit examples (WINDEV): The special characters
Unit examples (WINDEV): The voice recognition functions
Unit examples (WINDEV): Advanced input mask
Training (WINDEV): WD Search Control
Complete examples (WEBDEV): WW_Rewali
This page is also available for…