Forum Discussion

mschlechter's avatar
mschlechter
Occasional Contributor
11 years ago

Recognizing Grid Cell Values in a Delphi Application

Hello.  I am trying to identify items in a grid for a Delphi application, but unfortunately object recognition only works for items in the Grid that accept text input.  For other items that are only for display purposes, there is no individual recognition.  That being the case, I figured there should be some way to recognize the entire grid as a table containing cells with values, but I am not sure how to access the values.  I see built in recongnition for Row and Column count, but once I have that info and know how to setup my loop, what allows me to access the values in those cells?  Thanks!




Set gObject = Aliases.whdm.MainForm.MDIClient.EditRecordForm.ClientPanel.EditPanel.EditGridPanel.Grid



rCount = gObject.RowCount



For i = 1 to rCount



'''Examine cell(i,j) contents

   '''If cell contents = expected value then 

      success etc.

Next


  • Hi Michael,

     


    The answer to your question will depend on what grid is used in your application. Can you check its class name in the Object Browser?


    For most of Delphi controls, TestComplete provides the wValue property where you can pass the row and column indexes and get/set the value of the specified cell. Refer to the "wValue Property (Grid Controls)" article for details. Do you see this property?


     

  • mschlechter's avatar
    mschlechter
    Occasional Contributor
    Thank you for reply Tanya.  The ClassName is MGrid.  I did not see the wValue property available.  Is this type of grid supported, or do i need an add-in/extension of some sort?  Thanks again.
  • Hi Michael,

     


    It looks like you are using the third-party control, right? Please read the "Supported Controls" article - it contains the list of the officially supported controls. If the MGrid control is inherited from one of them, you can use the Object Mapping feature that can make TestComplete treat your control as the supported one. Refer to the What If My Control Is Not Supported? section in the article for details.


     


    If the control isn't supported, you will need to test the control via calling its native methods and properties. The control's documentation should contain information about the methods you can use. Refer to the "Accessing Native Properties and Methods of Delphi Objects" article to learn how to call them in TestComplete. Also, I suggest that you explore our How To - it contains many examples of testing custom controls using native properties and methods: http://support.smartbear.com/howto


     

  • mschlechter's avatar
    mschlechter
    Occasional Contributor
    Thanks again Tanya.  Not sure what else I can add as I do not have access to development team for this application.  I tried mapping to various other grid types, but received errors when then trying to use wValue.  Native Properties do not seem to include anything useful for cell values so not sure where to go from there - OCR?