Skip to main content

How to Use Spreadsheet Control Commands

  • 3 minutes to read

In addition to built-in UI elements, context menus, and supported keystrokes, the Spreadsheet and Report Designer controls include most end-user functionality as a comprehensive set of commands implemented by action objects (instances of TdxSpreadSheetAction descendants).

In order to implement a custom command-based UI in your application, you need to manually create the required action objects and link each of them to one or more individual UI elements in your application, such as buttons, menus, ribbon, and toolbar items. To accomplish this, refer to these step-by-step instructions:

  1. Add the standard VCL TActionList component from the Component Palette to an application form or select an existing action list to store the required action object(s).

  2. Invoke the action list’s editor either by double-clicking the TActionList component or clicking the “Action List Editor…” item in its context menu.

  3. Invoke the “Standard Action Classes” dialog by clicking the “New Standard Action…” item in the action list editor’s context menu.

  4. Select the required action from the “DevExpress ExpressSpreadSheet” category and click the OK button.

  1. Select a control that publishes the Action property and assign the newly created action object to it by using the Object Inspector.

Additionally, you can associate an action object with an icon. To do so, refer to the following instructions:

  1. Place the TcxImageList component onto the application form and use the Image List Editor to populate the list with the required icons.

  2. Set the populated image list as the action list’s Images property value.

  3. Select a TdxSpreadSheetAction object in the action list’s editor and specify the required icon’s index within the image list as the action’s ImageIndex property value. As a result, the specified icon is displayed by all client controls that can display icons.

Each command has its own set of conditions that must be met for enabling all UI elements associated with it. For instance, all printing-related commands are available to end users only if the Spreadsheet or Report Designer control has a valid report link in the TdxComponentPrinter component.

Refer to action class descriptions to learn about the conditions for individual commands.

You can use most of the supported commands with any control that has the Action property. However, commands that allow end users to assign specific values (like changing the active font typeface and/or size, cell background color, etc.) instead of performing simple predefined operations (such as invoking a dialog, applying/removing a font attribute, etc.), are designed to be used with bar item editors, including but not limited to, TdxRibbonColorGalleryItem, TcxFontNameComboBox, and TcxComboBox components. All action classes that correspond to these commands are derived from TdxSpreadSheetValueAction. If you need to associate such a command with a custom client control, re-implement the command’s functionality in its OnExecute event handler. For detailed information and code examples, refer to the action class descriptions of each specific command:

Command Action Class Name
ChangeFillColor TdxSpreadSheetChangeFillColor
ChangeFontColor TdxSpreadSheetChangeFontColor
ChangeFontName TdxSpreadSheetChangeFontName
ChangeFontSize TdxSpreadSheetChangeFontSize