Back to Devexpress

TcxEditRepositoryTrackBar Class

vcl-cxexteditrepositoryitems-99403ce3.md

latest5.4 KB
Original Source

TcxEditRepositoryTrackBar Class

A repository item that stores track bar settings.

Declaration

delphi
TcxEditRepositoryTrackBar = class(
    TcxEditRepositoryItem
)

Remarks

A simple track bar editor (TcxTrackBar/TcxDBTrackBar) uses a thumb to specify a numeric value.

The TcxEditRepositoryTrackBar class overrides the Properties property that allows you to access and customize track bar 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 Track Bar Repository Item at Design Time

To create a track bar 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.

Create a Track Bar Repository Item in Code

The following code example creates a track bar repository item, customizes track bar settings, and assigns the created repository item to two track bars:

delphi
uses cxEdit, cxExtEditRepositoryItems;
// ...
var
  ATrackBarRepositoryItem: TcxEditRepositoryTrackBar;
  ARepositoryItem: TcxEditRepositoryItem;
begin
  ARepositoryItem := cxEditRepository1.CreateItem(TcxEditRepositoryTrackBar);
  ATrackBarRepositoryItem := ARepositoryItem as TcxEditRepositoryTrackBar;
  ATrackBarRepositoryItem.Properties.Min := 0; // Defines the minimum available value
  ATrackBarRepositoryItem.Properties.Max := 255; // Defines the maximum available value
  // Assigns the created repository item to two existing unbound track bars
  cxTrackBar1.RepositoryItem := ATrackBarRepositoryItem;
  cxTrackBar2.RepositoryItem := ATrackBarRepositoryItem;
end;
cpp
#include "cxEdit.hpp"
#include "cxExtEditRepositoryItems.hpp"
// ...
  TcxEditRepositoryTrackBar *ATrackBarRepositoryItem;
  TcxEditRepositoryItem *ARepositoryItem;
  // ...
  ARepositoryItem = cxEditRepository1->CreateItem(__classid(TcxEditRepositoryTrackBar));
  ATrackBarRepositoryItem = dynamic_cast<TcxEditRepositoryTrackBar*>(ARepositoryItem);
  ATrackBarRepositoryItem->Properties->Min = 0; // Defines the minimum available value
  ATrackBarRepositoryItem->Properties->Max = 255; // Defines the maximum available value
  // Assigns the created repository item to two existing unbound track bars
  cxTrackBar1->RepositoryItem = ATrackBarRepositoryItem;
  cxTrackBar2->RepositoryItem = ATrackBarRepositoryItem;

Track Bar Repository Item Deletion

To delete all track bar repository items in a TcxEditRepository component, call its RemoveItems procedure and pass a reference to the TcxEditRepositoryTrackBar class as a parameter.

If you need to delete an individual track bar 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 TcxEditRepositoryTrackBar

See Also

TcxEditRepositoryTrackBar Members

cxExtEditRepositoryItems Unit