Forum Discussion

d_padalia's avatar
d_padalia
Occasional Contributor
10 years ago

Getting and Comparing a Grid Cell Color

Hi,



I want to fetch the background and text color of a Syncfusion Grid Cell ( Current Cell) and then compare it with what I expect it to be.





Can someone  help me on this please?



Sys.Process("abc").WinFormsObject("MainWindowForm of Main Window_3lse").****.WinFormsObject("w_gridContainerPanel").WinFormsObject("GridPanel").WinFormsObject("w_grid").CurrentCell



After this if a place a dot (.) I get some methods but no description for them :(

4 Replies

  • TanyaYatskovska's avatar
    TanyaYatskovska
    SmartBear Alumni (Retired)

    Hi Deepak,


     


    Without having your grid, it's difficult to say something for sure. You can try using the sample from the Get a control's background color How To article. You can take the picture of your cell and pass it to the getBKColor function. 


     

  • d_padalia's avatar
    d_padalia
    Occasional Contributor
    Thanks Colin and Tanya.



    Colin, The fact that I dont see any corresponing function in the autocomplete means there is no such function available even at the run time.



    Tanya,



    I am thinking to do following:



    Grid=Sys.Process("abc").........WinFormsObject("w_grid");



    //Assume I have already selected the cell before the test runs



    Cell=Grid.get_CurrentCell();



    // I am hoping this gives me a reference to the current cell which i can then pass //getBKColor(Cell.Picture());



    I am  :



    1. Not able to get full path of the cell as grid cell cant be checked using spy.

    2. I dont see the description of get_CurrentCell ( infact any other funciton applicable on the Grid varibale defined above). 

    3.What is the format of the color returned ? String, Hex or some combnation of RGB?



    Any help would be much appreciated



  • TanyaYatskovska's avatar
    TanyaYatskovska
    SmartBear Alumni (Retired)

    Hi Deepak,


     


    One note about this:


    1. Not able to get full path of the cell as grid cell cant be checked using spy.2. I dont see the description of get_CurrentCell ( infact any other funciton applicable on the Grid varibale defined above).


     


    TestComplete's Object Spy may not catch individual cells in the grid. As a rule, child objects of grid controls are internal, so TestComplete does not recognize them as individual objects. To access such objects, you can use native methods and properties of the control or the methods and properties provided by TestComplete. Please refer to the "Syncfusion Grid Controls Support" article to learn the list of Syncfusion controls TestComplete supports, as well as the approaches you can use to test them. Is your control on the list of the supported ones?


     

    f