Forum Discussion

vthomeschoolmom's avatar
vthomeschoolmom
Super Contributor
14 years ago

Compone t One truedbgrid pro v 8 in a VB 6 app

Using Test Complete 7. I can position the cursor on my current row.



grdMyGrid.Row = iDesiredRowIndex



But have an action that is only available when the whole row is selected by clicking the row selector. When recording the row selector, coordinate of the grid object are used for the click. This is ... not good.



Does anyone know how to select an entire row in this control?



Thanks
  • Hi Lane,



    You can test the ComponentOne True DBGrid control by using a set of its native properties, fields and methods that are exposed by TestComplete and available in tests. It seems that you have already used one of such properties, Row, in your scripts. There is also the SelBookmarks native property that provides access to a collection of currently selected grid rows. The object returned by this property contains the Add method. By passing a row index to this method, you can add a new item to the collection, and the appropriate row then becomes selected in the grid. Note that the collection can contain several items at the same time if multiselection is enabled for the grid. Then, each newly added item will cause the selection of the appropriate row in the grid and the previously selected rows will still remain selected. In this case, if you need only one row to be selected in the grid, you should also call the SelBookmarks.Clear() method before adding a new item to the collection. This method clears the previous selection in the grid. For example:





    Dim bookmarks



    Set bookmarks = grdMyGrid.SelBookmarks



    ' Clear the previous selection

    bookmarks.Clear



    ' Select the row with the index equal to 5

    bookmarks.Add(5)





    However, note that this approach selects grid rows programmatically. That is, the specified row becomes selected with no mouse clicks actually performed over the appropriate row selector during the test execution. Does this approach match what you need?



    BTW, TestComplete currently records only coordinate mouse clicks with the True DBGrid control because there are no special methods and properties provided by TestComplete for this component. However, if you are really interested in implementing a special support for the ComponentOne True DBGrid control in TestComplete, you can vote for this feature in the TestComplete Feature Survey. Perhaps, such support will be implemented in one of future releases of TestComplete if a lot of users will be interested in it.
  • You know not only did you give me what I need, but you offered me food for thought. I have been accessing a lot of controls with their native properties and methods. I have to watch for events within the application that would fire with different user inputs like mouse clicks. If I use native properties and methods of the controls, I by pass these events. Thanks. You have given me more info that I expected.
    • bindubudha's avatar
      bindubudha
      New Contributor

      I appreciate that this is quite an old post. But, I am also trying to implement automation on a similar Application. 

       

      Instead of using the index number of the row, is there any way we can search by its content?