Back to Devexpress

TcxEditRepositoryCheckBoxItem Class

vcl-cxeditrepositoryitems-95bd1f27.md

latest5.7 KB
Original Source

TcxEditRepositoryCheckBoxItem Class

A repository item that stores check box editor settings.

Declaration

delphi
TcxEditRepositoryCheckBoxItem = class(
    TcxEditRepositoryItem
)

Remarks

A check box editor allows users to switch between two or three states of an option.

The TcxEditRepositoryCheckBoxItem class overrides the Properties property that allows you to access and customize check box 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 Check Box Repository Item at Design Time

To create a check box 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 CheckBox item and click the Ok button to create a check box repository item.

Create a Check Box Repository Item in Code

The following code example creates a check box repository item, customizes editor settings, and assigns the created repository item to two existing unbound check box editors:

delphi
uses cxEdit, cxEditRepositoryItems;
// ...
var
  ACheckBoxRepositoryItem: TcxEditRepositoryCheckBoxItem;
  ARepositoryItem: TcxEditRepositoryItem;
begin
  ARepositoryItem := cxEditRepository1.CreateItem(TcxEditRepositoryCheckBoxItem);
  ACheckBoxRepositoryItem := ARepositoryItem as TcxEditRepositoryCheckBoxItem;
  ACheckBoxRepositoryItem.Properties.AllowGrayed := True; // Enables an intermediate check box state
  ACheckBoxRepositoryItem.Properties.FullFocusRect := True; // Outlines the check box when it has focus
  // Assigns the created repository item to two existing unbound check box editors
  cxCheckBox1.RepositoryItem := ACheckBoxRepositoryItem;
  cxCheckBox2.RepositoryItem := ACheckBoxRepositoryItem;
end;
cpp
#include "cxEdit.hpp"
#include "cxEditRepositoryItems.hpp"
// ...
  TcxEditRepositoryCheckBoxItem *ACheckBoxRepositoryItem;
  TcxEditRepositoryItem *ARepositoryItem;
  // ...
  ARepositoryItem = cxEditRepository1->CreateItem(__classid(TcxEditRepositoryCheckBoxItem));
  ACheckBoxRepositoryItem = dynamic_cast<TcxEditRepositoryCheckBoxItem*>(ARepositoryItem);
  ACheckBoxRepositoryItem->Properties->AllowGrayed = true; // Enables an intermediate check box state
  ACheckBoxRepositoryItem->Properties->FullFocusRect = true; // Outlines the check box when it has focus
  // Assigns the created repository item to two existing unbound check box editors
  cxCheckBox1->RepositoryItem = ACheckBoxRepositoryItem;
  cxCheckBox2->RepositoryItem = ACheckBoxRepositoryItem;

Check Box Repository Item Deletion

To delete all check box repository items in an edit repository component, call its RemoveItems procedure and pass a reference to the TcxEditRepositoryCheckBoxItem class as a parameter.

If you need to delete an individual check box repository item, release it directly in code (call the Free procedure in Delphi or use the delete keyword in C++Builder).

Inheritance

TObject TPersistent TComponent TcxEditRepositoryItem TcxEditRepositoryCheckBoxItem

See Also

Edit Repository Items

TcxEditRepositoryCheckBoxItem Members

cxEditRepositoryItems Unit