Working With Developer Express QuantumGrid - Activating In-place Editors
Test and Monitor | Posted April 18, 2007

The QuantumGrid control lets users change data directly within grid cells. This article explains how you can activate an in-place editor from scripts.

Before activating the cell’s in-place editor, you need to locate the desired cell within the grid and select it. After the desired cell is chosen, you can activate an in-place editor of the cell by simulating keyboard shortcuts over the grid window, or by calling internal methods and properties of the TcxGrid control (TcxGrid is a class name of the QuamtumGrid component).

To perform these actions, TestComplete should have access to the internal methods and properties of the TcxGrid object (TcxGrid is the class name of the QuantumGrid control). That is, the tested application must be compiled as an Open Application with debug information.

Simulating Keyboard Shortcuts

The focused cell’s in-place editor can be activated upon pressing the F2 key. You can simulate this key press using the Keys action applied to the TcxGrid object. Below is a sample that demonstrates how you can do this.

The sample code contains the following routines:

  • Main - The “main” routine of the sample. It obtains the scripting object corresponding to the tested TcxGrid control and then calls the ActivateCellInplaceEditor routine to activate the in-place editor of a cell.
  • ActivateCellInplaceEditor - This routine calls the SelectGridCell routine to choose the desired cell and then simulates the F2 keystroke over the grid window.

    The ActivateCellInplaceEditor routine uses the following parameters:

    • grid - The scripting object that corresponds to the tested grid.
    • view - The view object that is used to display data. If this parameter is Nothing (VBScript), null (JScript, C++Script, C#Script) or nil (DelphiScript), the routine assumes that you are working with the view associated with the root level.
    • rowIndex - A zero-based index of the desired row.
    • columnId - The caption of the desired column or the column index (zero-based) among other visible columns.
  • SelectGridCell - Chooses the cell specified by its row and column indexes.
  • GetColumn - A helper routine that returns a column object by the column’s caption or by column index among other visible columns (the index is zero-based).

Using TcxGrid Internal Methods

You can also activate an in-place editor by calling the Controller.EditingController.ShowEdit method of the view object that is used by the TcxGrid object. The ShowEdit method can use one or several parameters that specify various options. For more information on these parameters, please see the QuantumGrid documentation. In our example, we will only pass one parameter to this method - 0 (VBScript), null (JScript, C++Script, C#Script) or nil (DelphiScript). The following code demonstrates how to activate an in-place editor by calling the ShowEdit method.


By submitting this form, you agree to our
Terms of Use and Privacy Policy

Thanks for Subscribing

Keep an eye on your inbox for more great content.

Continue Reading

Add a little SmartBear to your life

Stay on top of your Software game with the latest developer tips, best practices and news, delivered straight to your inbox