- Assisted input "in memory"
- How to?
- "Browsing" assisted input
- How to?
- "Programmed" assisted input
- How to?
Assisted input in an edit control (prefix syntax)
The principle of assisted input in an edit control is straightforward: when the user starts to type in an edit control, a list is automatically expanded below the control, proposing the values that start with the text currently typed.
The assisted input can be implemented from the editor or it can be customized through programming.
WINDEV, WINDEV Mobile and WEBDEV propose several types of assisted input:
- Assisted input "in memory": 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 (<Edit>.AddAssistedInput). The data from the list is displayed according to the input.
- "browsing" assisted input: 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.
- Programmed assisted input: The assisted input is performed from a custom list of data. The display of data in the list according to the input is customized.
Caution: In this version, assisted input is not available in simulator mode.
Assisted input "in memory"
To implement the assisted input "in memory":
- Use <Edit>.AddAssistedInput to add the elements taken into account by the assisted input.
It is possible to add:
- a simple value, displayed in the list of proposals of the assisted entry,
New in version 28
a displayed value and a stored value.
- If necessary, use <Edit>.ConfigureAssistedInput to configure the characteristics of the assisted input: 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 row of the assisted entry. This value can be used for example to perform a specific treatment according to the type of value selected.
New in version 28
- The optional event "Selection of a value in the assisted input list" is executed when an element is selected. This event takes as parameter an Variable of type AssistedInput. This Variable shows the selected value and the associated stored value if it exists.
- By Default, the value displayed in the edit control when selected in the assisted entry, corresponds to the selected value. To change the value of edit control, use the event "Select a value from the assisted entry list.". For example, it is possible to display the value stored in the edit control.
For more details, see Events associated with Edit controls
"Browsing" assisted input
To implement the "Browsing" assisted input:
- 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:
- a list appears with different results that match the letter typed.
- the first data corresponding to the entered letter is displayed. The matching data changes as you type.
- 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 <Source>.ExecuteQuery.
- The display filter of the assisted input in a "Starts with" filter. To use another filter, you must use the programmed assisted input.
"Programmed" assisted input
The programmed assisted input is used to handle a custom data source.
To use the programmed assisted input:
- Disable the default filter with <Edit>.ConfigureAssistedInput (using the filterNone constant). Therefore, the list for the assisted input can be opened and it will display all the specified elements.
- In the "Whenever modified" event of the edit control:
// "Contains" search performed in the name
// and code of an array of stock shares
FOR EACH sName, sCode of gArrShare
IF Contains(sCode, sSoughtValue) _OR_ ...
Contains(sName, sSoughtValue) THEN
Complete examples (WEBDEV): Photo_Gallery
Unit examples (WINDEV): The AssistedInput functions
This page is also available for…