vcl-cxeditrepositoryitems-67d90edf.md
A repository item that stores button editor settings.
TcxEditRepositoryButtonItem = class(
TcxEditRepositoryItem
)
A button editor is a single-line text editor that can display buttons within its client area.
The TcxEditRepositoryButtonItem class overrides the Properties property that allows you to access and customize button editor settings.
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.
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.
To create a button editor repository item at design time, double-click an edit repository component to invoke its collection editor.
The collection editor allows you to manage repository items. Click the Add… button to invoke a repository item creation dialog.
Select the ButtonEdit item and click the Ok button to create a button editor repository item.
The following code example creates a button editor repository item, defines two custom buttons, and assigns the created repository item to two existing unbound button editors:
uses cxEdit, cxEditRepositoryItems;
// ...
var
AButtonRepositoryItem: TcxEditRepositoryButtonItem;
ARepositoryItem: TcxEditRepositoryItem;
AButton: TcxEditButton;
begin
ARepositoryItem := cxEditRepository1.CreateItem(TcxEditRepositoryButtonItem);
AButtonRepositoryItem := ARepositoryItem as TcxEditRepositoryButtonItem;
AButton := AButtonRepositoryItem.Properties.Buttons.Add; // Creates a button
AButton.Caption := 'List'; // Defines a button caption
AButton.Kind := bkText; // Displays the defined button in the created button
AButton := AButtonRepositoryItem.Properties.Buttons.Add; // Creates another button
AButton.Kind := bkEllipsis; // Displays an ellipsis in the created button
// Assigns the created repository item to two existing unbound button editors
cxButtonEdit1.RepositoryItem := AButtonRepositoryItem;
cxButtonEdit2.RepositoryItem := AButtonRepositoryItem;
end;
#include "cxEdit.hpp"
#include "cxEditRepositoryItems.hpp"
// ...
TcxEditRepositoryButtonItem *AButtonRepositoryItem;
TcxEditRepositoryItem *ARepositoryItem;
TcxEditButton *AButton;
// ...
ARepositoryItem = cxEditRepository1->CreateItem(__classid(TcxEditRepositoryButtonItem));
AButtonRepositoryItem = dynamic_cast<TcxEditRepositoryButtonItem*>(ARepositoryItem);
AButton = AButtonRepositoryItem->Properties->Buttons->Add(); // Creates a button
AButton->Caption = "List"; // Defines a button caption
AButton->Kind = bkText; // Displays the defined caption in the created button
AButton = AButtonRepositoryItem->Properties->Buttons->Add(); // Creates another button
AButton->Kind = bkEllipsis; // Displays an ellipsis in the created button
// Assigns the created repository item to two existing unbound button editors
cxButtonEdit1->RepositoryItem = AButtonRepositoryItem;
cxButtonEdit2->RepositoryItem = AButtonRepositoryItem;
To delete all button editor repository items in a TcxEditRepository component, call its RemoveItems procedure and pass a reference to the TcxEditRepositoryButtonItem class as a parameter.
If you need to delete an individual button editor repository item, release it directly in code (call the Free procedure in Delphi or use the delete keyword in C++Builder).
TObject TPersistent TComponent TcxEditRepositoryItem TcxEditRepositoryButtonItem
See Also