- Text token Edit control
- Operating mode of the text token edit control (at runtime)
- Characteristics of a Text token Edit control
- Creating a Text token Edit control
- Options specific to Text token Edit controls
- Managing a Text token Edit control programmatically
- Associated events
- Associated WLanguage functions and properties
Managing a Text token Edit control
Interfaces that use token controls are common. A Token control contains variable amounts of information in a limited area.
When a large number of multiple choices (e.g. selecting several colors among dozens) are available to the end user, the token control is an easy way to present these choices in a clear way.
When the user chooses a new criterion, it is added into the control.
If the user decides to delete a criterion, they can simply click the "X" next to it.
To manage a token control in WINDEV, WEBDEV, and WINDEV Mobile, simply create a "Text token" Edit control. The different tokens can be entered:
- directly by the end user,
Caution: "Text token" Edit controls cannot be used in a Table or Looper control.
Operating mode of the text token edit control (at runtime)
- A token is automatically added into the control when the user presses the Enter key or uses one of the specified separator characters.
- If the input area has focus:
- Clicking on a token removes the input cursor.
- You can use the arrows to select tokens and remove the input cursor.
- If a token is selected:
- you can use the keyboard arrows and the Home and End keys to select and move among the tokens.
- the Del key deletes the selected token.
- the Backspace key deletes the previous token.
- Using the "X" allows you to delete the desired token.
- If the user has not set the focus on the input area yet:
- The Tab key sets the focus on the input area if the Edit control is active.
- The Tab key sets the focus on the first token if the Edit control is not active.
- If the focus is set on another control, the selected input area and/or token lose focus.
Characteristics of a Text token Edit control
Creating a Text token Edit control
To create a Text token 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.
- In the Edit control description window, select "Text tokens" and validate.
: It is also possible to create a Text token Edit control from a list of predefined controls delivered by default in the "Edit" menu (
icon). The list of available controls is displayed with the project skin template. Simply select "Token edit" or "Token eMail edit".
Options specific to Text token Edit controls
The description window of the Text token Edit control allows you to define:
- the management options of the control and the tokens ( "General" tab).
- the style of the tokens ( "Style" tab).
The "General" tab of the control description window includes the following options:
- Input mask: When direct input is enabled in a Token control, it is possible to choose an input mask, just like in every Edit control. The end user is guided: email, uppercase characters, numeric values, postal code, etc.
- Input separators (in addition to <CR>): List of characters considered as token separators. When the user enters one of these characters, a token will be created with the content of the input area and the user will proceed to enter the next token. This list can be manipulated in the code via the TokenListSeparator property.
- Unicode: Allows the input of Unicode characters.
- Allow duplicates: Allows the input of duplicate tokens. If this option is selected, the user will be able to tokenize the same text several times. This option can be configured programmatically using the TokenAllowDuplicate property.
- Automatic line wrap: Sets the behavior of the control when numerous tokens are entered: tokens can be displayed on several lines (default option) or on a single line with a horizontal scrollbar.
- Deletable tokens: Allows the user to delete tokens from the Edit control. In that case, an X will appear in the token. This option can be configured programmatically using the TokenDeletable property.
The "Style" tab in the control description window allows you to define:
- the style of the token caption (element "Tokens: Caption").
- the style of the token (element "Tokens: Border"). In this case, it is possible to select:
- the X icon for the token. The image must have the following dimensions: 12 x 12 pixels (in each state).
- the background and border color of the token.
- the type of token borders.
- the style of the selected token ("Tokens: Selection"). You can then choose the color of the selected token. The "Automatic" color automatically sets the color of the selected token depending on the color of the text. Thus, the text of the token is always readable.
Managing a Text token Edit control programmatically
At runtime, the user can add, delete or select tokens in an Edit control.
You can use different events to manage these actions:
- Add a token.
- Delete a token.
- Click on a token.
These events have a procedure that retrieves the current token in a variable of type Token
Associated WLanguage functions and properties
The following WLanguage elements allow you to manage Text token Edit controls:
- the Token variable type, which is used to get and set all the characteristics of a token.
- token management functions:
- standard syntax:
- prefix syntax:
- properties for managing tokens and their characteristics:
|StoredValue||The StoredValue property is used to get the value currently stored by: |
- a row in a List Box, ListView or Combo Box control.
- a "Text token" Edit control.
|Token||The Token property is used to manage the different tokens associated with a "Text token" edit control.|
|TokenAllowDuplicate||The TokenAllowDuplicate property is used to: |
- Allow or prevent the user from entering duplicates in a "Text token" edit control.
- Determine if duplicates are allowed in a "Text token" edit control.
|TokenCurrentInput||The TokenCurrentInput property is used to read or change the value being entered in a "Text token" edit control.|
|TokenDeletable||The TokenDeletable property is used to: |
- Determine if the end user is allowed to delete tokens in a "Text token" edit control.
- Allow or prevent the end user from deleting tokens in a "Text token" edit control.
|TokenEnabled||The TokenEnabled property determines if an Edit control is a "Text token" Edit control.|
|TokenListSeparator||The TokenListSeparator property retrieves or modifies the separators that trigger the creation of new tokens when entering information in a "Text token" edit control.|
Unit examples (WINDEV): The Text token edit control
Unit examples (WEBDEV): The text token edit control
Unit examples (WINDEV Mobile): The Text token edit control
This page is also available for…