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:
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