|
|
|
|
- Overview
- Principle
- In-memory input suggestions
- How to?
- Examples
- Remarks
- Input suggestions based on a data file
- How to?
- Input suggestions defined programmatically
- How to?
- Example
Input suggestions in an Edit control
Implementing input suggestions in an Edit control is very simple: when the user starts to type in an Edit control, a list automatically opens below the control and shows the values that start with the characters being typed. Input suggestions can be implemented in the editor or be customized programmatically. WINDEV, WINDEV Mobile and WEBDEV include several types of input suggestions: - In-memory input suggestions: The Edit control is not bound to an item in a data file. The automatic input is made from a list of data provided in the code (AssistedInputAdd). The data from the list is displayed according to the input.
- Input suggestions based on a data file: The Edit control is bound to an item in a data file or query. The data from the list is displayed according to the input.
- Input suggestions defined programmatically: Suggestions come from a custom set of data. The display of data in the list according to the input is customized.
In-memory input suggestions How to? To implement in-memory input suggestions: - Use AssistedInputAdd to add the elements that will appear in the input suggestions.
You can add: - a simple value, which will appear in the list of input suggestions,
New in version 28one value that will be displayed and one value that will be stored.
- If necessary, use AssistedInputConfigure to configure the input suggestions: filter, list opening, number of characters typed before opening the list, ...
New in version 28Remark: The stored value allows you to associate a specific value to an input suggestion. You can use this value to perform a specific process according to the type of value selected. Examples Example for a window:
// End of window initialization AssistedInputConfigure(EDT_Find, aiMinSize, 3) AssistedInputConfigure(EDT_Find, aiFilter, filterContains) FOR EACH STRING sTitle OF gsPhotoTitles SEPARATED BY CR AssistedInputAdd(EDT_Find, sTitle) END
New in version 28Remarks - The optional "Select a value in the list of input suggestions" event is executed when an element is selected. This event takes a variable of type AssistedInput as parameter. This variable allows you to get the selected value and the associated stored value, if any.
- By default, the value displayed in the Edit control is the value is selected in the input suggestions. To change the value in the Edit control, use the "Select a value in the list of input suggestions" event. You can choose to display the stored value instead, for example.
For more details, see Events associated with Edit controls. Input suggestions based on a data file How to? To implement input suggestions based on a data file: - In the Edit control description window:
- Check whether the Edit control is bound to an item in a data file or query ("Binding" tab).
Caution: The item must be a key. - In the "Details" tab, check "Assisted input based on data binding".
- Validate the Edit control description window.
At runtime, as soon as the first letter is typed in the control: the first result that matches the entered character is displayed. The matching data changes as you type.
Remarks: - If the Edit control is bound to a query item, the query is automatically executed. However, if the query expects parameters, you must specify them (e.g., in the "Global declarations" or "End of initialization" events of the window) and then execute the query with HExecuteQuery.
- Input suggestions are shown using a "Starts with" filter. To use another filter, you must define input suggestions programmatically.
Input suggestions defined programmatically How to? By defining input suggestions programmatically, you can use a custom data source. To use input suggestions defined programmatically: - Disable the default filter with AssistedInputConfigure (using the filterNone constant). Thus, the list of input suggestions can be opened and display all the specified elements.
- In the "Whenever modifying" event of the Edit control:
Example // "Contains" search performed in the name // and code of an array of stock shares FOR EACH sName, sCode of gArrShare IF Contains(sCode, EDT_Programmed_mode) _OR_ ... Contains(sName, EDT_Programmed_mode) THEN AssistedInputAdd(WIN_InMemory.EDT_Programmed_mode, sName) END END
Related Examples:
|
Complete examples (WEBDEV): Photo_Gallery
[ + ] This example is a photo gallery site and is composed of 2 main parts: - the "visitor" part, developed in Active WEBDEV Page mode and SEO-compatible. - the administration part, secured and developed in standard WEBDEV mode. These are some of the available features: - organize photos via albums - include links to social networks - enable users to comment on posts - user login via WEBDEV'S GPU - contact form - ability to upload, describe, and classify photos via albums on the administration side
|
|
Unit examples (WINDEV): The AssistedInput functions
[ + ] Using the WLanguage AssistedInput functions. These functions are used to easily implement an assisted input on the controls.
|
This page is also available for…
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|