TcxEditRepositoryTokenItem Class
A repository item that stores token editor settings.
Declaration
TcxEditRepositoryTokenItem = class(
TcxEditRepositoryItem
)
Remarks
A token editor validates user input and converts valid text fragments into tokens (clickable boxes that can display text and an image).
The TcxEditRepositoryTokenItem
class overrides the Properties property that allows you to access and customize token editor settings.
Edit Repository Items and Standalone Editors
Edit repository items are useful when you need to share the same settings between multiple editors of the same type. To accomplish this goal, you can assign the same edit repository item to RepositoryItem properties of all target editors.
Edit Repository Items and Container Controls
A container control item (such as a toolbar edit item or a column (or any other data item) in a Data Grid, Vertical Grid, or Tree List control) can embed an in-place editor shipped with the ExpressEditors Library. An in-place editor exists (and, therefore, has its own WinAPI handle) only when the target container control item is being edited. Otherwise, the container control item displays a static editor image for resource usage optimization.
Create a Token Editor Repository Item at Design Time
To create a token editor repository item at design time, double-click a TcxEditRepository component to invoke its collection editor.
The collection editor dialog allows you to manage repository items. Click the Add… button to invoke a repository item creation dialog.
Select the TokenEdit item and click the Ok button to create a token edit repository item.
Create a Token Editor Repository Item in Code
The following code example creates a token editor repository item, populates a token collection with predefined tokens, disables custom token input, and assigns the created repository item to two existing token editors:
uses cxEdit, cxEditRepositoryItems;
// ...
var
ATokenEditRepositoryItem: TcxEditRepositoryTokenItem;
ARepositoryItem: TcxEditRepositoryItem;
begin
ARepositoryItem := cxEditRepository1.CreateItem(TcxEditRepositoryTokenItem);
ATokenEditRepositoryItem := ARepositoryItem as TcxEditRepositoryTokenItem;
// Populates the created token repository item with predefined tokens
ATokenEditRepositoryItem.Properties.Tokens.Add('January');
ATokenEditRepositoryItem.Properties.Tokens.Add('February');
ATokenEditRepositoryItem.Properties.Tokens.Add('March');
ATokenEditRepositoryItem.Properties.Tokens.Add('April');
ATokenEditRepositoryItem.Properties.Tokens.Add('May');
ATokenEditRepositoryItem.Properties.Tokens.Add('June');
ATokenEditRepositoryItem.Properties.Tokens.Add('July');
ATokenEditRepositoryItem.Properties.Tokens.Add('August');
ATokenEditRepositoryItem.Properties.Tokens.Add('September');
ATokenEditRepositoryItem.Properties.Tokens.Add('October');
ATokenEditRepositoryItem.Properties.Tokens.Add('November');
ATokenEditRepositoryItem.Properties.Tokens.Add('December');
// Prevents users from adding custom tokens
ATokenEditRepositoryItem.Properties.AllowAddCustomTokens := False;
// Assigns the created repository item to two existing unbound token editors
dxTokenEdit1.RepositoryItem := ATokenEditRepositoryItem;
dxTokenEdit2.RepositoryItem := ATokenEditRepositoryItem;
end;
Token Editor Repository Item Deletion
To delete all token editor repository items in a TcxEditRepository component, call its RemoveItems procedure and pass a reference to the TcxEditRepositoryTokenItem
class as a parameter.
If you need to delete an individual token edit repository item, release it directly in code (call the Free procedure in Delphi or use the delete
keyword in C++Builder).