Back to Devexpress

TcxEditStyleController Class

vcl-cxedit-029ef177.md

latest4.9 KB
Original Source

TcxEditStyleController Class

A style controller that defines state appearance settings common to multiple editors.

Declaration

delphi
TcxEditStyleController = class(
    TcxStyleController
)

Remarks

A style controller is a non-visual component that stores appearance settings of individual states (normal, focused, read-only, etc.) for multiple editors. To associate a style controller with an editor, assign a TcxEditStyleController object to the editor’s Style.StyleController property.

Tip

If you need to override global appearance settings for all editors in the application, use the TcxDefaultEditStyleController component.

Main API Members

The list below outlines key members of the TcxEditStyleController class. These members allow you to customize editor appearance.

Style | StyleDisabled | StyleFocused | StyleHot | StyleReadOnlyAllow you to define individual appearance settings for different states of all editors associated with the style controller. Corresponding appearance settings of associated editors have higher priority than these style controller settings.StylesProvides access to individual styles applied to editors in different states.RestoreStylesRestores all default style settings for all editor states.

Code Example: Override Global Appearance Settings for Multiple Editors

The following code example uses a TcxEditStyleController component to override a global skin for three spin editors:

delphi
uses
  cxEdit, // Declares the TcxEditStyleController class
  cxSpinEdit, // Declares the TcxSpinEdit class
  cxTextEdit, // Declares the TcxTextEdit class
  dxSkinsForm; // Declares the TdxSkinController class
// ...

procedure TMyForm.FormCreate(Sender: TObject);
begin
  dxSkinController1.SkinName := 'WXICompact'; // Specifies a skin at the global level
  // Specify a different skin for an edit style controller component
  cxEditStyleController1.Style.LookAndFeel.SkinName := 'Office2019Black';
  // Associate a style controller with three spin editors
  cxSpinEdit1.Style.StyleController := cxEditStyleController1;
  cxSpinEdit2.Style.StyleController := cxEditStyleController1;
  cxSpinEdit3.Style.StyleController := cxEditStyleController1;
end;
cpp
#include "cxEdit.hpp" // Declares the TcxEditStyleController class
#include "cxSpinEdit.hpp" // Declares the TcxSpinEdit class
#include "cxTextEdit.hpp" // Declares the TcxTextEdit class
#include "dxSkinsForm.hpp" // Declares the TdxSkinController class

// ...

void __fastcall TMyForm::FormCreate(TObject *Sender)
{
  dxSkinController1->SkinName = "WXICompact"; // Specifies a skin at the global level
  // Specify a different skin for an edit style controller component
  cxEditStyleController1->Style->LookAndFeel->SkinName = "Office2019Black";
  // Associate a style controller with three spin editors
  cxSpinEdit1->Style->StyleController = cxEditStyleController1;
  cxSpinEdit2->Style->StyleController = cxEditStyleController1;
  cxSpinEdit3->Style->StyleController = cxEditStyleController1;
}

Direct TcxEditStyleController Class References

The following public API members reference a TcxEditStyleController object:

TcxCustomEditStyle.ActiveStyleControllerProvides access to the source of default editor appearance settings.TcxCustomEditStyle.StyleControllerIdentifies the style controller for the current TcxCustomEditStyle object.

Inheritance

TObject TPersistent TComponent TcxCustomComponent TcxComponent TcxScalableComponent TcxStyleController TcxEditStyleController

See Also

TcxDefaultEditStyleController Class

TcxEditStyleController Members

cxEdit Unit