The Developer Express QuantumGrid control offers a lot of different
column types. Each column type provides a specific in-place editor for
modifying cell values. There are various column types, whose editors
use drop-down windows. For example, the TcxComboBox editor uses a
drop-down window containing the list of text items. Another example is
the TcxCalcEdit editor that uses a drop-down window containing the
calculator control. This article explains how you can work with these
drop-down editors in TestComplete scripts.
To work with drop-down editors, 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.
In QuantumGrid, the cell editing operations are managed by special editing controller objects. To access these objects, use the
Controller.EditingController property of the desired view object (for more information on views, see QuantumGrid documentation).
When a user starts editing the cell value, the grid creates an edit control (in-place editor) for this. This edit control’s type corresponds to the column type. For instance, if a column uses a combo box, the grid will create the combo box editor. If a column uses specific drop-down editor, the grid creates this specific editor. To access the editor, use the
Edit property of the editing controller object. If there is no in-place editor, the property returns an empty value. To check if the grid is in the editing mode, you can use the
IsEditing property of the editing control.
After you obtain the scripting access to the edit control, you can use methods and properties of this control to perform the desired actions. All drop-down editor objects contain the following methods and properties, which you can use to show or hide the drop-down window:
DropDown - Method. Opens the drop-down window.
CloseUp(Accept) - Method. Closes the drop-down window. The Accept parameter specifies whether the editor saves or cancels the changes made within that window.
DroppedDown - Property. Specifies whether the drop-down window is open or not. Assigning True to this property opens the drop-down window; assigning False - closes the window.
To get access to the drop-down window, you can use the
PopupWindow property of the editor object. This property will return the window object corresponding to the drop-down window. Then you can use methods, properties and actions of this object to simulate user actions over the window (see the sample below).
Note that the way in which you simulate user actions over the drop-down window depends on the window. For instance, if you open a drop-down list of a combo box editor, then to simulate keystrokes over this window, you should send keystrokes to the grid control. However, if you open a drop-down window of the calculator editor, then to simulate user actions over this calculator, you send keystrokes to the drop-down window.
The following code demonstrates how you can use the
CloseUp methods to open or hide the drop-down window of a cell that uses the combo box and calculator in-place editor. The sample also demonstrates how to simulate user actions over the drop-down window.
The sample contains the following routines: