Forum Discussion

anonymous_67424's avatar
anonymous_67424
Occasional Contributor
9 years ago

Unable to find object in a grid in Windows application

For my test I need to validate the color of an icon placed in a grid. Objectspider recognizes the grid but not more than that (icons, cells etc) within the grid are not detected. Advanced view doesn't help me either with detecting elements within the grid.

 

In this specific case, I would like to validate the color of the 'phone' icon in the grid, in this case it's black.

 

Any help or tips are appreciated.

5 Replies

  • rickh_28's avatar
    rickh_28
    Occasional Contributor

    When you use Object Spy to identify your grid, do you have a property called "wValue" or something like that as part of the grid?  It probably has a button called "Params" next to it.  So you might be able to use something like:

     

    myGrid.wValue(2,0)

     

    That might get you access the cell itself, but then we still need to verify what you actually need to verify.  I can't find a "color" property in the grids I use, but I'm wondering if there are any other differences between the 'phone' icons you need to differentiate between.  If there is a difference in size (my 'read' icon is 20 pixels wide, but my 'unread' is only 15), you could use

     

    if(myGrid.wValue(2,0).Width==15) //do something

     

    But once you can look into the cell values, you might be able to find some other differences that, while not technically telling you if the color of your image is black, might still tell you what you need to know.  For example, if you're REALLY lucky, the devs might have used the "Tag" property to differentiate between different phone statuses or types or whatever.

    • anonymous_67424's avatar
      anonymous_67424
      Occasional Contributor

      Hi,

      thanks for the answer but unfortunately I do not have any "Value" (or something like that)  property.

       

      Can't access any individual cell in the grid either :(

       

      Is there another approach I could use?

       

      Is there a specific setting in TC I could change/should change to get "access" to the specific lines/columns/cells? 

       

      • Colin_McCrae's avatar
        Colin_McCrae
        Community Hero

        What kind of grid is it? (class name will likely tell you)

         

        With the Delphi grids I've been using recently, they use columns/rows/fields/items in the properties and an underlying dataset (datalink > dataset) object as the grid is linked directly to a DB. For some things, you can get from the grid properties, for others, I need to look at the underlying dataset ...