Skip to main content

TcxEditRepositoryFontNameComboBox Class

Declaration

TcxEditRepositoryFontNameComboBox = class(
    TcxEditRepositoryItem
)

Remarks

A font name combo box allows users to select a font typeface.

VCL Editors Library: A Font Name Combo Box Example

The TcxEditRepositoryFontNameComboBox class overrides the Properties property that allows you to access and customize font name combo 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.

VCL Tree List: An In-Place Date Editor

Create a Font Name Combo Box Repository Item at Design Time

To create a font name combo box repository item at design time, double-click a TcxEditRepository component to invoke its collection editor.

VCL Editors Library: An Edit Repository Collection Editor

The collection editor dialog allows you to manage repository items. Click the Add… button to invoke a repository item creation dialog.

VCL Editors Library: An Edit Repository Item Creation Dialog

Select the FontNameComboBox item and click the Ok button to create a font name combo box repository item.

Create a Font Name Combo Box Repository Item in Code

The following code example creates a font name combo box repository item, customizes font name combo box settings, and assigns the created repository item to two existing font name combo boxes:

uses cxEdit, cxExtEditRepositoryItems;
// ...
var
  AFontNameComboBoxRepositoryItem: TcxEditRepositoryFontNameComboBox;
  ARepositoryItem: TcxEditRepositoryItem;
begin
  ARepositoryItem := cxEditRepository1.CreateItem(TcxEditRepositoryFontNameComboBox);
  AFontNameComboBoxRepositoryItem := ARepositoryItem as TcxEditRepositoryFontNameComboBox;
  AFontNameComboBoxRepositoryItem.Properties.FontTypes := [cxftTTF]; // Loads only TrueType fonts
  // Uses corresponding fonts to display font names
  AFontNameComboBoxRepositoryItem.Properties.UseOwnFont := True;
  // Assigns the created repository item to two existing unbound font name combo boxes
  cxFontNameComboBox1.RepositoryItem := AFontNameComboBoxRepositoryItem;
  cxFontNameComboBox2.RepositoryItem := AFontNameComboBoxRepositoryItem;
end;

Font Name Combo Box Repository Item Deletion

To delete all font name combo box repository items in a TcxEditRepository component, call its RemoveItems procedure and pass a reference to the TcxEditRepositoryFontNameComboBox class as a parameter.

If you need to delete an individual font name combo 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
TcxEditRepositoryFontNameComboBox
See Also